Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GossipAdapter ¶
type GossipAdapter interface { // Send sends a message to remote peers Send(msg *proto.GossipMessage, peers ...*comm.RemotePeer) // Accept returns a dedicated read-only channel for messages sent by other nodes that match a certain predicate. // If passThrough is false, the messages are processed by the gossip layer beforehand. // If passThrough is true, the gossip layer doesn't intervene and the messages // can be used to send a reply back to the sender Accept(acceptor common2.MessageAcceptor, passThrough bool) (<-chan *proto.GossipMessage, <-chan proto.ReceivedMessage) // UpdateChannelMetadata updates the self metadata the peer // publishes to other peers about its channel-related state UpdateChannelMetadata(metadata []byte, chainID common2.ChainID) // PeersOfChannel returns the NetworkMembers considered alive // and also subscribed to the channel given PeersOfChannel(common2.ChainID) []discovery.NetworkMember }
GossipAdapter defines gossip/communication required interface for state provider
type GossipStateProvider ¶
type GossipStateProvider interface { // Retrieve block with sequence number equal to index GetBlock(index uint64) *common.Block AddPayload(payload *proto.Payload) error // Stop terminates state transfer object Stop() }
GossipStateProvider is the interface to acquire sequences of the ledger blocks capable to full fill missing blocks by running state replication and sending request to get missing block to other nodes
func NewGossipStateProvider ¶
func NewGossipStateProvider(chainID string, g GossipAdapter, committer committer.Committer, mcs api.MessageCryptoService) GossipStateProvider
NewGossipStateProvider creates initialized instance of gossip state provider
type GossipStateProviderImpl ¶
type GossipStateProviderImpl struct {
// contains filtered or unexported fields
}
GossipStateProviderImpl the implementation of the GossipStateProvider interface the struct to handle in memory sliding window of new ledger block to be acquired by hyper ledger
func (*GossipStateProviderImpl) AddPayload ¶
func (s *GossipStateProviderImpl) AddPayload(payload *proto.Payload) error
AddPayload add new payload into state
func (*GossipStateProviderImpl) GetBlock ¶ added in v1.0.0
func (s *GossipStateProviderImpl) GetBlock(index uint64) *common.Block
GetBlock return ledger block given its sequence number as a parameter
func (*GossipStateProviderImpl) Stop ¶
func (s *GossipStateProviderImpl) Stop()
Stop function send halting signal to all go routines
type NodeMetastate ¶ added in v1.0.0
type NodeMetastate struct { // Actual ledger height LedgerHeight uint64 }
NodeMetastate information to store the information about current height of the ledger (last accepted block sequence number).
func FromBytes ¶ added in v1.0.0
func FromBytes(buf []byte) (*NodeMetastate, error)
FromBytes - encode from byte array into meta data structure
func NewNodeMetastate ¶ added in v1.0.0
func NewNodeMetastate(height uint64) *NodeMetastate
NewNodeMetastate creates new meta data with given ledger height148.69
func (*NodeMetastate) Bytes ¶ added in v1.0.0
func (n *NodeMetastate) Bytes() ([]byte, error)
Bytes decodes meta state into byte array for serialization
func (*NodeMetastate) Height ¶ added in v1.0.0
func (n *NodeMetastate) Height() uint64
Height returns ledger height from the state
func (*NodeMetastate) Update ¶ added in v1.0.0
func (n *NodeMetastate) Update(height uint64)
Update state with new ledger height
type PayloadsBuffer ¶
type PayloadsBuffer interface { // Adds new block into the buffer Push(payload *proto.Payload) error // Returns next expected sequence number Next() uint64 // Remove and return payload with given sequence number Pop() *proto.Payload // Get current buffer size Size() int // Channel to indicate event when new payload pushed with sequence // number equal to the next expected value. Ready() chan struct{} Close() }
PayloadsBuffer is used to store payloads into which used to support payloads with blocks reordering according to the sequence numbers. It also will provide the capability to signal whenever expected block has arrived.
func NewPayloadsBuffer ¶
func NewPayloadsBuffer(next uint64) PayloadsBuffer
NewPayloadsBuffer is factory function to create new payloads buffer
type PayloadsBufferImpl ¶
type PayloadsBufferImpl struct {
// contains filtered or unexported fields
}
PayloadsBufferImpl structure to implement PayloadsBuffer interface store inner state of available payloads and sequence numbers
func (*PayloadsBufferImpl) Close ¶
func (b *PayloadsBufferImpl) Close()
Close cleanups resources and channels in maintained
func (*PayloadsBufferImpl) Next ¶
func (b *PayloadsBufferImpl) Next() uint64
Next function provides the number of the next expected block
func (*PayloadsBufferImpl) Pop ¶
func (b *PayloadsBufferImpl) Pop() *proto.Payload
Pop function extracts the payload according to the next expected block number, if no next block arrived yet, function returns nil.
func (*PayloadsBufferImpl) Push ¶
func (b *PayloadsBufferImpl) Push(payload *proto.Payload) error
Push new payload into the buffer structure in case new arrived payload sequence number is below the expected next block number payload will be thrown away and error will be returned.
func (*PayloadsBufferImpl) Ready ¶
func (b *PayloadsBufferImpl) Ready() chan struct{}
Ready function returns the channel which indicates whenever expected next block has arrived and one could safely pop out next sequence of blocks
func (*PayloadsBufferImpl) Size ¶
func (b *PayloadsBufferImpl) Size() int
Size returns current number of payloads stored within buffer