sync

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecidedArr added in v0.0.14

func DecidedArr(t *testing.T, maxSeq uint64, sks map[uint64]*bls.SecretKey, identifier []byte) []*proto.SignedMessage

DecidedArr returns an array of signed decided msgs for the given identifier

func GenerateNodes added in v0.0.14

func GenerateNodes(cnt int) (map[uint64]*bls.SecretKey, map[uint64]*proto.Node)

GenerateNodes generates randomly nodes

func GetPeers added in v0.0.14

func GetPeers(net network.Network, pk []byte, maxPeerCount int) ([]string, error)

GetPeers returns an array of peers selected

func MultiSignMsg added in v0.0.14

func MultiSignMsg(t *testing.T, ids []uint64, sks map[uint64]*bls.SecretKey, msg *proto.Message) *proto.SignedMessage

MultiSignMsg signs a msg with multiple signers

func TestingIbftStorage added in v0.0.14

func TestingIbftStorage(t *testing.T) collections.IbftStorage

TestingIbftStorage returns a testing storage

Types

type TestNetwork added in v0.0.14

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

TestNetwork struct

func NewTestNetwork added in v0.0.14

func NewTestNetwork(
	t *testing.T, peers []string,
	maxBatch int,
	highestDecidedReceived map[string]*proto.SignedMessage,
	errorsMap map[string]error,
	decidedArr map[string][]*proto.SignedMessage,
	lastMsgs map[string]*proto.SignedMessage,
	retError error,
	streamProvider func(string) network.SyncStream,
) *TestNetwork

NewTestNetwork returns a new test network instance

func (*TestNetwork) AllPeers added in v0.0.14

func (n *TestNetwork) AllPeers(validatorPk []byte) ([]string, error)

AllPeers returns all connected peers for a validator PK

func (*TestNetwork) Broadcast added in v0.0.14

func (n *TestNetwork) Broadcast(topicName []byte, msg *proto.SignedMessage) error

Broadcast impl

func (*TestNetwork) BroadcastDecided added in v0.0.14

func (n *TestNetwork) BroadcastDecided(topicName []byte, msg *proto.SignedMessage) error

BroadcastDecided impl

func (*TestNetwork) BroadcastSignature added in v0.0.14

func (n *TestNetwork) BroadcastSignature(topicName []byte, msg *proto.SignedMessage) error

BroadcastSignature impl

func (*TestNetwork) GetDecidedByRange added in v0.0.14

func (n *TestNetwork) GetDecidedByRange(peerStr string, msg *network.SyncMessage) (*network.SyncMessage, error)

GetDecidedByRange implementation

func (*TestNetwork) GetHighestDecidedInstance added in v0.0.14

func (n *TestNetwork) GetHighestDecidedInstance(peerStr string, msg *network.SyncMessage) (*network.SyncMessage, error)

GetHighestDecidedInstance impl

func (*TestNetwork) GetLastChangeRoundMsg added in v0.0.14

func (n *TestNetwork) GetLastChangeRoundMsg(peerStr string, msg *network.SyncMessage) (*network.SyncMessage, error)

GetLastChangeRoundMsg returns the latest change round msg for a running instance, could return nil

func (*TestNetwork) MaxBatch added in v0.0.14

func (n *TestNetwork) MaxBatch() uint64

MaxBatch implementation

func (*TestNetwork) NotifyOperatorID added in v0.1.9

func (n *TestNetwork) NotifyOperatorID(oid string)

NotifyOperatorID implementation

func (*TestNetwork) ReceivedDecidedChan added in v0.0.14

func (n *TestNetwork) ReceivedDecidedChan() (<-chan *proto.SignedMessage, func())

ReceivedDecidedChan impl

func (*TestNetwork) ReceivedMsgChan added in v0.0.14

func (n *TestNetwork) ReceivedMsgChan() (<-chan *proto.SignedMessage, func())

ReceivedMsgChan impl

func (*TestNetwork) ReceivedSignatureChan added in v0.0.14

func (n *TestNetwork) ReceivedSignatureChan() (<-chan *proto.SignedMessage, func())

ReceivedSignatureChan impl

func (*TestNetwork) ReceivedSyncMsgChan added in v0.0.14

func (n *TestNetwork) ReceivedSyncMsgChan() (<-chan *network.SyncChanObj, func())

ReceivedSyncMsgChan implementation

func (*TestNetwork) RespondSyncMsg added in v0.1.9

func (n *TestNetwork) RespondSyncMsg(streamID string, msg *network.SyncMessage) error

RespondSyncMsg implementation

func (*TestNetwork) SubscribeToMainTopic added in v0.1.1

func (n *TestNetwork) SubscribeToMainTopic() error

SubscribeToMainTopic implementation

func (*TestNetwork) SubscribeToValidatorNetwork added in v0.0.14

func (n *TestNetwork) SubscribeToValidatorNetwork(validatorPk *bls.PublicKey) error

SubscribeToValidatorNetwork subscribing and listen to validator network

type TestStream added in v0.0.14

type TestStream struct {
	C chan []byte
	// contains filtered or unexported fields
}

TestStream struct

func NewTestStream added in v0.0.14

func NewTestStream(remotePeer string) *TestStream

NewTestStream returns a new instance of test stream

func (*TestStream) Close added in v0.0.14

func (s *TestStream) Close() error

Close implementation

func (*TestStream) CloseWrite added in v0.0.14

func (s *TestStream) CloseWrite() error

CloseWrite implementation

func (*TestStream) ID added in v0.1.9

func (s *TestStream) ID() string

ID implementation

func (*TestStream) ReadWithTimeout added in v0.1.5

func (s *TestStream) ReadWithTimeout(timeout time.Duration) ([]byte, error)

ReadWithTimeout will read bytes from stream and return the result, will return error if timeout or error. does not close stream when returns

func (*TestStream) RemotePeer added in v0.0.14

func (s *TestStream) RemotePeer() string

RemotePeer implementation

func (*TestStream) WriteWithTimeout added in v0.1.5

func (s *TestStream) WriteWithTimeout(data []byte, timeout time.Duration) error

WriteWithTimeout will write bytes to stream, will return error if timeout or error. does not close stream when returns

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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