version

package
v0.0.0-...-034a78d Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const Lock = "LOCK"
View Source
const Options = "OPTIONS"
View Source
const StoreFamilyID = 0

StoreFamilyID is store level edit log, actually store family is not actual family just store store level edit log for metadata.

View Source
const TmpSuffix = "tmp"

Variables

This section is empty.

Functions

func RegisterLogType

func RegisterLogType(logType int32, fn NewLogFunc)

RegisterLogType register edit log type when system init, if has duplicate log type, system need panic and exit.

func Table

func Table(fileNumber int64) string

Table file name

Types

type DeleteFile

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

DeleteFile remove file from metadata

func NewDeleteFile

func NewDeleteFile(level int32, fileNumber int64) *DeleteFile

NewDeleteFile create DeleteFile instance

func (*DeleteFile) Decode

func (d *DeleteFile) Decode(v []byte) error

Decode reads delete file data from binary

func (*DeleteFile) Encode

func (d *DeleteFile) Encode() ([]byte, error)

Encode writes delete file data into binary

type EditLog

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

EditLog contains all metadata edit log

func NewEditLog

func NewEditLog(familyID int) *EditLog

NewEditLog new EditLog instance

func (*EditLog) Add

func (el *EditLog) Add(log Log)

Add adds edit log into log list

func (*EditLog) IsEmpty

func (el *EditLog) IsEmpty() bool

IsEmpty returns edit logs is empty or not.

type FamilyVersion

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

FamilyVersion maintains family level metadata

func (*FamilyVersion) FindFiles

func (fv *FamilyVersion) FindFiles(key uint32) (*Version, []*FileMeta)

FindFiles finds all files include key from current's level, must return files related version, and retain it, release version after read data.

func (*FamilyVersion) GetAllFiles

func (fv *FamilyVersion) GetAllFiles() []*FileMeta

GetAllFiles returns all files based on all active versions

func (*FamilyVersion) GetCurrent

func (fv *FamilyVersion) GetCurrent() *Version

GetCurrent returns current mutable version

type FileDesc

type FileDesc struct {
	FileType   string
	FileNumber int64
}

FileDesc define file type and file number

type FileMeta

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

FileMeta is the metadata for sst file

func NewFileMeta

func NewFileMeta(fileNumber int64, minKey uint32, maxKey uint32, fileSize int32) *FileMeta

NewFileMeta new FileMeta instance

func (*FileMeta) GetFileNumber

func (f *FileMeta) GetFileNumber() int64

GetFileNumber gets file number for sst file

func (*FileMeta) GetFileSize

func (f *FileMeta) GetFileSize() int32

GetFileSize gets file size for sst file

func (*FileMeta) GetMaxKey

func (f *FileMeta) GetMaxKey() uint32

GetMaxKey gets max key in sst file

func (*FileMeta) GetMinKey

func (f *FileMeta) GetMinKey() uint32

GetMinKey gets min key in sst file

type FileType

type FileType int

FileType represent a file type.

const (
	TypeManifest FileType = iota
	TypeJournal
	TypeTable
	TypeTemp
	TypeInfo
)

File types.

type Log

type Log interface {
	// Encode write log from binary, if error return err
	Encode() ([]byte, error)
	// Decode reads log from binary, if error return err
	Decode(v []byte) error
	// contains filtered or unexported methods
}

Log metadata edit log for family level

type NewFile

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

NewFile add new file into metadata

func CreateNewFile

func CreateNewFile(level int32, file *FileMeta) *NewFile

CreateNewFile new NewFile instance for add new file

func (*NewFile) Decode

func (n *NewFile) Decode(v []byte) error

Decode reads new file from binary, if error return err

func (*NewFile) Encode

func (n *NewFile) Encode() ([]byte, error)

Encode writes new file data to binary, if error return err

type NewLogFunc

type NewLogFunc func() Log

NewLogFunc create specific edit log instance

type NextFileNumber

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

NextFileNumber set next file number for metadata

func NewNextFileNumber

func NewNextFileNumber(fileNumber int64) *NextFileNumber

NewNextFileNumber creates NextFileNumber instance

func (*NextFileNumber) Decode

func (n *NextFileNumber) Decode(v []byte) error

Decode reads next file number data from binary

func (*NextFileNumber) Encode

func (n *NextFileNumber) Encode() ([]byte, error)

Encode writes next file number data into binary

type StoreLog

type StoreLog interface {
	Log
	// contains filtered or unexported methods
}

StoreLog metadata dit log store level

type StoreVersionSet

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

StoreVersionSet maintains all metadata for kv store

func NewStoreVersionSet

func NewStoreVersionSet(storePath string, numOfLevels int) *StoreVersionSet

NewStoreVersionSet new VersionSet instance

func (*StoreVersionSet) CommitFamilyEditLog

func (vs *StoreVersionSet) CommitFamilyEditLog(family string, editLog *EditLog) error

CommitFamilyEditLog persists edit logs to manifest file, then apply new version to family version

func (*StoreVersionSet) CreateFamilyVersion

func (vs *StoreVersionSet) CreateFamilyVersion(family string, familyID int) *FamilyVersion

CreateFamilyVersion creates family version using family name, if family version exist, return exist one

func (*StoreVersionSet) Destroy

func (vs *StoreVersionSet) Destroy() error

Destroy closes version set, release resource, such as journal writer etc.

func (*StoreVersionSet) GetFamilyVersion

func (vs *StoreVersionSet) GetFamilyVersion(family string) *FamilyVersion

GetFamilyVersion returns family version if exist, else return nil

func (*StoreVersionSet) NextFileNumber

func (vs *StoreVersionSet) NextFileNumber() int64

NextFileNumber generates next file number

func (*StoreVersionSet) Recover

func (vs *StoreVersionSet) Recover() error

Recover recover version set if exist, recover been invoked when kv store init. Initialize if version file not exists, else recover old data then init journal writer.

type Version

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

Version is snapshot for current storage metadata includes levels/sst files

func (*Version) Release

func (v *Version) Release()

Release decrements version ref count, if ref==0, then remove current version from list of family level.

Jump to

Keyboard shortcuts

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