Documentation ¶
Index ¶
- func NewLocalStream(From string, To string) network.SyncStream
- type Local
- func (n *Local) AllPeers(validatorPk []byte) ([]string, error)
- func (n *Local) Broadcast(topicName []byte, signed *proto.SignedMessage) error
- func (n *Local) BroadcastDecided(topicName []byte, msg *proto.SignedMessage) error
- func (n *Local) BroadcastSignature(topicName []byte, msg *proto.SignedMessage) error
- func (n *Local) CopyWithLocalNodeID(id peer.ID) *Local
- func (n *Local) GetDecidedByRange(peerStr string, msg *network.SyncMessage) (*network.SyncMessage, error)
- func (n *Local) GetHighestDecidedInstance(peerStr string, msg *network.SyncMessage) (*network.SyncMessage, error)
- func (n *Local) GetLastChangeRoundMsg(peerStr string, msg *network.SyncMessage) (*network.SyncMessage, error)
- func (n *Local) MaxBatch() uint64
- func (n *Local) NotifyOperatorID(oid string)
- func (n *Local) ReceivedDecidedChan() (<-chan *proto.SignedMessage, func())
- func (n *Local) ReceivedMsgChan() (<-chan *proto.SignedMessage, func())
- func (n *Local) ReceivedSignatureChan() (<-chan *proto.SignedMessage, func())
- func (n *Local) ReceivedSyncMsgChan() (<-chan *network.SyncChanObj, func())
- func (n *Local) RespondSyncMsg(streamID string, msg *network.SyncMessage) error
- func (n *Local) SubscribeToMainTopic() error
- func (n *Local) SubscribeToValidatorNetwork(validatorPk *bls.PublicKey) error
- type Stream
- func (s *Stream) Close() error
- func (s *Stream) CloseWrite() error
- func (s *Stream) ID() string
- func (s *Stream) ReadWithTimeout(timeout time.Duration) ([]byte, error)
- func (s *Stream) RemotePeer() string
- func (s *Stream) WriteSynMsg(msg *network.SyncMessage) (n int, err error)
- func (s *Stream) WriteWithTimeout(data []byte, timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLocalStream ¶
func NewLocalStream(From string, To string) network.SyncStream
NewLocalStream returs a stream instance
Types ¶
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local implements network.Local interface
func NewLocalNetwork ¶
func NewLocalNetwork() *Local
NewLocalNetwork creates a new instance of a local network
func (*Local) Broadcast ¶
func (n *Local) Broadcast(topicName []byte, signed *proto.SignedMessage) error
Broadcast implements network.Local interface
func (*Local) BroadcastDecided ¶
func (n *Local) BroadcastDecided(topicName []byte, msg *proto.SignedMessage) error
BroadcastDecided broadcasts a decided instance with collected signatures
func (*Local) BroadcastSignature ¶
func (n *Local) BroadcastSignature(topicName []byte, msg *proto.SignedMessage) error
BroadcastSignature broadcasts the given signature for the given lambda
func (*Local) CopyWithLocalNodeID ¶
CopyWithLocalNodeID copies the local network instance and adds a unique node id to it this is used for peer specific messages like sync messages to identify each node
func (*Local) GetDecidedByRange ¶
func (n *Local) GetDecidedByRange(peerStr string, msg *network.SyncMessage) (*network.SyncMessage, error)
GetDecidedByRange returns a list of decided signed messages up to 25 in a batch.
func (*Local) GetHighestDecidedInstance ¶
func (n *Local) GetHighestDecidedInstance(peerStr string, msg *network.SyncMessage) (*network.SyncMessage, error)
GetHighestDecidedInstance sends a highest decided request to peers and returns answers. If peer list is nil, broadcasts to all.
func (*Local) GetLastChangeRoundMsg ¶ added in v0.0.14
func (n *Local) GetLastChangeRoundMsg(peerStr string, msg *network.SyncMessage) (*network.SyncMessage, error)
GetLastChangeRoundMsg returns the latest change round msg for a running instance, could return nil
func (*Local) NotifyOperatorID ¶ added in v0.1.9
NotifyOperatorID implementation
func (*Local) ReceivedDecidedChan ¶
func (n *Local) ReceivedDecidedChan() (<-chan *proto.SignedMessage, func())
ReceivedDecidedChan returns the channel for decided messages
func (*Local) ReceivedMsgChan ¶
func (n *Local) ReceivedMsgChan() (<-chan *proto.SignedMessage, func())
ReceivedMsgChan implements network.Local interface
func (*Local) ReceivedSignatureChan ¶
func (n *Local) ReceivedSignatureChan() (<-chan *proto.SignedMessage, func())
ReceivedSignatureChan returns the channel with signatures
func (*Local) ReceivedSyncMsgChan ¶
func (n *Local) ReceivedSyncMsgChan() (<-chan *network.SyncChanObj, func())
ReceivedSyncMsgChan returns the channel for sync messages
func (*Local) RespondSyncMsg ¶ added in v0.1.9
func (n *Local) RespondSyncMsg(streamID string, msg *network.SyncMessage) error
RespondSyncMsg responds to sync messages
func (*Local) SubscribeToMainTopic ¶ added in v0.1.1
SubscribeToMainTopic implementation
type Stream ¶
type Stream struct { From string To string ReceiveChan chan *network.SyncMessage // contains filtered or unexported fields }
Stream is used by local network
func (*Stream) ReadWithTimeout ¶ added in v0.1.5
ReadWithTimeout implementation
func (*Stream) WriteSynMsg ¶
func (s *Stream) WriteSynMsg(msg *network.SyncMessage) (n int, err error)
WriteSynMsg implementation