Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepareEntryForCompaction ¶
PrepareEntryForCompaction prepares the key and value to store in compaction index.
Types ¶
type Compactor ¶
type Compactor struct {
// contains filtered or unexported fields
}
func NewCompactorWithConfig ¶
func NewCompactorWithConfig(cfg *CompactorConfig) *Compactor
NewCompactorWithConfig creates a new compactor with configuration
func (*Compactor) Close ¶
func (c *Compactor) Close()
Close stops the background compaction loop and waits for it to exit.
func (*Compactor) CompactFiles ¶
CompactFiles scans the RocksDB file-index and migrates files into segments. The context parameter allows for cancellation of the compaction process. The workerID is used to partition work across multiple workers. Compaction continues until the current segment is full or there are no more entries. Returns the number of files processed.
type CompactorConfig ¶
type CompactorConfig struct {
MetaDB *metadata.MetaDB
FileManager *files.FileManager
SegmentManager *segment.Manager
DeletionQueue *deletion.Queue
CompactionThreads int // Number of compaction threads
// Recompaction settings (optional)
EnableRecompaction bool
FragThreshold float64
MinSegmentAge time.Duration
MinSegments int
RecompactionInterval time.Duration
}
CompactorConfig contains configuration for the compactor
type ErrFileSizeMismatch ¶
ErrFileSizeMismatch is returned when a file's actual size doesn't match its metadata
func (*ErrFileSizeMismatch) Error ¶
func (e *ErrFileSizeMismatch) Error() string
type SegmentRecompactor ¶
type SegmentRecompactor struct {
// contains filtered or unexported fields
}
SegmentRecompactor handles recompaction of fragmented segments
func NewSegmentRecompactor ¶
func NewSegmentRecompactor(meta *metadata.MetaDB, sm *segment.Manager, deletionQueue *deletion.Queue, fragThreshold float64, minSegmentAge time.Duration, minSegments int) *SegmentRecompactor
NewSegmentRecompactor creates a new segment recompactor
func (*SegmentRecompactor) RecompactFragmentedSegments ¶
func (sr *SegmentRecompactor) RecompactFragmentedSegments(ctx context.Context) error
RecompactFragmentedSegments identifies and recompacts fragmented segments