manifest

package
v0.0.0-...-3976360 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCorruptEditTag            = errors.New("corrupt version edit: tag")
	ErrCorruptEditLogNumber      = errors.New("corrupt version edit: log number")
	ErrCorruptEditPrevLogNumber  = errors.New("corrupt version edit: prev log number")
	ErrCorruptEditNextFileNumber = errors.New("corrupt version edit: next file number")
	ErrCorruptEditLastSequence   = errors.New("corrupt version edit: last sequence")
	ErrCorruptEditCompactPointer = errors.New("corrupt version edit: compact pointer")
	ErrCorruptEditDeletedFile    = errors.New("corrupt version edit: deleted file")
	ErrCorruptEditNewFile        = errors.New("corrupt version edit: new file")
	ErrCorruptEditComparatorName = errors.New("corrupt version edit: comparator name")
)

Functions

This section is empty.

Types

type Compaction

type Compaction struct {
	Registration       *compaction.Registration
	Level              int
	Base               *Version
	Inputs             [2]FileList
	Grandparents       FileList
	MaxOutputFileSize  int64
	NextCompactPointer keys.InternalKey
}

func (*Compaction) IsTrivialMove

func (c *Compaction) IsTrivialMove() bool

func (*Compaction) NewIterator

func (c *Compaction) NewIterator() iterator.Iterator

type Edit

type Edit struct {
	ComparatorName  string
	LogNumber       uint64
	NextFileNumber  uint64
	LastSequence    keys.Sequence
	CompactPointers []LevelCompactPointer
	AddedFiles      []LevelFileMeta
	DeletedFiles    []LevelFileNumber
	// contains filtered or unexported fields
}

Edit records a sequence changes made to a version. New version can be constructed from old version and an Edit which records changes made to that version.

func (*Edit) Decode

func (edit *Edit) Decode(buf []byte) (err error)

Decode decodes an Edit from buf.

func (*Edit) Encode

func (edit *Edit) Encode(buf []byte) []byte

Encode appends binary encoded Edit to buf.

func (*Edit) Reset

func (edit *Edit) Reset()

Reset clears all set fields.

func (*Edit) String

func (edit *Edit) String() string

type FileList

type FileList []*FileMeta

FileList represents a list of table files.

func (*FileList) DeleteFile

func (files *FileList) DeleteFile(number uint64) bool

DeleteFile deletes file `number` from files. Returns true if file exists in files, otherwise false. The order of files is undefined if it returns true.

func (FileList) Dup

func (files FileList) Dup() FileList

Dup returns a FileList with same files as this one.

func (FileList) IndexFile

func (files FileList) IndexFile(number uint64) int

IndexFile returns zero-based index for file `number`, -1 if not found.

func (FileList) SortByNewestFileNumber

func (files FileList) SortByNewestFileNumber()

SortByNewestFileNumber sorts files by decreasing file number.

func (FileList) SortBySmallestKey

func (files FileList) SortBySmallestKey(cmp keys.Comparer)

SortBySmallestKey sorts files by increasing smallest key.

func (FileList) TotalFileSize

func (files FileList) TotalFileSize() (size uint64)

TotalFileSize returns total file size from those files.

type FileMeta

type FileMeta struct {
	Number   uint64
	Size     uint64
	Smallest keys.InternalKey
	Largest  keys.InternalKey
	// contains filtered or unexported fields
}

FileMeta contains meta info for a sorted table.

func (*FileMeta) GoString

func (f *FileMeta) GoString() string

GoString implements fmt.GoStringer.

type LevelCompactPointer

type LevelCompactPointer struct {
	Level   int
	Largest keys.InternalKey
}

type LevelFileMeta

type LevelFileMeta struct {
	Level int
	*FileMeta
}

LevelFileMeta includes a file's meta data and its corresponding level.

type LevelFileNumber

type LevelFileNumber struct {
	Level  int
	Number uint64
}

type Manifest

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

func Create

func Create(dbname string, opts *options.Options) (manifest *Manifest, err error)

func Recover

func Recover(dbname string, opts *options.Options) (*Manifest, error)

func (*Manifest) AddLiveFiles

func (m *Manifest) AddLiveFiles(files map[uint64]struct{}) map[uint64]struct{}

func (*Manifest) Append

func (m *Manifest) Append(tip *Version)

func (*Manifest) Apply

func (m *Manifest) Apply(edit *Edit) error

func (*Manifest) Close

func (m *Manifest) Close() error

func (*Manifest) LastSequence

func (m *Manifest) LastSequence() keys.Sequence

func (*Manifest) LoadLastSequence

func (m *Manifest) LoadLastSequence() keys.Sequence

func (*Manifest) Log

func (m *Manifest) Log(tip *Version, edit *Edit) (*Version, error)

Log writes edit to manifest file.

func (*Manifest) LogFileNumber

func (m *Manifest) LogFileNumber() uint64

func (*Manifest) ManifestFileNumber

func (m *Manifest) ManifestFileNumber() uint64

ManifestFileNumber returns current manifest number, possibly expired due to switching to new manifest file.

func (*Manifest) MarkFileNumberUsed

func (m *Manifest) MarkFileNumberUsed(number uint64)

func (*Manifest) NewFileNumber

func (m *Manifest) NewFileNumber() (uint64, uint64)

NewFileNumber returns a new file number and a next file number.

func (*Manifest) NextFileNumber

func (m *Manifest) NextFileNumber() uint64

func (*Manifest) ReuseFileNumber

func (m *Manifest) ReuseFileNumber(number uint64)

func (*Manifest) StoreLastSequence

func (m *Manifest) StoreLastSequence(seq keys.Sequence)

func (*Manifest) Version

func (m *Manifest) Version() *Version

type Version

type Version struct {

	// Levels[0], sorted from newest to oldest;
	// Levels[n], sorted from smallest to largest.
	Levels [configs.NumberLevels]FileList

	CompactionPointers [configs.NumberLevels]keys.InternalKey
	// contains filtered or unexported fields
}

func (*Version) AppendIterators

func (v *Version) AppendIterators(iters []iterator.Iterator, opts *options.ReadOptions) []iterator.Iterator

func (*Version) Get

func (v *Version) Get(ikey keys.InternalKey, opts *options.ReadOptions) ([]byte, LevelFileMeta, error)

func (*Version) NextOverlapingLevel

func (v *Version) NextOverlapingLevel(level int, start, limit []byte) int

NextOverlappingLevel returns first overlapping level in range [level, maxLevel] with start and limit.

func (*Version) OverlapLevel

func (v *Version) OverlapLevel(level int, start, limit []byte) bool

func (*Version) PickCompactions

func (v *Version) PickCompactions(registry *compaction.Registry, pendingFiles []FileList, nextFileNumber uint64) []*Compaction

func (*Version) PickLevelForMemTableOutput

func (v *Version) PickLevelForMemTableOutput(smallest, largest []byte) int

func (*Version) PickRangeCompaction

func (v *Version) PickRangeCompaction(registry *compaction.Registry, level int, start, limit []byte) *Compaction

func (*Version) Release

func (v *Version) Release()

func (*Version) Retain

func (v *Version) Retain() *Version

func (*Version) SeekOverlap

func (v *Version) SeekOverlap(ikey keys.InternalKey, opts *options.ReadOptions) LevelFileMeta

func (*Version) SortFiles

func (v *Version) SortFiles() error

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

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