store

package
v0.0.0-...-c57eb44 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBucket = []byte("default")

DefaultBucket is used as a default bucket for bolt

Functions

This section is empty.

Types

type BoltStore

type BoltStore struct {
	Db *bolt.DB
}

BoltStore wraps all the bbol storage logic

func NewBoltStore

func NewBoltStore(path string) (*BoltStore, error)

NewBoltStore inits a BoltStore struct

func (*BoltStore) Delete

func (bs *BoltStore) Delete(key []byte) error

Delete a value using it's key

func (*BoltStore) DeleteWithClause

func (bs *BoltStore) DeleteWithClause(fn func(k, v []byte) bool) error

func (*BoltStore) ForEach

func (bs *BoltStore) ForEach(fn func(k, v []byte) error) error

func (*BoltStore) Get

func (bs *BoltStore) Get(key []byte) ([]byte, error)

Get a value using it's key

func (*BoltStore) Length

func (bs *BoltStore) Length() int

func (*BoltStore) Put

func (bs *BoltStore) Put(key []byte, value []byte) error

Put value associtated to key in the datastore

func (*BoltStore) Sync

func (bs *BoltStore) Sync() error

type MemoryStore

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

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Delete

func (m *MemoryStore) Delete(key []byte) error

func (*MemoryStore) DeleteWithClause

func (m *MemoryStore) DeleteWithClause(fn func(k, v []byte) bool) error

func (*MemoryStore) ForEach

func (m *MemoryStore) ForEach(fn func(k, v []byte) error) error

func (*MemoryStore) Get

func (m *MemoryStore) Get(key []byte) ([]byte, error)

func (*MemoryStore) Length

func (m *MemoryStore) Length() int

func (*MemoryStore) Put

func (m *MemoryStore) Put(key []byte, value []byte) error

func (*MemoryStore) Sync

func (m *MemoryStore) Sync() error

type Store

type Store interface {
	Get([]byte) ([]byte, error)
	Put([]byte, []byte) error
	Delete([]byte) error
	Length() int
	Sync() error
	ForEach(func(k, v []byte) error) error
	DeleteWithClause(fn func(k, v []byte) bool) error
}

Store kv stuff

Jump to

Keyboard shortcuts

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