qbftstorage

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InstanceStore

type InstanceStore interface {
	// GetHighestInstance returns the highest instance for the given identifier.
	GetHighestInstance(identifier []byte) (*StoredInstance, error)

	// GetInstancesInRange returns historical instances in the given range.
	GetInstancesInRange(identifier []byte, from specqbft.Height, to specqbft.Height) ([]*StoredInstance, error)

	// SaveInstance updates/inserts the given instance to it's identifier's history.
	SaveInstance(instance *StoredInstance) error

	// SaveHighestInstance saves the given instance as the highest of it's identifier.
	SaveHighestInstance(instance *StoredInstance) error

	// SaveHighestAndHistoricalInstance saves the given instance as both the highest and historical.
	SaveHighestAndHistoricalInstance(instance *StoredInstance) error

	// GetInstance returns an historical instance for the given identifier and height.
	GetInstance(identifier []byte, height specqbft.Height) (*StoredInstance, error)

	// CleanAllInstances removes all historical and highest instances for the given identifier.
	CleanAllInstances(logger *zap.Logger, msgID []byte) error
}

InstanceStore manages instance data.

type QBFTStore

type QBFTStore interface {
	InstanceStore
}

QBFTStore is the store used by QBFT components

type StoredInstance

type StoredInstance struct {
	State          *specqbft.State
	DecidedMessage *specqbft.SignedMessage
}

StoredInstance contains instance state alongside with a decided message (aggregated commits).

func (*StoredInstance) Decode

func (si *StoredInstance) Decode(data []byte) error

Decode returns error if decoding failed.

func (*StoredInstance) Encode

func (si *StoredInstance) Encode() ([]byte, error)

Encode returns a StoredInstance encoded bytes or error.

Jump to

Keyboard shortcuts

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