| 125 | ) |
| 126 | |
| 127 | type LiveStore struct { |
| 128 | services.Service |
| 129 | |
| 130 | cfg Config |
| 131 | logger log.Logger |
| 132 | reg prometheus.Registerer |
| 133 | |
| 134 | subservicesWatcher *services.FailureWatcher |
| 135 | |
| 136 | ingestPartitionID int32 |
| 137 | ingestPartitionLifecycler *ring.PartitionInstanceLifecycler |
| 138 | livestoreLifecycler *ring.BasicLifecycler |
| 139 | |
| 140 | client *kgo.Client |
| 141 | decoder *ingest.Decoder |
| 142 | |
| 143 | reader *PartitionReader |
| 144 | |
| 145 | // Multi-tenant instances |
| 146 | instancesMtx sync.RWMutex |
| 147 | instances map[string]*instance |
| 148 | wal *wal.WAL |
| 149 | completeBlockEncoding encoding.VersionedEncoding |
| 150 | completeBlockLifecycle completeBlockLifecycle |
| 151 | overrides overrides.Interface |
| 152 | |
| 153 | // Background processing |
| 154 | ctx context.Context // context for the service. all background processes should exit if this is cancelled |
| 155 | cancel func() |
| 156 | wg sync.WaitGroup |
| 157 | completeQueues *flushqueues.ExclusiveQueues[*completeOp] |
| 158 | startupComplete chan struct{} // channel to signal that the starting function has finished. allows background processes to block until the service is fully started |
| 159 | lagCancel context.CancelFunc |
| 160 | readyErr atomic.Pointer[error] // nil when ready to serve queries |
| 161 | lastRecordTimeNanos atomic.Int64 // stores timestamp of last consumed record as UnixNano, -1 means not set |
| 162 | |
| 163 | cutToWalStop chan struct{} // closed to stop perTenantCutToWalLoop goroutines before shutdown flush |
| 164 | cutToWalWg sync.WaitGroup // tracks active perTenantCutToWalLoop goroutines |
| 165 | } |
| 166 | |
| 167 | func New(cfg Config, overridesService overrides.Interface, completeBlockFlusher completeBlockFlusher, logger log.Logger, reg prometheus.Registerer) (*LiveStore, error) { |
| 168 | completeBlockEncoding, encErr := encoding.FromVersionForWrites(cfg.BlockConfig.Version) |
nothing calls this directly
no outgoing calls
no test coverage detected