state

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2018 License: GPL-3.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRangeStop = errors.New("range stop")
	ErrScanStop  = ErrRangeStop
)
View Source
var ErrNoUpdate = errors.New("no update")
View Source
var ErrNotFound = errors.New("not found")
View Source
var NoKey = Bucket{}.NewKey(nil)
View Source
var OffsetStart = []byte("")

Functions

func NoSyncOption

func NoSyncOption() storeOpt

Types

type Bucket

type Bucket struct {
	ID           BucketID
	RangeOptions RangeOptions
}

func NewBucket

func NewBucket(id BucketID, opts ...*RangeOptions) Bucket

func (Bucket) NewKey

func (b Bucket) NewKey(key []byte) *Key

func (Bucket) WithRangeOptions

func (b Bucket) WithRangeOptions(opt *RangeOptions) Bucket

type BucketID

type BucketID uint16
var (
	BucketRecords   BucketID = 0x10
	BucketBeatTicks BucketID = 0x11
	BucketBeatInfos BucketID = 0x12
)

func (BucketID) Bytes

func (b BucketID) Bytes() []byte

type IndexedStore

type IndexedStore interface {
	View(k *Key, fn PeekFunc) error
	Update(k *Key, fn ModifyFunc) error
	Delete(k *Key) error

	RangeKeys(b Bucket, fn KeyFunc) (*RangeOptions, error)
	RangePeek(b Bucket, fn PeekFunc) (*RangeOptions, error)
	RangeModify(b Bucket, fn ModifyFunc) (*RangeOptions, error)

	Close() error
}

IndexedStore is an interface to internal node state. The state includes file names, version history, in other words it's a collection of indexed metadata. The state must be synchronised across all utility Atlant nodes.

func NewIndexedStoreBadger

func NewIndexedStoreBadger(prefix string, opts ...storeOpt) (IndexedStore, error)

type Key

type Key struct {
	Bucket Bucket
	Key    [26]byte
	TTL    time.Duration
}

func NewKey

func NewKey(bucket BucketID, key []byte) *Key

func (*Key) Bytes

func (k *Key) Bytes() []byte

func (*Key) String

func (k *Key) String() string

func (*Key) Unmarshal

func (k *Key) Unmarshal(buf []byte) *Key

func (*Key) WithinBucket

func (k *Key) WithinBucket(b Bucket) *Key

type KeyFunc

type KeyFunc func(k *Key) error

type ModifyFunc

type ModifyFunc func(k *Key, v []byte) ([]byte, error)

type PeekFunc

type PeekFunc func(k *Key, v []byte) error

type RangeOptions

type RangeOptions struct {
	Prefetch int
	Offset   []byte
	Limit    int
}

Jump to

Keyboard shortcuts

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