sstable

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

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

Go to latest
Published: Mar 11, 2016 License: MIT Imports: 9 Imported by: 0

README

go-sstable

A Sorted String Table implementation for Go.

godoc Build Status Coverage Status

Status: work in progress

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ErrTooManyRecords = errors.New("go-sstable: too many records")
	ErrTooMuchData    = errors.New("go-sstable: too much data (max file size 4 GiB)")
	ErrKeyTooLong     = errors.New("go-sstable: key too long (max key length 255 bytes)")
	ErrValueTooLong   = errors.New("go-sstable: value too long (max value length 16 MiB)")
	ErrBadFormat      = errors.New("go-sstable: invalid file format")
	ErrKeyNotFound    = errors.New("go-sstable: key not found")
)

Functions

func Build

func Build(w io.Writer, data []Pair) error

func VerifyChecksum

func VerifyChecksum(expected uint32, data []byte) error
Example (Fail)
err := VerifyChecksum(0, []byte("abc"))
fmt.Printf("%#v\n", err)
fmt.Println(err)
Output:

sstable.ChecksumError{Expected:0x0, Actual:0x21f1576e}
go-sstable: invalid checksum: expected 0x00000000, got 0x21f1576e
Example (Pass)
err := VerifyChecksum(0x21f1576e, []byte("abc"))
fmt.Printf("%#v\n", err)
fmt.Println(err)
Output:

<nil>
<nil>

Types

type ChecksumError

type ChecksumError struct {
	Expected uint32
	Actual   uint32
}

func (ChecksumError) Error

func (err ChecksumError) Error() string

type Pair

type Pair struct {
	Key   string
	Value []byte
}

type ReadAtCloser

type ReadAtCloser interface {
	io.ReaderAt
	io.Closer
}

type SSTable

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

func New

func New(f ReadAtCloser) (*SSTable, error)

func (*SSTable) All

func (t *SSTable) All() <-chan Pair

func (*SSTable) AllKeys

func (t *SSTable) AllKeys() <-chan string

func (*SSTable) At

func (t *SSTable) At(idx int) (Pair, error)

func (*SSTable) Close

func (t *SSTable) Close() error

func (*SSTable) Find

func (t *SSTable) Find(key string) int

func (*SSTable) Get

func (t *SSTable) Get(key string) ([]byte, error)

func (*SSTable) In

func (t *SSTable) In(i, j int) <-chan Pair

func (*SSTable) InRange

func (t *SSTable) InRange(lo, hi string) <-chan Pair

func (*SSTable) Key

func (t *SSTable) Key(idx int) string

func (*SSTable) KeysIn

func (t *SSTable) KeysIn(i, j int) <-chan string

func (*SSTable) KeysInRange

func (t *SSTable) KeysInRange(lo, hi string) <-chan string

func (*SSTable) Len

func (t *SSTable) Len() int

func (*SSTable) Range

func (t *SSTable) Range(lo, hi string) (int, int)

func (*SSTable) Value

func (t *SSTable) Value(idx int) ([]byte, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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