common

package
v0.0.0-...-e9c076f Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_MEMTABLE_THRESHOLD = 1 * (1 << 20)

	MAX_SINK_SIZE = 8

	SST_DIR  = "sst"
	WAL      = "wal"
	MANIFEST = "MANIFEST"
)
View Source
const MetaLen = 8

Variables

View Source
var (
	EndOfIterator        = errors.New("out of records")
	ErrKeyNotFound       = errors.New("key not found")
	ErrPathFile          = errors.New("provied path points to a file instead of directory")
	ErrKeyAlreadyExists  = errors.New("key already exists")
	ErrIteratorExhausted = errors.New("iterator exhausted")
)
View Source
var TOMBSTONE []byte

Functions

func Concat

func Concat(xs ...string) string

func CreateFile

func CreateFile(path string) (*os.File, error)

func EnsureDir

func EnsureDir(path string) error

func ListDir

func ListDir[T any](path string, mut func(string) (T, bool)) ([]T, error)

func Max

func Max(a, b []byte) []byte

func Min

func Min(a, b []byte) []byte

Types

type DbOp

type DbOp = uint8
const (
	SET DbOp = iota
	DELETE
)

type InnerStorage

type InnerStorage interface {
	Set(uKey *InternalKey, value []byte) error
	Get(key []byte) ([]byte, bool)
	GetSize() uint64
	NewIter() InnerStorageIterator
}

type InnerStorageIterator

type InnerStorageIterator interface {
	Valid() bool
	Next() (*InternalKey, []byte)
}

type InternalKey

type InternalKey struct {
	UserKey []byte
	Meta    KeyMeta
}

func DeserializeKey

func DeserializeKey(key []byte) *InternalKey

func NewInternalKey

func NewInternalKey(ukey []byte, seqNum uint64, kind DbOp) *InternalKey

func SearchInternalKey

func SearchInternalKey(key []byte) *InternalKey

func (*InternalKey) Compare

func (ik *InternalKey) Compare(other *InternalKey) int

func (*InternalKey) Equal

func (ik *InternalKey) Equal(other *InternalKey) bool

func (*InternalKey) GetMeta

func (ik *InternalKey) GetMeta() KeyMeta

func (*InternalKey) GetSize

func (ik *InternalKey) GetSize() int

func (*InternalKey) Kind

func (ik *InternalKey) Kind() uint8

func (*InternalKey) SeqNum

func (ik *InternalKey) SeqNum() uint64

func (*InternalKey) Serialize

func (ik *InternalKey) Serialize() []byte

func (*InternalKey) SoftCompare

func (ik *InternalKey) SoftCompare(other *InternalKey) int

func (*InternalKey) SoftEqual

func (ik *InternalKey) SoftEqual(other *InternalKey) bool

func (*InternalKey) String

func (ik *InternalKey) String() string

type Iterator

type Iterator interface {
	Next() (*InternalKey, []byte, error)
	Key() *InternalKey
	Valid() bool
	Value() []byte
	SeekToFirst() (*InternalKey, []byte, error)
}

type KeyMeta

type KeyMeta uint64

func (KeyMeta) Kind

func (km KeyMeta) Kind() DbOp

func (KeyMeta) SeqNum

func (km KeyMeta) SeqNum() uint64

Jump to

Keyboard shortcuts

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