storage

package
v0.0.0-...-4f6d325 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigEndian

func BigEndian(v uint64) []byte

Types

type DB

type DB struct {
	*bolt.DB
	// contains filtered or unexported fields
}

func (*DB) BucketFor

func (db *DB) BucketFor(m Model, tx *bolt.Tx) (*bolt.Bucket, error)

func (*DB) Create

func (db *DB) Create(m Model) (err error)

func (*DB) CreateLocked

func (db *DB) CreateLocked(m Model) error

func (*DB) Delete

func (db *DB) Delete(m Model) (err error)

func (*DB) DeleteLocked

func (db *DB) DeleteLocked(m Model) error

func (*DB) Exists

func (db *DB) Exists(m Model) (t bool, err error)

func (*DB) ExistsLocked

func (db *DB) ExistsLocked(m Model) (bool, error)

func (*DB) Get

func (db *DB) Get(m Model) (b []byte, err error)

func (*DB) GetAll

func (db *DB) GetAll(m Model) (data [][]byte, err error)

func (*DB) GetLocked

func (db *DB) GetLocked(m Model) ([]byte, error)

func (*DB) Init

func (db *DB) Init(opts *bolt.Options, path string, types ...Model) (err error)

func (*DB) Lock

func (db *DB) Lock() *sync.Mutex

func (*DB) NextID

func (db *DB) NextID(bucket *bolt.Bucket) (b []byte, err error)

func (*DB) Stats

func (db *DB) Stats(m Model) (bs bolt.BucketStats, err error)

type Database

type Database interface {
	Create(Model) error
	CreateLocked(Model) error
	Delete(Model) error
	DeleteLocked(Model) error
	Get(Model) ([]byte, error)
	GetLocked(Model) ([]byte, error)
	Exists(Model) (bool, error)
	ExistsLocked(Model) (bool, error)
	Stats(Model) (bolt.BucketStats, error)
	GetAll(Model) ([][]byte, error)
	Lock() *sync.Mutex
}

type ErrorBucketDoesNotExists

type ErrorBucketDoesNotExists string

func (ErrorBucketDoesNotExists) Error

func (e ErrorBucketDoesNotExists) Error() string

type ErrorEmptyKey

type ErrorEmptyKey string

func (ErrorEmptyKey) Error

func (e ErrorEmptyKey) Error() string

type Model

type Model interface {
	Key() []byte
}

Jump to

Keyboard shortcuts

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