adaptor

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalQuorum

func CalQuorum(N uint64) uint64

Types

type MinifileAdaptor

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

func OpenMinifile

func OpenMinifile(path string) (*MinifileAdaptor, error)

func (*MinifileAdaptor) DelState

func (a *MinifileAdaptor) DelState(key string) error

func (*MinifileAdaptor) ReadState

func (a *MinifileAdaptor) ReadState(key string) ([]byte, error)

func (*MinifileAdaptor) ReadStateSet

func (a *MinifileAdaptor) ReadStateSet(prefix string) (map[string][]byte, error)

ReadStateSet retrieves all key-value pairs where the key starts with prefix from the database with the given namespace

func (*MinifileAdaptor) StoreState

func (a *MinifileAdaptor) StoreState(key string, value []byte) error

type RBFTAdaptor

type RBFTAdaptor struct {
	ReadyC chan *Ready
	BlockC chan *common.CommitEvent

	StateUpdating     bool
	StateUpdateHeight uint64

	Cancel context.CancelFunc

	EpochInfo *rbft.EpochInfo

	MockBlockFeed event.Feed
	// contains filtered or unexported fields
}

func NewRBFTAdaptor

func NewRBFTAdaptor(config *common.Config) (*RBFTAdaptor, error)

func (*RBFTAdaptor) Broadcast

func (a *RBFTAdaptor) Broadcast(ctx context.Context, msg *consensus.ConsensusMessage) (err error)

func (*RBFTAdaptor) DelState

func (a *RBFTAdaptor) DelState(key string) error

DelState removes a key,value pair from the database with the given namespace

func (*RBFTAdaptor) Execute

func (a *RBFTAdaptor) Execute(requests []*types.Transaction, localList []bool, seqNo uint64, timestamp int64, proposerAccount string, proposerNodeID uint64)

func (*RBFTAdaptor) GetBlockMeta

func (a *RBFTAdaptor) GetBlockMeta(num uint64) (*rbfttypes.BlockMeta, error)

func (*RBFTAdaptor) GetCommitChannel

func (a *RBFTAdaptor) GetCommitChannel() chan *common.CommitEvent

func (*RBFTAdaptor) GetCurrentEpochInfo

func (a *RBFTAdaptor) GetCurrentEpochInfo() (*rbft.EpochInfo, error)

func (*RBFTAdaptor) GetEpochInfo

func (a *RBFTAdaptor) GetEpochInfo(epoch uint64) (*rbft.EpochInfo, error)

func (*RBFTAdaptor) PostCommitEvent

func (a *RBFTAdaptor) PostCommitEvent(commitEvent *common.CommitEvent)

func (*RBFTAdaptor) ReadEpochState

func (a *RBFTAdaptor) ReadEpochState(key string) ([]byte, error)

func (*RBFTAdaptor) ReadState

func (a *RBFTAdaptor) ReadState(key string) ([]byte, error)

ReadState retrieves a value to a key from the database with the given namespace

func (*RBFTAdaptor) ReadStateSet

func (a *RBFTAdaptor) ReadStateSet(prefix string) (map[string][]byte, error)

ReadStateSet retrieves all key-value pairs where the key starts with prefix from the database with the given namespace

func (*RBFTAdaptor) SendFilterEvent

func (a *RBFTAdaptor) SendFilterEvent(_ rbfttypes.InformType, _ ...any)

func (*RBFTAdaptor) SetMsgPipes

func (a *RBFTAdaptor) SetMsgPipes(msgPipes map[int32]p2p.Pipe, globalMsgPipe p2p.Pipe)

func (*RBFTAdaptor) Sign

func (a *RBFTAdaptor) Sign(msg []byte) ([]byte, error)

TODO: use edd25519 improve performance

func (*RBFTAdaptor) StateUpdate

func (a *RBFTAdaptor) StateUpdate(lowWatermark, seqNo uint64, digest string, checkpoints []*consensus.SignedCheckpoint, epochChanges ...*consensus.EpochChange)

func (*RBFTAdaptor) StoreEpochState

func (a *RBFTAdaptor) StoreEpochState(key string, value []byte) error

func (*RBFTAdaptor) StoreState

func (a *RBFTAdaptor) StoreState(key string, value []byte) error

StoreState stores a key,value pair to the database with the given namespace

func (*RBFTAdaptor) Unicast

func (a *RBFTAdaptor) Unicast(ctx context.Context, msg *consensus.ConsensusMessage, to string) error

func (*RBFTAdaptor) UpdateEpoch

func (a *RBFTAdaptor) UpdateEpoch() error

func (*RBFTAdaptor) Verify

func (a *RBFTAdaptor) Verify(address string, signature []byte, msg []byte) error

type Ready

type Ready struct {
	Txs             []*types.Transaction
	LocalList       []bool
	Height          uint64
	Timestamp       int64
	ProposerAccount string
	ProposerNodeID  uint64
}

type RosedbAdaptor

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

func OpenRosedb

func OpenRosedb(path string) (*RosedbAdaptor, error)

func (*RosedbAdaptor) DelState

func (a *RosedbAdaptor) DelState(key string) error

func (*RosedbAdaptor) ReadState

func (a *RosedbAdaptor) ReadState(key string) ([]byte, error)

func (*RosedbAdaptor) ReadStateSet

func (a *RosedbAdaptor) ReadStateSet(prefix string) (map[string][]byte, error)

ReadStateSet retrieves all key-value pairs where the key starts with prefix from the database with the given namespace

func (*RosedbAdaptor) StoreState

func (a *RosedbAdaptor) StoreState(key string, value []byte) error

Jump to

Keyboard shortcuts

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