Documentation ¶
Index ¶
- Constants
- func RegisterLogType(logType int32, fn NewLogFunc)
- func Table(fileNumber int64) string
- type DeleteFile
- type EditLog
- type FamilyVersion
- type FileDesc
- type FileMeta
- type FileType
- type Log
- type NewFile
- type NewLogFunc
- type NextFileNumber
- type StoreLog
- type StoreVersionSet
- func (vs *StoreVersionSet) CommitFamilyEditLog(family string, editLog *EditLog) error
- func (vs *StoreVersionSet) CreateFamilyVersion(family string, familyID int) *FamilyVersion
- func (vs *StoreVersionSet) Destroy() error
- func (vs *StoreVersionSet) GetFamilyVersion(family string) *FamilyVersion
- func (vs *StoreVersionSet) NextFileNumber() int64
- func (vs *StoreVersionSet) Recover() error
- type Version
Constants ¶
const Lock = "LOCK"
const Options = "OPTIONS"
const StoreFamilyID = 0
StoreFamilyID is store level edit log, actually store family is not actual family just store store level edit log for metadata.
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.
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
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 FileMeta ¶
type FileMeta struct {
// contains filtered or unexported fields
}
FileMeta is the metadata for sst file
func NewFileMeta ¶
NewFileMeta new FileMeta instance
func (*FileMeta) GetFileNumber ¶
GetFileNumber gets file number for sst file
func (*FileMeta) GetFileSize ¶
GetFileSize gets file size for sst file
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 ¶
CreateNewFile new NewFile instance for add new file
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.