sst

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: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Maximum block size. When it reaches this size it will be flushed to disk
	BLOCK_SIZE uint64 = 4096

	F_PREFIX = "data_block.bin"
)
View Source
const (
	F_PERMISSION = 0600
	F_FLAGS      = os.O_WRONLY | os.O_CREATE | os.O_TRUNC | os.O_APPEND
	F_READ       = os.O_RDONLY
)

Variables

View Source
var (
	ErrNotFoundInBloom = errors.New("key not found in bloom filter")
)

Functions

This section is empty.

Types

type BlockIterator

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

func NewBlockIterator

func NewBlockIterator(blk *block) *BlockIterator

func (*BlockIterator) Key

func (b *BlockIterator) Key() *common.InternalKey

func (*BlockIterator) Next

func (b *BlockIterator) Next() (*common.InternalKey, []byte, error)

func (*BlockIterator) SeekToFirst

func (b *BlockIterator) SeekToFirst() (*common.InternalKey, []byte, error)

func (*BlockIterator) Valid

func (b *BlockIterator) Valid() bool

func (*BlockIterator) Value

func (b *BlockIterator) Value() []byte

type Builder

type Builder interface {
	Add(*common.InternalKey, []byte) Builder
	Finish() (*SST, error)
	GetSize() uint64
}

func NewBuilder

func NewBuilder(logger *log.Logger, dir string, n uint64, id string) Builder

type Level

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

func NewLevel

func NewLevel(id int, dir string, mu *sync.Mutex, cache cache.Cacher[[]byte], logger *log.Logger) *Level

func (*Level) AddMemtable

func (l *Level) AddMemtable(mem *memtable.MemTable) (*SST, error)

func (*Level) Append

func (l *Level) Append(ssts []*SST)

func (*Level) Get

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

func (*Level) GetDir

func (l *Level) GetDir() string

func (*Level) GetId

func (l *Level) GetId() int

func (*Level) GetOldest

func (l *Level) GetOldest() *SST

func (*Level) GetTables

func (l *Level) GetTables() []*SST

func (*Level) LoadTables

func (l *Level) LoadTables(ssts []string) error

func (*Level) Remove

func (l *Level) Remove(ssts []*SST)

type SST

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

func Open

func Open(dir, sstId string, logger *log.Logger) (*SST, error)

func WriteMemTable

func WriteMemTable(logger *log.Logger, mem *memtable.MemTable, path string, cache cache.Cacher[[]byte], sstId string) (*SST, error)

func (*SST) Contains

func (s *SST) Contains(k []byte) bool

func (*SST) Get

func (s *SST) Get(k []byte) ([]byte, error)

func (*SST) GetFileSize

func (s *SST) GetFileSize() int64

func (*SST) GetId

func (s *SST) GetId() string

func (*SST) GetMax

func (s *SST) GetMax() []byte

func (*SST) GetMin

func (s *SST) GetMin() []byte

func (*SST) GetPath

func (s *SST) GetPath() string

func (*SST) GetTableMeta

func (s *SST) GetTableMeta() *tableMeta

type SSTableIter

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

func NewSSTableIter

func NewSSTableIter(sst *SST) (*SSTableIter, error)

func (*SSTableIter) Key

func (it *SSTableIter) Key() *common.InternalKey

func (*SSTableIter) Next

func (it *SSTableIter) Next() (*common.InternalKey, []byte, error)

func (*SSTableIter) SeekToFirst

func (it *SSTableIter) SeekToFirst() (*common.InternalKey, []byte, error)

func (*SSTableIter) Valid

func (it *SSTableIter) Valid() bool

func (*SSTableIter) Value

func (it *SSTableIter) Value() []byte

type SSTablesIter

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

func NewSSTablesIter

func NewSSTablesIter(ssts ...*SST) (*SSTablesIter, error)

NewSSTablesIter iterates over multiple sstables without overlapping keys

func (*SSTablesIter) Key

func (sit *SSTablesIter) Key() *common.InternalKey

func (*SSTablesIter) Next

func (sit *SSTablesIter) Next() (*common.InternalKey, []byte, error)

func (*SSTablesIter) SeekToFirst

func (sit *SSTablesIter) SeekToFirst() (*common.InternalKey, []byte, error)

func (*SSTablesIter) Valid

func (sit *SSTablesIter) Valid() bool

func (*SSTablesIter) Value

func (sit *SSTablesIter) Value() []byte

Jump to

Keyboard shortcuts

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