storage

package
v0.0.0-...-bc7c564 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSafeboxInconsistent = errors.New("Failed to load safebox")
)

Functions

func WithStorage

func WithStorage(filename *string, fn func(storage Storage) error) error

Types

type Storage

type Storage interface {
	Load(callback func(number uint32, serialized []byte) error) (height uint32, err error)
	LoadBlocks(toHeight *uint32, callback func(index uint32, serialized []byte) error) error

	ListSnapshots() []uint32
	LoadSnapshot(height uint32) (serialized []byte)

	WithWritable(fn func(storageWritable StorageWritable, context interface{}) error) error
	LoadPeers(peers func(address []byte, data []byte)) error
	GetBlock(index uint32) (data []byte, err error)
	GetTxMetadata(txRipemd160Hash [20]byte) (data []byte, err error)
	GetAccountTxesData(number uint32, offset uint32, limit uint32) (txData map[uint32][]byte, err error)
}

type StorageBoltDb

type StorageBoltDb struct {
	Storage
	StorageWritable
	// contains filtered or unexported fields
}

func (*StorageBoltDb) DropSnapshot

func (this *StorageBoltDb) DropSnapshot(context interface{}, height uint32) error

func (*StorageBoltDb) GetAccountTxesData

func (this *StorageBoltDb) GetAccountTxesData(number uint32, offset uint32, limit uint32) (txData map[uint32][]byte, err error)

func (*StorageBoltDb) GetBlock

func (this *StorageBoltDb) GetBlock(index uint32) (data []byte, err error)

func (*StorageBoltDb) GetTxMetadata

func (this *StorageBoltDb) GetTxMetadata(txRipemd160Hash [20]byte) (metadata []byte, err error)

func (*StorageBoltDb) ListSnapshots

func (this *StorageBoltDb) ListSnapshots() []uint32

func (*StorageBoltDb) Load

func (this *StorageBoltDb) Load(callback func(index uint32, serialized []byte) error) (height uint32, err error)

func (*StorageBoltDb) LoadBlocks

func (this *StorageBoltDb) LoadBlocks(toHeight *uint32, callback func(index uint32, serialized []byte) error) error

func (*StorageBoltDb) LoadPeers

func (this *StorageBoltDb) LoadPeers(peers func(address []byte, data []byte)) error

func (*StorageBoltDb) LoadSnapshot

func (this *StorageBoltDb) LoadSnapshot(height uint32) (serialized []byte)

func (*StorageBoltDb) StoreAccountOperation

func (this *StorageBoltDb) StoreAccountOperation(context interface{}, number uint32, internalOperationId uint32, txID uint64) error

func (*StorageBoltDb) StoreAccountPack

func (this *StorageBoltDb) StoreAccountPack(context interface{}, index uint32, data []byte) error

func (*StorageBoltDb) StoreBlock

func (this *StorageBoltDb) StoreBlock(context interface{}, index uint32, data []byte) error

func (*StorageBoltDb) StorePeers

func (this *StorageBoltDb) StorePeers(context interface{}, peers func(func(address []byte, data []byte))) (err error)

func (*StorageBoltDb) StoreSnapshot

func (this *StorageBoltDb) StoreSnapshot(context interface{}, height uint32, serialized []byte) error

func (*StorageBoltDb) StoreTxHash

func (this *StorageBoltDb) StoreTxHash(context interface{}, txRipemd160Hash [20]byte, blockIndex uint32, txIndexInsideBlock uint32) (uint64, error)

func (*StorageBoltDb) StoreTxMetadata

func (this *StorageBoltDb) StoreTxMetadata(context interface{}, txID uint64, txMetadata []byte) error

func (*StorageBoltDb) WithWritable

func (this *StorageBoltDb) WithWritable(fn func(storageWritable StorageWritable, context interface{}) error) error

type StorageWritable

type StorageWritable interface {
	StoreBlock(context interface{}, index uint32, data []byte) error
	StoreTxHash(context interface{}, txRipemd160Hash [20]byte, blockIndex uint32, txIndexInsideBlock uint32) (uint64, error)
	StoreTxMetadata(context interface{}, txId uint64, txMetadata []byte) error
	StoreAccountOperation(context interface{}, number uint32, internalOperationId uint32, txId uint64) error
	StoreAccountPack(context interface{}, index uint32, data []byte) error
	StorePeers(context interface{}, peers func(func(address []byte, data []byte))) error

	StoreSnapshot(context interface{}, number uint32, serialized []byte) error
	DropSnapshot(context interface{}, height uint32) error
}

Jump to

Keyboard shortcuts

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