sstable

package module
v0.0.0-...-afb37f2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2022 License: BSD-3-Clause Imports: 11 Imported by: 0

README

A simple SSTable format and implementation in Go.

...or, "Why Yet Another SSTable???"

TODO: Documentation.

Documentation

Index

Constants

View Source
const (
	MaxKeyLength   = 256
	MaxValueLength = 1024 * 1024 * 1024 // 1GiB
)

Variables

View Source
var ErrNotFound = errors.New("Not found")

Functions

This section is empty.

Types

type Builder

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

func NewBuilder

func NewBuilder(w io.Writer, vf ValueWriter) *Builder

func (*Builder) Add

func (b *Builder) Add(key []byte, valueLength uint32, meta []byte)

func (*Builder) Build

func (b *Builder) Build() error

type Iter

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

func (*Iter) Key

func (i *Iter) Key() []byte

func (*Iter) Next

func (i *Iter) Next() bool

func (*Iter) Value

func (i *Iter) Value() []byte

func (*Iter) ValueSize

func (i *Iter) ValueSize() int64

type Table

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

func Load

func Load(r io.ReaderAt) (*Table, error)

func (*Table) Close

func (t *Table) Close() error

func (*Table) DataSize

func (t *Table) DataSize() uint64

func (*Table) Get

func (t *Table) Get(key []byte) (value []byte, extra []byte, e error)

func (*Table) GetInfo

func (t *Table) GetInfo(key []byte) (length uint, extra []byte, e error)

func (*Table) GetPartial deprecated

func (t *Table) GetPartial(key []byte, off uint, p []byte) error

Deprecated: Use GetReader instead.

func (*Table) GetReader

func (t *Table) GetReader(key []byte) (*ValueReader, error)

func (*Table) Has

func (t *Table) Has(key []byte) bool

func (*Table) KeyIter deprecated

func (t *Table) KeyIter() *Iter

Deprecated: Less bad interface TBD

func (*Table) Keys

func (t *Table) Keys() (keys [][]byte)

func (*Table) LowerKey

func (t *Table) LowerKey(key []byte) (k []byte, e []byte, n uint)

Gets the key (and extra and value length) in the table that is less than or equal to the given key. Will return nil if no such key exists.

func (*Table) NumKeys

func (t *Table) NumKeys() int

func (*Table) Stats

func (t *Table) Stats() TableStats

func (*Table) UpperKey

func (t *Table) UpperKey(key []byte) (k []byte, e []byte, n uint)

type TableStats

type TableStats struct {
	// Number of keys in the table
	NumKeys int

	// Total size of keys (bytes)
	KeysSize int

	// Total size of values (bytes)
	ValuesSize int64

	// Size of header (bytes)
	HeaderSize int

	// Size of index (bytes)
	IndexSize int
}

type ValueReader

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

func (*ValueReader) Extra

func (r *ValueReader) Extra() []byte

func (*ValueReader) ReadAt

func (r *ValueReader) ReadAt(p []byte, off int64) (int, error)

func (*ValueReader) Size

func (r *ValueReader) Size() int64

Returns int64 to match various other Size() methods (i.e. FileInfo.Size())

type ValueWriter

type ValueWriter func(key []byte, w io.Writer) (int, error)

Directories

Path Synopsis
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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