store

package
v0.0.0-...-9884c13 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

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

View Source
const (
	MaxRetries      = 2
	ReservationTime = 5
)
View Source
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 Pending

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

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
}

type SealOnBlock

type SealOnBlock struct {
	Epoch     uint64
	BlockHash crypto.Hash
	Action    []byte
}

type Sealed

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

type StoredAction

type StoredAction struct {
	Epoch  uint64
	Action actions.Action
	Data   []byte
}

Jump to

Keyboard shortcuts

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