(TelemetryTypeBuilder<T> builder, CairoConfiguration configuration)
| 80 | private TableWriter writer; |
| 81 | |
| 82 | public Telemetry(TelemetryTypeBuilder<T> builder, CairoConfiguration configuration) { |
| 83 | TelemetryType<T> type = builder.build(configuration); |
| 84 | final TelemetryConfiguration telemetryConfiguration = type.getTelemetryConfiguration(configuration); |
| 85 | enabled = telemetryConfiguration.getEnabled(); |
| 86 | maxFileNameLen = configuration.getMaxFileNameLength(); |
| 87 | if (enabled) { |
| 88 | telemetryType = type; |
| 89 | clock = configuration.getMicrosecondClock(); |
| 90 | dbSizeEstimateTimeout = telemetryConfiguration.getDbSizeEstimateTimeout() * 1000; |
| 91 | telemetryQueue = new RingQueue<>(type.getTaskFactory(), telemetryConfiguration.getQueueCapacity()); |
| 92 | telemetryPubSeq = new MPSequence(telemetryQueue.getCycle()); |
| 93 | telemetrySubSeq = new SCSequence(); |
| 94 | telemetryPubSeq.then(telemetrySubSeq).then(telemetryPubSeq); |
| 95 | ttlWeeks = telemetryConfiguration.getTtlWeeks(); |
| 96 | ThrottleInterval = telemetryConfiguration.getThrottleIntervalMicros(); |
| 97 | lastEventTimestamps = new IntLongHashMap(); |
| 98 | taskConsumer = ThrottleInterval > 0 ? this::consumeThrottled : this::consumeDirect; |
| 99 | } else { |
| 100 | telemetryType = null; |
| 101 | clock = null; |
| 102 | dbSizeEstimateTimeout = 0; |
| 103 | telemetryQueue = null; |
| 104 | telemetryPubSeq = null; |
| 105 | telemetrySubSeq = null; |
| 106 | lastEventTimestamps = null; |
| 107 | ttlWeeks = 0; |
| 108 | ThrottleInterval = 0; |
| 109 | taskConsumer = null; |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | public void clear() { |
| 114 | if (writer != null) { |
nothing calls this directly
no test coverage detected