storage

package
v0.11.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: GPL-3.0 Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const DAY_U64 = uint64(time.Hour) * 24

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerStore

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

func NewBadgerStore

func NewBadgerStore(custom *config.Custom, dir string) (*BadgerStore, error)

func (*BadgerStore) AddNodeOperation added in v0.3.0

func (s *BadgerStore) AddNodeOperation(tx *common.VersionedTransaction, timestamp, threshold uint64) error

func (*BadgerStore) CacheGetTransaction

func (s *BadgerStore) CacheGetTransaction(hash crypto.Hash) (*common.VersionedTransaction, error)

func (*BadgerStore) CacheListTransactions

func (s *BadgerStore) CacheListTransactions(hook func(tx *common.VersionedTransaction) error) error

func (*BadgerStore) CachePutTransaction

func (s *BadgerStore) CachePutTransaction(tx *common.VersionedTransaction) error

func (*BadgerStore) CheckDepositInput

func (s *BadgerStore) CheckDepositInput(deposit *common.DepositData, tx crypto.Hash) error

func (*BadgerStore) CheckGenesisLoad

func (s *BadgerStore) CheckGenesisLoad(snapshots []*common.SnapshotWithTopologicalOrder) (bool, error)

func (*BadgerStore) CheckGhost

func (s *BadgerStore) CheckGhost(key crypto.Key) (bool, error)

func (*BadgerStore) Close

func (store *BadgerStore) Close() error

func (*BadgerStore) ListNodeWorks added in v0.11.0

func (s *BadgerStore) ListNodeWorks(cids []crypto.Hash, day uint32) (map[crypto.Hash][2]uint64, error)

func (*BadgerStore) ListWorkOffsets added in v0.11.6

func (s *BadgerStore) ListWorkOffsets(cids []crypto.Hash) (map[crypto.Hash]uint64, error)

func (*BadgerStore) LoadGenesis

func (s *BadgerStore) LoadGenesis(rounds []*common.Round, snapshots []*common.SnapshotWithTopologicalOrder, transactions []*common.VersionedTransaction) error

func (*BadgerStore) LockDepositInput

func (s *BadgerStore) LockDepositInput(deposit *common.DepositData, tx crypto.Hash, fork bool) error

func (*BadgerStore) LockMintInput added in v0.1.1

func (s *BadgerStore) LockMintInput(mint *common.MintData, tx crypto.Hash, fork bool) error

func (*BadgerStore) LockUTXO

func (s *BadgerStore) LockUTXO(hash crypto.Hash, index int, tx crypto.Hash, fork bool) error

func (*BadgerStore) ReadAllNodes added in v0.5.6

func (s *BadgerStore) ReadAllNodes(threshold uint64, withState bool) []*common.Node

func (*BadgerStore) ReadDomains

func (s *BadgerStore) ReadDomains() []common.Domain

func (*BadgerStore) ReadLastMintDistribution added in v0.1.1

func (s *BadgerStore) ReadLastMintDistribution(group string) (*common.MintDistribution, error)
func (s *BadgerStore) ReadLink(from, to crypto.Hash) (uint64, error)

func (*BadgerStore) ReadMintDistributions added in v0.1.2

func (s *BadgerStore) ReadMintDistributions(group string, offset, count uint64) ([]*common.MintDistribution, []*common.VersionedTransaction, error)

func (*BadgerStore) ReadRound

func (s *BadgerStore) ReadRound(hash crypto.Hash) (*common.Round, error)

func (*BadgerStore) ReadSnapshot added in v0.2.14

func (s *BadgerStore) ReadSnapshot(hash crypto.Hash) (*common.SnapshotWithTopologicalOrder, error)

func (*BadgerStore) ReadSnapshotWithTransactionsSinceTopology added in v0.1.1

func (s *BadgerStore) ReadSnapshotWithTransactionsSinceTopology(topologyOffset, count uint64) ([]*common.SnapshotWithTopologicalOrder, []*common.VersionedTransaction, error)

func (*BadgerStore) ReadSnapshotWorksForNodeRound added in v0.11.7

func (s *BadgerStore) ReadSnapshotWorksForNodeRound(nodeId crypto.Hash, round uint64) ([]*common.SnapshotWork, error)

func (*BadgerStore) ReadSnapshotsForNodeRound

func (s *BadgerStore) ReadSnapshotsForNodeRound(nodeId crypto.Hash, round uint64) ([]*common.SnapshotWithTopologicalOrder, error)

func (*BadgerStore) ReadSnapshotsSinceTopology

func (s *BadgerStore) ReadSnapshotsSinceTopology(topologyOffset, count uint64) ([]*common.SnapshotWithTopologicalOrder, error)

func (*BadgerStore) ReadTransaction

func (s *BadgerStore) ReadTransaction(hash crypto.Hash) (*common.VersionedTransaction, string, error)

func (*BadgerStore) ReadUTXO

func (s *BadgerStore) ReadUTXO(hash crypto.Hash, index int) (*common.UTXOWithLock, error)

func (*BadgerStore) ReadWorkOffset added in v0.11.0

func (s *BadgerStore) ReadWorkOffset(nodeId crypto.Hash) (uint64, error)

func (*BadgerStore) RemoveGraphEntries added in v0.1.1

func (s *BadgerStore) RemoveGraphEntries(prefix string) (int, error)

func (*BadgerStore) StartNewRound

func (s *BadgerStore) StartNewRound(node crypto.Hash, number uint64, references *common.RoundLink, finalStart uint64) error

func (*BadgerStore) TopologySequence

func (s *BadgerStore) TopologySequence() uint64

func (*BadgerStore) UpdateEmptyHeadRound

func (s *BadgerStore) UpdateEmptyHeadRound(node crypto.Hash, number uint64, references *common.RoundLink) error

func (*BadgerStore) ValidateGraphEntries added in v0.1.14

func (s *BadgerStore) ValidateGraphEntries(networkId crypto.Hash, depth uint64) (int, int, error)

func (*BadgerStore) WriteRoundWork added in v0.11.0

func (s *BadgerStore) WriteRoundWork(nodeId crypto.Hash, round uint64, snapshots []*common.SnapshotWork) error

func (*BadgerStore) WriteSnapshot

func (s *BadgerStore) WriteSnapshot(snap *common.SnapshotWithTopologicalOrder, signers []crypto.Hash) error

func (*BadgerStore) WriteTransaction

func (s *BadgerStore) WriteTransaction(ver *common.VersionedTransaction) error

func (*BadgerStore) WriteWorkOffsetHack added in v0.11.6

func (s *BadgerStore) WriteWorkOffsetHack(nodeId crypto.Hash, round uint64) error

type Store

type Store interface {
	Close() error

	CheckGenesisLoad(snapshots []*common.SnapshotWithTopologicalOrder) (bool, error)
	LoadGenesis(rounds []*common.Round, snapshots []*common.SnapshotWithTopologicalOrder, transactions []*common.VersionedTransaction) error
	ReadAllNodes(threshold uint64, withState bool) []*common.Node
	AddNodeOperation(tx *common.VersionedTransaction, timestamp, threshold uint64) error
	ReadTransaction(hash crypto.Hash) (*common.VersionedTransaction, string, error)
	WriteTransaction(tx *common.VersionedTransaction) error
	StartNewRound(node crypto.Hash, number uint64, references *common.RoundLink, finalStart uint64) error
	UpdateEmptyHeadRound(node crypto.Hash, number uint64, references *common.RoundLink) error
	TopologySequence() uint64

	ReadUTXO(hash crypto.Hash, index int) (*common.UTXOWithLock, error)
	LockUTXO(hash crypto.Hash, index int, tx crypto.Hash, fork bool) error
	CheckDepositInput(deposit *common.DepositData, tx crypto.Hash) error
	LockDepositInput(deposit *common.DepositData, tx crypto.Hash, fork bool) error
	CheckGhost(key crypto.Key) (bool, error)
	ReadSnapshot(hash crypto.Hash) (*common.SnapshotWithTopologicalOrder, error)
	ReadSnapshotsSinceTopology(offset, count uint64) ([]*common.SnapshotWithTopologicalOrder, error)
	ReadSnapshotWithTransactionsSinceTopology(topologyOffset, count uint64) ([]*common.SnapshotWithTopologicalOrder, []*common.VersionedTransaction, error)
	ReadSnapshotsForNodeRound(nodeIdWithNetwork crypto.Hash, round uint64) ([]*common.SnapshotWithTopologicalOrder, error)
	ReadRound(hash crypto.Hash) (*common.Round, error)
	ReadLink(from, to crypto.Hash) (uint64, error)
	WriteSnapshot(*common.SnapshotWithTopologicalOrder, []crypto.Hash) error
	ReadDomains() []common.Domain

	CachePutTransaction(tx *common.VersionedTransaction) error
	CacheGetTransaction(hash crypto.Hash) (*common.VersionedTransaction, error)
	CacheListTransactions(hook func(tx *common.VersionedTransaction) error) error

	ReadLastMintDistribution(group string) (*common.MintDistribution, error)
	LockMintInput(mint *common.MintData, tx crypto.Hash, fork bool) error
	ReadMintDistributions(group string, offset, count uint64) ([]*common.MintDistribution, []*common.VersionedTransaction, error)
	ReadSnapshotWorksForNodeRound(nodeId crypto.Hash, round uint64) ([]*common.SnapshotWork, error)
	ListWorkOffsets(cids []crypto.Hash) (map[crypto.Hash]uint64, error)
	ListNodeWorks(cids []crypto.Hash, day uint32) (map[crypto.Hash][2]uint64, error)
	ReadWorkOffset(nodeId crypto.Hash) (uint64, error)
	WriteWorkOffsetHack(nodeId crypto.Hash, round uint64) error
	WriteRoundWork(nodeId crypto.Hash, round uint64, snapshots []*common.SnapshotWork) error

	RemoveGraphEntries(prefix string) (int, error)
	ValidateGraphEntries(networkId crypto.Hash, depth uint64) (int, int, error)
}

Jump to

Keyboard shortcuts

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