Documentation ¶
Overview ¶
Package store implements a store for actions.
The store is a FIFO queue of actions ordered by epoch. Actions from oldest epochs are served first. Actions from epochs older than MaxActionDelay are discarded.
The store is used by the consensus engine to store actions received from the gateway. The consensus engine reads actions from the store and sends them to the swell engine. The store is also used by the swell engine to store actions received from the consensus engine. The swell engine reads actions from the store and sends them to the block engine.
store has an internal clock with epoch which should be updated by the validating node engine.
Index ¶
Constants ¶
const ( MaxRetries = 2 ReservationTime = 5 )
const (
MaxActionDelay = 100 // messages outside current epoch +/- MaxActionDelay are discarded
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionStore ¶
type ActionStore struct { Live bool Pop chan *StoredAction Push chan []byte // contains filtered or unexported fields }
ActionStore is a store for actions. It is a FIFO queue of actions ordered by epoch. Actions from oldest epochs are served first. Actions from epochs older than MaxActionDelay are discarded. Users should use Push and Pop channels to push and pop actions from the store. Users should use Mark, Unmark and Exclude methods to mark, unmark and exclude actions. Users should use Epoch channel to update the store epoch.
func NewActionStore ¶
func NewActionStore(ctx context.Context, epoch uint64, actions chan []byte) *ActionStore
NewActionStore returns a new action store clocked for the specified epoch. Users should use Push and Pop channels to push and pop actions from the store. Users should use Mark, Unmark and Exclude methods to mark, unmark and exclude actions. Users should use Epoch channel to update the store epoch.
func (*ActionStore) Exlude ¶
func (a *ActionStore) Exlude(hash crypto.Hash)
Exclude permanently deletes an action from the store.
func (*ActionStore) Mark ¶
func (a *ActionStore) Mark(hash crypto.Hash)
Mark marks an action as reserved. Marks temporarily exclude the action with associated hash from the pool of available actions.
func (*ActionStore) NextEpoch ¶
func (a *ActionStore) NextEpoch()
func (*ActionStore) Unmark ¶
func (a *ActionStore) Unmark(hash crypto.Hash)
Unmark unmarks an action as reserved.
type ActionVault ¶
type ActionVault struct { // channel to pop actions from the vault Pop chan []byte // channel to push new actions into the vault Push chan *Propose // contains filtered or unexported fields }
func NewActionVault ¶
func NewActionVault(ctx context.Context, epoch uint64, actions chan *Propose) *ActionVault
func NewActionVaultNoReply ¶
func NewActionVaultNoReply(ctx context.Context, epoch uint64, action chan []byte) *ActionVault
func (*ActionVault) Commit ¶
func (v *ActionVault) Commit(hash crypto.Hash)
func (*ActionVault) NextEpoch ¶
func (v *ActionVault) NextEpoch()
NextEpoch sends a clock update request to the vault
func (*ActionVault) SealOnBlock ¶
func (v *ActionVault) SealOnBlock(epoch uint64, sealHash crypto.Hash, Action []byte)
type PendingUpdate ¶
type PendingUpdate struct {
// contains filtered or unexported fields
}
type Propose ¶
type Propose struct { Data []byte Conn *socket.SignedConnection }
type Seal ¶
type Seal struct { Epoch uint64 Origin *socket.SignedConnection }