store

package
v0.0.71 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound is an error indicating a given key does not exist
	ErrKeyNotFound = errors.New("not found")
	// ErrStreamNotFound is an error indicating a given stream does not exist
	ErrStreamNotFound = errors.New("stream not found")
	// ErrShardNotFound is an error indicating a given shard does not exist
	ErrShardNotFound = errors.New("shard not found")
	// ErrIndexOutdated is an error indicating that the supplied index is outdated
	ErrIndexOutdated = errors.New("index outdated")
)

Functions

This section is empty.

Types

type BatchInput

type BatchInput struct {
	ID     string
	Offset uint64
	Data   [][]byte
}

type BatchOutput

type BatchOutput struct {
	ID     string
	Offset uint64
	Count  int
	Err    error
}

type BoltStore

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

func New

func New(options Options) (*BoltStore, error)

func (*BoltStore) Close

func (b *BoltStore) Close() error

Close is used to gracefully close the DB connection.

func (*BoltStore) CreateStream

func (b *BoltStore) CreateStream(config *pb.StreamConfig) error

func (*BoltStore) DeleteStream

func (b *BoltStore) DeleteStream(id string) error

func (*BoltStore) Exists

func (b *BoltStore) Exists(id string) bool

func (*BoltStore) GetRange

func (b *BoltStore) GetRange(id string, shardID string, from uint64, buff []*pb.StoredMessage) (int, uint64, error)

func (*BoltStore) GetStream

func (b *BoltStore) GetStream(id string) *pb.StreamConfig

func (*BoltStore) GetStreamStatistics

func (b *BoltStore) GetStreamStatistics(id string) (*pb.StreamStatistics, error)

func (*BoltStore) ListStreams

func (b *BoltStore) ListStreams() []*pb.StreamConfig

func (*BoltStore) Put

func (b *BoltStore) Put(stream string, shardID string, index uint64, payload []byte) error

func (*BoltStore) Restore

func (b *BoltStore) Restore(r io.Reader) error

func (*BoltStore) WriteTo

func (b *BoltStore) WriteTo(out io.Writer) error

type Options

type Options struct {
	// Path is the file path to the BoltDB to use
	Path string

	// BoltOptions contains any specific BoltDB options you might
	// want to specify [e.g. open timeout]
	BoltOptions *bolt.Options

	// NoSync causes the database to skip fsync calls after each
	// write to the log. This is unsafe, so it should be used
	// with caution.
	NoSync bool
}

type Store

type Store interface {
	DeleteQueue(id string) error
	CreateQueue(id string) error
	Put(id string, index uint64, payload []byte) error
	GetRange(id string, from uint64, buff [][]byte) (uint64, int, error)
	All() []string
}

Jump to

Keyboard shortcuts

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