manifest

package
v0.0.0-...-81f4bad Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: ISC Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Level

type Level struct {
	Tables  []*sstable.SSTable
	Path    string
	Number  int
	Size    int64
	MaxSize int64
}

func (*Level) Add

func (l *Level) Add(table *sstable.SSTable)

func (*Level) BinarySearch

func (l *Level) BinarySearch(key []byte) (int, bool)

Binary search the current level for table that has range overlapping key

func (*Level) Clear

func (l *Level) Clear()

Assigns an empty array to Tables and sets size to 0

func (*Level) Remove

func (l *Level) Remove(table *sstable.SSTable)

type Manifest

type Manifest struct {
	Levels []*Level // in-memory representation of levels

	Path             string // path to manifest
	SSTable_max_size int    // Max size to use when splitting tables
	BloomPath        string // Path to filters directory
	// contains filtered or unexported fields
}

func New

func New(opts *Opts) (*Manifest, error)

Create new manifest

func (*Manifest) AddTable

func (m *Manifest) AddTable(table *sstable.SSTable, level int) error

func (*Manifest) ClearLevel

func (m *Manifest) ClearLevel(level int) error

func (*Manifest) Close

func (m *Manifest) Close() error

func (*Manifest) Compact

func (man *Manifest) Compact()

func (*Manifest) RemoveTable

func (m *Manifest) RemoveTable(table *sstable.SSTable, level int) error

func (*Manifest) Replay

func (m *Manifest) Replay() error

func (*Manifest) Search

func (m *Manifest) Search(key []byte) ([]byte, error)

func (*Manifest) Trigger

func (m *Manifest) Trigger(level *Level) bool

Returns compaction task if level triggers a compaction

type ManifestEntry

type ManifestEntry struct {
	Op    ManifestOp
	Level int
	Table *pb.SSTable
}

func FromProto

func FromProto(p *pb.ManifestEntry) *ManifestEntry

func (*ManifestEntry) Apply

func (entry *ManifestEntry) Apply(c interface{}) error

func (*ManifestEntry) MarshalProto

func (entry *ManifestEntry) MarshalProto() proto.Message

type ManifestOp

type ManifestOp byte
const (
	ADDTABLE ManifestOp = iota
	REMOVETABLE
	CLEARTABLE
)

type Opts

type Opts struct {
	Path             string   // Path to manifest
	LevelPaths       []string // Path to each level directory
	Num_levels       int      // Number of compaction levels
	Level0_max_size  int64    // Max size of level 0 in bytes
	SSTable_max_size int
	BloomPath        string
}

Jump to

Keyboard shortcuts

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