bolt

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryCodec

type BinaryCodec struct{}

func (BinaryCodec) Marshal

func (BinaryCodec) Marshal(val interface{}) ([]byte, error)

func (BinaryCodec) Unmarshal

func (BinaryCodec) Unmarshal(data []byte, val interface{}) error

type BoltStorage

type BoltStorage struct {
	DB *DB
}

func NewBoltStorage

func NewBoltStorage(path string) (*BoltStorage, error)

func (*BoltStorage) Close

func (b *BoltStorage) Close() error

func (*BoltStorage) GetBlockInfo

func (b *BoltStorage) GetBlockInfo(ctx context.Context, blockID model.Base58) (info *model.BlockInfo, err error)

func (*BoltStorage) UpdateBlockInfo

func (b *BoltStorage) UpdateBlockInfo(ctx context.Context, info *model.BlockInfo) error

type Bucket

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

func (*Bucket) Bucket

func (b *Bucket) Bucket(name []byte) *Bucket

func (*Bucket) CreateBucket

func (b *Bucket) CreateBucket(key []byte) (*Bucket, error)

func (*Bucket) CreateBucketIfNotExists

func (b *Bucket) CreateBucketIfNotExists(key []byte) (*Bucket, error)

func (*Bucket) Cursor

func (b *Bucket) Cursor() *Cursor

func (*Bucket) Delete

func (b *Bucket) Delete(key interface{}) error

func (*Bucket) DeleteBucket

func (b *Bucket) DeleteBucket(key []byte) error

func (*Bucket) ForEach

func (b *Bucket) ForEach(fn interface{}) error

func (*Bucket) Get

func (b *Bucket) Get(key, value interface{}) (bool, error)

func (*Bucket) NextSequence

func (b *Bucket) NextSequence() (uint64, error)

func (*Bucket) Put

func (b *Bucket) Put(key, value interface{}) error

func (*Bucket) Sequence

func (b *Bucket) Sequence() uint64

func (*Bucket) SetSequence

func (b *Bucket) SetSequence(v uint64) error

func (*Bucket) Stats

func (b *Bucket) Stats() bolt.BucketStats

func (*Bucket) Tx

func (b *Bucket) Tx() *Tx

func (*Bucket) Writable

func (b *Bucket) Writable() bool

type Codec

type Codec interface {
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(data []byte, v interface{}) error
}

type Codecs

type Codecs struct {
	Key   Codec
	Value Codec
}

type Cursor

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

func (*Cursor) Bucket

func (c *Cursor) Bucket() *Bucket

func (*Cursor) Delete

func (c *Cursor) Delete() error

func (*Cursor) First

func (c *Cursor) First(key, value interface{}) (bool, error)

func (*Cursor) Last

func (c *Cursor) Last(key, value interface{}) (bool, error)

func (*Cursor) Next

func (c *Cursor) Next(key, value interface{}) (bool, error)

func (*Cursor) Prev

func (c *Cursor) Prev(key, value interface{}) (bool, error)

func (*Cursor) Seek

func (c *Cursor) Seek(seek, key, value interface{}) (bool, error)

type DB

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

func Open

func Open(path string, mode os.FileMode, options *bolt.Options, codecs *Codecs) (*DB, error)

func (*DB) Batch

func (db *DB) Batch(fn func(*Tx) error) error

func (*DB) Begin

func (db *DB) Begin(writable bool) (*Tx, error)

func (*DB) Update

func (db *DB) Update(fn func(*Tx) error) error

func (*DB) View

func (db *DB) View(fn func(*Tx) error) error

type GobCodec

type GobCodec struct{}

func (GobCodec) Marshal

func (GobCodec) Marshal(val interface{}) ([]byte, error)

func (GobCodec) Unmarshal

func (GobCodec) Unmarshal(data []byte, val interface{}) error

type Tx

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

func (*Tx) Bucket

func (tx *Tx) Bucket(name []byte) *Bucket

func (*Tx) CreateBucket

func (tx *Tx) CreateBucket(name []byte) (*Bucket, error)

func (*Tx) CreateBucketIfNotExists

func (tx *Tx) CreateBucketIfNotExists(name []byte) (*Bucket, error)

func (*Tx) Cursor

func (tx *Tx) Cursor() *Cursor

func (*Tx) DB

func (tx *Tx) DB() *DB

func (*Tx) ForEach

func (tx *Tx) ForEach(fn func(name []byte, b *Bucket) error) error

Jump to

Keyboard shortcuts

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