Documentation
¶
Index ¶
- Variables
- type BadgerStore
- func (s *BadgerStore) AddNodeOperation(tx *common.VersionedTransaction, timestamp, threshold uint64) error
- func (s *BadgerStore) CacheGetTransaction(hash crypto.Hash) (*common.VersionedTransaction, error)
- func (s *BadgerStore) CacheListTransactions(hook func(tx *common.VersionedTransaction) error) error
- func (s *BadgerStore) CachePutTransaction(tx *common.VersionedTransaction) error
- func (s *BadgerStore) CheckDepositInput(deposit *common.DepositData, tx crypto.Hash) error
- func (s *BadgerStore) CheckGenesisLoad() (bool, error)
- func (s *BadgerStore) CheckGhost(key crypto.Key) (bool, error)
- func (s *BadgerStore) CheckTransactionFinalization(hash crypto.Hash) (bool, error)
- func (s *BadgerStore) CheckTransactionInNode(nodeId, hash crypto.Hash) (bool, error)
- func (store *BadgerStore) Close() error
- func (s *BadgerStore) LoadGenesis(rounds []*common.Round, snapshots []*common.SnapshotWithTopologicalOrder, ...) error
- func (s *BadgerStore) LockDepositInput(deposit *common.DepositData, tx crypto.Hash, fork bool) error
- func (s *BadgerStore) LockMintInput(mint *common.MintData, tx crypto.Hash, fork bool) error
- func (s *BadgerStore) LockUTXO(hash crypto.Hash, index int, tx crypto.Hash, fork bool) error
- func (s *BadgerStore) QueueAppendSnapshot(peerId crypto.Hash, snap *common.Snapshot, finalized bool) error
- func (s *BadgerStore) QueueInfo() (uint64, uint64, uint64, error)
- func (s *BadgerStore) QueuePollSnapshots(hook func(peerId crypto.Hash, snap *common.Snapshot) error)
- func (s *BadgerStore) ReadAsset(id crypto.Hash) (*common.Asset, error)
- func (s *BadgerStore) ReadConsensusNodes() []*common.Node
- func (s *BadgerStore) ReadDomains() []common.Domain
- func (s *BadgerStore) ReadLastMintDistribution(group string) (*common.MintDistribution, error)
- func (s *BadgerStore) ReadLink(from, to crypto.Hash) (uint64, error)
- func (s *BadgerStore) ReadMintDistributions(group string, offset, count uint64) ([]*common.MintDistribution, []*common.VersionedTransaction, error)
- func (s *BadgerStore) ReadRound(hash crypto.Hash) (*common.Round, error)
- func (s *BadgerStore) ReadSnapshot(hash crypto.Hash) (*common.SnapshotWithTopologicalOrder, error)
- func (s *BadgerStore) ReadSnapshotWithTransactionsSinceTopology(topologyOffset, count uint64) ([]*common.SnapshotWithTopologicalOrder, []*common.VersionedTransaction, error)
- func (s *BadgerStore) ReadSnapshotsForNodeRound(nodeId crypto.Hash, round uint64) ([]*common.SnapshotWithTopologicalOrder, error)
- func (s *BadgerStore) ReadSnapshotsSinceTopology(topologyOffset, count uint64) ([]*common.SnapshotWithTopologicalOrder, error)
- func (s *BadgerStore) ReadTransaction(hash crypto.Hash) (*common.VersionedTransaction, error)
- func (s *BadgerStore) ReadUTXO(hash crypto.Hash, index int) (*common.UTXOWithLock, error)
- func (s *BadgerStore) RemoveGraphEntries(prefix string) error
- func (s *BadgerStore) StartNewRound(node crypto.Hash, number uint64, references *common.RoundLink, ...) error
- func (s *BadgerStore) StateGet(key string, val interface{}) (bool, error)
- func (s *BadgerStore) StateSet(key string, val interface{}) error
- func (s *BadgerStore) TopologySequence() uint64
- func (s *BadgerStore) UpdateEmptyHeadRound(node crypto.Hash, number uint64, references *common.RoundLink) error
- func (s *BadgerStore) ValidateGraphEntries() (int, int, error)
- func (s *BadgerStore) WriteAsset(a *common.Asset) error
- func (s *BadgerStore) WriteSnapshot(snap *common.SnapshotWithTopologicalOrder) error
- func (s *BadgerStore) WriteTransaction(ver *common.VersionedTransaction) error
- type PeerSnapshot
- type Queue
- type RingBuffer
- func (rb *RingBuffer) Cap() uint64
- func (rb *RingBuffer) Dispose()
- func (rb *RingBuffer) IsDisposed() bool
- func (rb *RingBuffer) Len() uint64
- func (rb *RingBuffer) Offer(item interface{}) (bool, error)
- func (rb *RingBuffer) Poll(block bool) (interface{}, error)
- func (rb *RingBuffer) Put(item interface{}) error
- type Store
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDisposed is returned when an operation is performed on a disposed // queue. ErrDisposed = errors.New(`queue: disposed`) // ErrTimeout is returned when an applicable queue operation times out. ErrTimeout = errors.New(`queue: poll timed out`) // ErrEmptyQueue is returned when an non-applicable queue operation was called // due to the queue's empty item state ErrEmptyQueue = errors.New(`queue: empty queue`) )
Functions ¶
This section is empty.
Types ¶
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
func NewBadgerStore ¶
func NewBadgerStore(dir string) (*BadgerStore, error)
func (*BadgerStore) AddNodeOperation ¶
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() (bool, error)
func (*BadgerStore) CheckGhost ¶
func (s *BadgerStore) CheckGhost(key crypto.Key) (bool, error)
func (*BadgerStore) CheckTransactionFinalization ¶ added in v0.1.0
func (s *BadgerStore) CheckTransactionFinalization(hash crypto.Hash) (bool, error)
func (*BadgerStore) CheckTransactionInNode ¶
func (s *BadgerStore) CheckTransactionInNode(nodeId, hash crypto.Hash) (bool, error)
func (*BadgerStore) Close ¶
func (store *BadgerStore) Close() 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 ¶
func (*BadgerStore) QueueAppendSnapshot ¶
func (*BadgerStore) QueuePollSnapshots ¶
func (*BadgerStore) ReadConsensusNodes ¶
func (s *BadgerStore) ReadConsensusNodes() []*common.Node
func (*BadgerStore) ReadDomains ¶
func (s *BadgerStore) ReadDomains() []common.Domain
func (*BadgerStore) ReadLastMintDistribution ¶
func (s *BadgerStore) ReadLastMintDistribution(group string) (*common.MintDistribution, error)
func (*BadgerStore) ReadMintDistributions ¶
func (s *BadgerStore) ReadMintDistributions(group string, offset, count uint64) ([]*common.MintDistribution, []*common.VersionedTransaction, error)
func (*BadgerStore) ReadSnapshot ¶
func (s *BadgerStore) ReadSnapshot(hash crypto.Hash) (*common.SnapshotWithTopologicalOrder, error)
func (*BadgerStore) ReadSnapshotWithTransactionsSinceTopology ¶
func (s *BadgerStore) ReadSnapshotWithTransactionsSinceTopology(topologyOffset, count uint64) ([]*common.SnapshotWithTopologicalOrder, []*common.VersionedTransaction, 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, error)
func (*BadgerStore) ReadUTXO ¶
func (s *BadgerStore) ReadUTXO(hash crypto.Hash, index int) (*common.UTXOWithLock, error)
func (*BadgerStore) RemoveGraphEntries ¶
func (s *BadgerStore) RemoveGraphEntries(prefix string) error
func (*BadgerStore) StartNewRound ¶
func (*BadgerStore) StateGet ¶
func (s *BadgerStore) StateGet(key string, val interface{}) (bool, error)
func (*BadgerStore) StateSet ¶
func (s *BadgerStore) StateSet(key string, val interface{}) error
func (*BadgerStore) TopologySequence ¶
func (s *BadgerStore) TopologySequence() uint64
func (*BadgerStore) UpdateEmptyHeadRound ¶
func (*BadgerStore) ValidateGraphEntries ¶
func (s *BadgerStore) ValidateGraphEntries() (int, int, error)
func (*BadgerStore) WriteAsset ¶ added in v0.1.14
func (s *BadgerStore) WriteAsset(a *common.Asset) error
func (*BadgerStore) WriteSnapshot ¶
func (s *BadgerStore) WriteSnapshot(snap *common.SnapshotWithTopologicalOrder) error
func (*BadgerStore) WriteTransaction ¶
func (s *BadgerStore) WriteTransaction(ver *common.VersionedTransaction) error
type PeerSnapshot ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
func (*Queue) PopCache ¶
func (q *Queue) PopCache() (*PeerSnapshot, error)
func (*Queue) PopFinal ¶
func (q *Queue) PopFinal() (*PeerSnapshot, error)
func (*Queue) PutCache ¶
func (q *Queue) PutCache(ps *PeerSnapshot) error
func (*Queue) PutFinal ¶
func (q *Queue) PutFinal(ps *PeerSnapshot) error
type RingBuffer ¶
type RingBuffer struct {
// contains filtered or unexported fields
}
RingBuffer is a MPMC buffer that achieves threadsafety with CAS operations only. A put on full or get on empty call will block until an item is put or retrieved. Calling Dispose on the RingBuffer will unblock any blocked threads with an error. This buffer is similar to the buffer described here: http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue with some minor additions.
func NewRingBuffer ¶
func NewRingBuffer(size uint64) *RingBuffer
NewRingBuffer will allocate, initialize, and return a ring buffer with the specified size.
func (*RingBuffer) Cap ¶
func (rb *RingBuffer) Cap() uint64
Cap returns the capacity of this ring buffer.
func (*RingBuffer) Dispose ¶
func (rb *RingBuffer) Dispose()
Dispose will dispose of this queue and free any blocked threads in the Put and/or Get methods. Calling those methods on a disposed queue will return an error.
func (*RingBuffer) IsDisposed ¶
func (rb *RingBuffer) IsDisposed() bool
IsDisposed will return a bool indicating if this queue has been disposed.
func (*RingBuffer) Len ¶
func (rb *RingBuffer) Len() uint64
Len returns the number of items in the queue.
func (*RingBuffer) Offer ¶
func (rb *RingBuffer) Offer(item interface{}) (bool, error)
Offer adds the provided item to the queue if there is space. If the queue is full, this call will return false. An error will be returned if the queue is disposed.
func (*RingBuffer) Poll ¶
func (rb *RingBuffer) Poll(block bool) (interface{}, error)
Poll will return the next item in the queue. This call will block if the queue is empty. This call will unblock when an item is added to the queue, Dispose is called on the queue, or the timeout is reached. An error will be returned if the queue is disposed or a timeout occurs. A non-positive timeout will block indefinitely.
func (*RingBuffer) Put ¶
func (rb *RingBuffer) Put(item interface{}) error
Put adds the provided item to the queue. If the queue is full, this call will block until an item is added to the queue or Dispose is called on the queue. An error will be returned if the queue is disposed.
type Store ¶
type Store interface {
Close() error
StateGet(key string, val interface{}) (bool, error)
StateSet(key string, val interface{}) error
CheckGenesisLoad() (bool, error)
LoadGenesis(rounds []*common.Round, snapshots []*common.SnapshotWithTopologicalOrder, transactions []*common.VersionedTransaction) error
ReadConsensusNodes() []*common.Node
AddNodeOperation(tx *common.VersionedTransaction, timestamp, threshold uint64) error
CheckTransactionFinalization(hash crypto.Hash) (bool, error)
CheckTransactionInNode(nodeId, hash crypto.Hash) (bool, error)
ReadTransaction(hash crypto.Hash) (*common.VersionedTransaction, 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) error
ReadDomains() []common.Domain
QueueInfo() (uint64, uint64, uint64, error)
QueueAppendSnapshot(peerId crypto.Hash, snap *common.Snapshot, finalized bool) error
QueuePollSnapshots(hook func(peerId crypto.Hash, snap *common.Snapshot) error)
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)
RemoveGraphEntries(prefix string) error
ValidateGraphEntries() (int, int, error)
WriteAsset(a *common.Asset) error
ReadAsset(id crypto.Hash) (*common.Asset, error)
}