manifest

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompactionInfo

type CompactionInfo struct {
	ID        uint64   `json:"id"`
	Level     int      `json:"level"`
	Inputs    []uint64 `json:"inputs"`
	Outputs   []uint64 `json:"outputs"`
	StartTime int64    `json:"startTime"`
	EndTime   int64    `json:"endTime"`
	Reason    string   `json:"reason"`
}

CompactionInfo describes a compaction operation.

type Manifest

type Manifest struct {
	// contains filtered or unexported fields
}

Manifest manages the list of segments and provides atomic updates.

func New

func New(dir string, logger common.Logger) (*Manifest, error)

New creates a new manifest.

func OpenReadOnly added in v1.1.1

func OpenReadOnly(dir string, logger common.Logger) (*Manifest, error)

OpenReadOnly opens an existing manifest without creating any files or directories. It returns an error if the manifest directory or files are missing, and never writes.

func (*Manifest) AddSegment

func (m *Manifest) AddSegment(info SegmentInfo) error

AddSegment adds a new segment to the manifest.

func (*Manifest) AddSegments added in v1.1.5

func (m *Manifest) AddSegments(infos []SegmentInfo) error

AddSegments adds multiple segments to the manifest atomically. Either all segments are added successfully or none are added.

func (*Manifest) GetActiveSegments

func (m *Manifest) GetActiveSegments() []SegmentInfo

GetActiveSegments returns the list of active (non-deleted) segments.

func (*Manifest) GetCurrentVersion

func (m *Manifest) GetCurrentVersion() uint64

GetCurrentVersion returns the current manifest version.

func (*Manifest) GetSegmentsByLevel

func (m *Manifest) GetSegmentsByLevel(level int) []SegmentInfo

GetSegmentsByLevel returns segments at a specific level.

func (*Manifest) GetStats

func (m *Manifest) GetStats() ManifestStats

GetStats returns manifest statistics.

func (*Manifest) RecordCompaction

func (m *Manifest) RecordCompaction(info CompactionInfo) error

RecordCompaction records a compaction operation.

func (*Manifest) RemoveSegments

func (m *Manifest) RemoveSegments(segmentIDs []uint64) error

RemoveSegments marks segments for deletion.

type ManifestStats

type ManifestStats struct {
	Version        uint64
	TotalSegments  int
	ActiveSegments int
	TotalSize      int64
	TotalKeys      uint64
	LevelCounts    map[int]int
}

ManifestStats contains manifest statistics.

type SegmentInfo

type SegmentInfo struct {
	ID        uint64 `json:"id"`
	Level     int    `json:"level"`
	MinKeyHex string `json:"minKeyHex,omitempty"`
	MaxKeyHex string `json:"maxKeyHex,omitempty"`
	Size      int64  `json:"size"`
	NumKeys   uint64 `json:"numKeys"`
	Created   int64  `json:"created"`
	Deleted   int64  `json:"deleted,omitempty"` // Timestamp when marked for deletion
}

SegmentInfo describes a segment in the manifest.

type Version

type Version struct {
	VersionID   uint64           `json:"versionID"`
	CreatedAt   int64            `json:"createdAt"`
	Segments    []SegmentInfo    `json:"segments"`
	Compactions []CompactionInfo `json:"compactions,omitempty"`
}

Version represents a manifest version.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL