storage

package
v0.18.5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: GPL-3.0 Imports: 15 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) CachePutTransaction

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

func (*BadgerStore) CacheRemoveTransactions added in v0.12.4

func (s *BadgerStore) CacheRemoveTransactions(hashes []crypto.Hash) error

func (*BadgerStore) CacheRetrieveTransactions added in v0.14.5

func (s *BadgerStore) CacheRetrieveTransactions(limit int) ([]*common.VersionedTransaction, error)

func (*BadgerStore) CheckGenesisLoad

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

func (*BadgerStore) Close

func (store *BadgerStore) Close() error

func (*BadgerStore) ListAggregatedRoundSpaceCheckpoints added in v0.14.0

func (s *BadgerStore) ListAggregatedRoundSpaceCheckpoints(cids []crypto.Hash) (map[crypto.Hash]*common.RoundSpace, error)

func (*BadgerStore) ListCustodianUpdates added in v0.16.0

func (s *BadgerStore) ListCustodianUpdates() ([]*common.CustodianUpdateRequest, 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) LockGhostKeys added in v0.16.0

func (s *BadgerStore) LockGhostKeys(keys []*crypto.Key, 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) LockUTXOs added in v0.12.11

func (s *BadgerStore) LockUTXOs(inputs []*common.Input, 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) ReadAssetWithBalance added in v0.17.0

func (s *BadgerStore) ReadAssetWithBalance(id crypto.Hash) (*common.Asset, common.Integer, error)

func (*BadgerStore) ReadCustodian added in v0.16.0

func (s *BadgerStore) ReadCustodian(ts uint64) (*common.CustodianUpdateRequest, error)

func (*BadgerStore) ReadDepositLock added in v0.17.1

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

func (*BadgerStore) ReadGhostKeyLock added in v0.16.0

func (s *BadgerStore) ReadGhostKeyLock(key crypto.Key) (*crypto.Hash, error)

func (*BadgerStore) ReadLastMintDistribution added in v0.1.1

func (s *BadgerStore) ReadLastMintDistribution(batch uint64) (*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(offset, count uint64) ([]*common.MintDistribution, []*common.VersionedTransaction, error)

func (*BadgerStore) ReadNodeRoundSpacesForBatch added in v0.14.0

func (s *BadgerStore) ReadNodeRoundSpacesForBatch(nodeId crypto.Hash, batch uint64) ([]*common.RoundSpace, error)

func (*BadgerStore) ReadRound

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

func (*BadgerStore) ReadRoundSpaceCheckpoint added in v0.14.0

func (s *BadgerStore) ReadRoundSpaceCheckpoint(nodeId crypto.Hash) (uint64, uint64, 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) ReadUTXOKeys added in v0.12.18

func (s *BadgerStore) ReadUTXOKeys(hash crypto.Hash, index uint) (*common.UTXOKeys, error)

func (*BadgerStore) ReadUTXOLock added in v0.12.18

func (s *BadgerStore) ReadUTXOLock(hash crypto.Hash, index uint) (*common.UTXOWithLock, error)

func (*BadgerStore) ReadWithdrawalClaim added in v0.17.7

func (s *BadgerStore) ReadWithdrawalClaim(hash crypto.Hash) (*common.VersionedTransaction, string, 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) WriteRoundSpaceAndState added in v0.14.0

func (s *BadgerStore) WriteRoundSpaceAndState(space *common.RoundSpace) error

func (*BadgerStore) WriteRoundWork added in v0.11.0

func (s *BadgerStore) WriteRoundWork(nodeId crypto.Hash, round uint64, snapshots []*common.SnapshotWork, credit bool) 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

type Store

type Store interface {
	Close() error

	CheckGenesisLoad(snapshots []*common.SnapshotWithTopologicalOrder) (bool, error)
	LoadGenesis(rounds []*common.Round, snapshots []*common.SnapshotWithTopologicalOrder, transactions []*common.VersionedTransaction) error
	ReadAssetWithBalance(id crypto.Hash) (*common.Asset, common.Integer, 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

	ReadUTXOKeys(hash crypto.Hash, index uint) (*common.UTXOKeys, error)
	ReadUTXOLock(hash crypto.Hash, index uint) (*common.UTXOWithLock, error)
	LockUTXOs(inputs []*common.Input, tx crypto.Hash, fork bool) error
	ReadDepositLock(deposit *common.DepositData) (crypto.Hash, error)
	LockDepositInput(deposit *common.DepositData, tx crypto.Hash, fork bool) error
	ReadWithdrawalClaim(hash crypto.Hash) (*common.VersionedTransaction, string, error)
	ReadGhostKeyLock(key crypto.Key) (*crypto.Hash, error)
	LockGhostKeys(keys []*crypto.Key, tx crypto.Hash, fork 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
	ReadCustodian(ts uint64) (*common.CustodianUpdateRequest, error)
	ListCustodianUpdates() ([]*common.CustodianUpdateRequest, error)

	CachePutTransaction(tx *common.VersionedTransaction) error
	CacheGetTransaction(hash crypto.Hash) (*common.VersionedTransaction, error)
	CacheRetrieveTransactions(limit int) ([]*common.VersionedTransaction, error)
	CacheRemoveTransactions([]crypto.Hash) error

	ReadLastMintDistribution(batch uint64) (*common.MintDistribution, error)
	LockMintInput(mint *common.MintData, tx crypto.Hash, fork bool) error
	ReadMintDistributions(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)
	WriteRoundWork(nodeId crypto.Hash, round uint64, snapshots []*common.SnapshotWork, credit bool) error

	ReadRoundSpaceCheckpoint(nodeId crypto.Hash) (uint64, uint64, error)
	WriteRoundSpaceAndState(space *common.RoundSpace) error
	ListAggregatedRoundSpaceCheckpoints(cids []crypto.Hash) (map[crypto.Hash]*common.RoundSpace, error)
	ReadNodeRoundSpacesForBatch(nodeId crypto.Hash, batch uint64) ([]*common.RoundSpace, 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