(ctx context.Context, r prometheus.Registerer, l *slog.Logger, ranges []int64, pool chunkenc.Pool, opts LeveledCompactorOptions)
| 200 | } |
| 201 | |
| 202 | func NewLeveledCompactorWithOptions(ctx context.Context, r prometheus.Registerer, l *slog.Logger, ranges []int64, pool chunkenc.Pool, opts LeveledCompactorOptions) (*LeveledCompactor, error) { |
| 203 | if len(ranges) == 0 { |
| 204 | return nil, errors.New("at least one range must be provided") |
| 205 | } |
| 206 | if pool == nil { |
| 207 | pool = chunkenc.NewPool() |
| 208 | } |
| 209 | if l == nil { |
| 210 | l = promslog.NewNopLogger() |
| 211 | } |
| 212 | mergeFunc := opts.MergeFunc |
| 213 | if mergeFunc == nil { |
| 214 | mergeFunc = storage.NewCompactingChunkSeriesMerger(storage.ChainedSeriesMerge) |
| 215 | } |
| 216 | maxBlockChunkSegmentSize := opts.MaxBlockChunkSegmentSize |
| 217 | if maxBlockChunkSegmentSize == 0 { |
| 218 | maxBlockChunkSegmentSize = chunks.DefaultChunkSegmentSize |
| 219 | } |
| 220 | pe := opts.PE |
| 221 | if pe == nil { |
| 222 | pe = index.EncodePostingsRaw |
| 223 | } |
| 224 | if opts.Metrics == nil { |
| 225 | opts.Metrics = NewCompactorMetrics(r) |
| 226 | } |
| 227 | return &LeveledCompactor{ |
| 228 | ranges: ranges, |
| 229 | chunkPool: pool, |
| 230 | logger: l, |
| 231 | metrics: opts.Metrics, |
| 232 | ctx: ctx, |
| 233 | maxBlockChunkSegmentSize: maxBlockChunkSegmentSize, |
| 234 | useUncachedIO: opts.UseUncachedIO, |
| 235 | mergeFunc: mergeFunc, |
| 236 | postingsEncoder: pe, |
| 237 | postingsDecoderFactory: opts.PD, |
| 238 | enableOverlappingCompaction: opts.EnableOverlappingCompaction, |
| 239 | blockExcludeFunc: opts.BlockExcludeFilter, |
| 240 | }, nil |
| 241 | } |
| 242 | |
| 243 | type dirMeta struct { |
| 244 | dir string |
searching dependent graphs…