Documentation ¶
Overview ¶
This package contains functions for running nodes over a network, who communicate using RPC for test setup. It also provided client interfaces to RPC functions. See the cmd package for the running the actual binaries.
Index ¶
- func AllFinished(scs *SingleConsState)
- func GetDecisions(scs *SingleConsState) ([][]byte, error)
- func Reset(scs *SingleConsState)
- func RunCons(setup *SingleConsSetup) (err error)
- func RunSingleConsType(setup *SingleConsSetup)
- type CausalDecisions
- type NewRunningArgs
- type None
- type ParRegClient
- func (pc *ParRegClient) Close() (err error)
- func (pc *ParRegClient) GenBlsShared(id, idx, numThresh int) error
- func (pc *ParRegClient) GenDSSShared(id, numNonMembers, numThresh int) error
- func (pc *ParRegClient) GetAllParticipants(id int) (pi []*network.ParticipantInfo, err error)
- func (pc *ParRegClient) GetBlsShared(id, idx int) (*network.BlsSharedMarshalIndex, error)
- func (pc *ParRegClient) GetDSSShared(id int) (*ed.CoinSharedMarshaled, error)
- func (pc *ParRegClient) GetParticipants(id int, pub sig.PubKeyStr) (pi [][]*network.ParticipantInfo, err error)
- func (pc *ParRegClient) NewParReg(ps PregSetup) error
- func (pc *ParRegClient) RegisterParticipant(id int, parInfo *network.ParticipantInfo) error
- type PregClientWrapper
- func (pr *PregClientWrapper) GenBlsShared(idx, numThresh int) error
- func (pr *PregClientWrapper) GenDSSShared(numNonNumbers, numThresh int) error
- func (pr *PregClientWrapper) GetAllParticipants() ([]*network.ParticipantInfo, error)
- func (pr *PregClientWrapper) GetBlsShared(idx int) (index int, blsShared *bls.BlsSharedMarshal)
- func (pr *PregClientWrapper) GetDSSShared() ed.CoinSharedMarshaled
- func (pr *PregClientWrapper) GetParticipants(pub sig.PubKeyStr) ([][]*network.ParticipantInfo, error)
- func (pr *PregClientWrapper) RegisterParticipant(parInfo *network.ParticipantInfo) error
- type PregSetup
- type RPCNodeClient
- func (rnc *RPCNodeClient) AllFinished() (err error)
- func (rnc *RPCNodeClient) AllStart() (err error)
- func (rnc *RPCNodeClient) Close() (err error)
- func (rnc *RPCNodeClient) Exit() (err error)
- func (rnc *RPCNodeClient) GetCausalDecisions(i int) (dec CausalDecisions, err error)
- func (rnc *RPCNodeClient) GetDecisions(i int) (dec [][]byte, err error)
- func (rnc *RPCNodeClient) GetResults(i int, proposerStatsObj consinterface.SMStats) (res RpcResults, err error)
- func (rnc *RPCNodeClient) NewConsRunning(nra NewRunningArgs) (err error)
- func (rnc *RPCNodeClient) Reset() (err error)
- type RpcResults
- type SingleConsSetup
- type SingleConsState
- type TPanic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllFinished ¶
func AllFinished(scs *SingleConsState)
AllFinished is called after RunSingleConsType has completed running on all nodes to shutdown the node.
func GetDecisions ¶
func GetDecisions(scs *SingleConsState) ([][]byte, error)
GetDecisions returns the decided values at the node. It should be called after RunSingleConsType has finished, and before AllFinished has been called.
func Reset ¶
func Reset(scs *SingleConsState)
Reset is called after AllFinished to do remaining cleanup
func RunCons ¶
func RunCons(setup *SingleConsSetup) (err error)
RunCons sets up a consensus experiment for a single node given the input setup. Once setup is complete RunSingleConsType is called to run the experiment.
func RunSingleConsType ¶
func RunSingleConsType(setup *SingleConsSetup)
RunSingleConsType is called after the setup of RunBinCons1 or RunMvCons1 has completed on all nodes.
Types ¶
type CausalDecisions ¶
type CausalDecisions struct { Root *utils.StringNode OrderedDecisions [][]byte }
CausalDecisions represents the decided values of a causally ordered test.
type NewRunningArgs ¶
type NewRunningArgs struct { I int // The index of the node in the test (note this is not used in consensus, consensus uses the index of the sorted pub key list) To types.TestOptions // The options of the test ParRegAddress string // The address of the participant register }
NewRunningArgs is used as the argument to create a new consensus participant for an experiment.
type None ¶
type None int
None is used as input to an RPC call that takes no arguments. It is used so the functions follow the needed go RPC interface.
type ParRegClient ¶
type ParRegClient struct {
// contains filtered or unexported fields
}
ParRegClient acts as an interface to a ParticipantRegister through rpc.
func NewParRegClient ¶
func NewParRegClient(address string) (pc *ParRegClient, err error)
NewParRegClient creates a new client connection to the ParticipantRegister at address.
func (*ParRegClient) Close ¶
func (pc *ParRegClient) Close() (err error)
Close closes the connection.
func (*ParRegClient) GenBlsShared ¶
func (pc *ParRegClient) GenBlsShared(id, idx, numThresh int) error
GenBlsShared calls ParticipantRegister.GenBlsShared on the server
func (*ParRegClient) GenDSSShared ¶
func (pc *ParRegClient) GenDSSShared(id, numNonMembers, numThresh int) error
GenDSSShared calls ParticipantRegister.GenDSSShared on the server
func (*ParRegClient) GetAllParticipants ¶
func (pc *ParRegClient) GetAllParticipants(id int) (pi []*network.ParticipantInfo, err error)
GetAllParticipants call ParRegClient.GetAllParticipants on the server
func (*ParRegClient) GetBlsShared ¶
func (pc *ParRegClient) GetBlsShared(id, idx int) (*network.BlsSharedMarshalIndex, error)
GetBlsShared calls ParticipantRegister.GetBlsShared on the server
func (*ParRegClient) GetDSSShared ¶
func (pc *ParRegClient) GetDSSShared(id int) (*ed.CoinSharedMarshaled, error)
GetDSSShared calls ParticipantRegister.GetDSSShared on the server
func (*ParRegClient) GetParticipants ¶
func (pc *ParRegClient) GetParticipants(id int, pub sig.PubKeyStr) (pi [][]*network.ParticipantInfo, err error)
GetParticipants call ParticipantRegister.GetParticipants on the server
func (*ParRegClient) NewParReg ¶
func (pc *ParRegClient) NewParReg(ps PregSetup) error
NewParReg calls NewParReg on the server.
func (*ParRegClient) RegisterParticipant ¶
func (pc *ParRegClient) RegisterParticipant(id int, parInfo *network.ParticipantInfo) error
RegisterParticipant calls ParticipantRegister.RegisterParticipant on the server
type PregClientWrapper ¶
type PregClientWrapper struct { network.ParRegClientInterface // contains filtered or unexported fields }
PregClientWrapper wraps the ParRegClient object with the nework.PregInterface interface.
func NewPregClientWrapper ¶
func NewPregClientWrapper(cli network.ParRegClientInterface, id int) *PregClientWrapper
func (*PregClientWrapper) GenBlsShared ¶
func (pr *PregClientWrapper) GenBlsShared(idx, numThresh int) error
func (*PregClientWrapper) GenDSSShared ¶
func (pr *PregClientWrapper) GenDSSShared(numNonNumbers, numThresh int) error
func (*PregClientWrapper) GetAllParticipants ¶
func (pr *PregClientWrapper) GetAllParticipants() ([]*network.ParticipantInfo, error)
func (*PregClientWrapper) GetBlsShared ¶
func (pr *PregClientWrapper) GetBlsShared(idx int) (index int, blsShared *bls.BlsSharedMarshal)
func (*PregClientWrapper) GetDSSShared ¶
func (pr *PregClientWrapper) GetDSSShared() ed.CoinSharedMarshaled
func (*PregClientWrapper) GetParticipants ¶
func (pr *PregClientWrapper) GetParticipants(pub sig.PubKeyStr) ([][]*network.ParticipantInfo, error)
func (*PregClientWrapper) RegisterParticipant ¶
func (pr *PregClientWrapper) RegisterParticipant(parInfo *network.ParticipantInfo) error
type PregSetup ¶
type PregSetup struct { ID int // identifier of the par reg ConnType network.NetworkPropagationSetup // The network propagation type NodeCount int // The number of participants in the consensus }
PregSetup is used as the agrument to create a new ParticipantRegister through rpc
type RPCNodeClient ¶
type RPCNodeClient struct {
// contains filtered or unexported fields
}
RPCNodeClient creates a connection to a node running a RunningCons rpc server, (see cmd.RunninCons)
func NewRPCNodeClient ¶
func NewRPCNodeClient(address string) (rnc *RPCNodeClient, err error)
NewRPCNodeClient creates a client connection to the node at address running a RunningCons rpc server.
func (*RPCNodeClient) AllFinished ¶
func (rnc *RPCNodeClient) AllFinished() (err error)
AllFinished calls RunningCons.AllFinished at the remote node.
func (*RPCNodeClient) AllStart ¶
func (rnc *RPCNodeClient) AllStart() (err error)
AllStart calls RunningCons.AllStart at the remote node.
func (*RPCNodeClient) Close ¶
func (rnc *RPCNodeClient) Close() (err error)
Close closes the connection.
func (*RPCNodeClient) Exit ¶
func (rnc *RPCNodeClient) Exit() (err error)
Exit calls RunningCons.Exit at the remote node.
func (*RPCNodeClient) GetCausalDecisions ¶
func (rnc *RPCNodeClient) GetCausalDecisions(i int) (dec CausalDecisions, err error)
GetDecisions calls RunningCons.GetDecisions for index i at the remote node.
func (*RPCNodeClient) GetDecisions ¶
func (rnc *RPCNodeClient) GetDecisions(i int) (dec [][]byte, err error)
GetDecisions calls RunningCons.GetDecisions for index i at the remote node.
func (*RPCNodeClient) GetResults ¶
func (rnc *RPCNodeClient) GetResults(i int, proposerStatsObj consinterface.SMStats) (res RpcResults, err error)
GetResults calls RunningCons.GetResults for index i at the remote node.
func (*RPCNodeClient) NewConsRunning ¶
func (rnc *RPCNodeClient) NewConsRunning(nra NewRunningArgs) (err error)
NewMvCons1Running calls RunningCons.NewMvConsRunning at the remote node.
func (*RPCNodeClient) Reset ¶
func (rnc *RPCNodeClient) Reset() (err error)
Reset calls RunningCons.Reset at the remote node.
type RpcResults ¶
type RpcResults struct { Stats *stats.MergedStats // Binary consensus statistics // NwStats *stats.BasicNwStats // Network statistics SMStats consinterface.SMStats }
RpcResults is used to transport the results of an experiment in a struct as the result of a rpc call. TODO this is hardcoded to binary/simple nw stats, should make more general.
type SingleConsSetup ¶
type SingleConsSetup struct { I int // The index of the node in the test (note this is not used in consensus, consensus uses the index of the sorted pub key list) MyIP string // The ip address and port of the node To types.TestOptions // The test setup ParReg network.ParRegClientInterface // RPC connection to the participant register SCS *SingleConsState // Pointer to the actual state Mutex *sync.RWMutex SetInitialConfig *bool SetInitialHash *bool }
SingleConsSetup contains all the details for a single node to start running a test.
type SingleConsState ¶
type SingleConsState struct { I int // The index of the node in the test (note this is not used in consensus, consensus uses the index of the sorted pub key list) MyIP string // The ip address and port of the node PrivKey sig.Priv // The private key RandKey [32]byte // Key for random number generation To types.TestOptions // The test setup TestProc channelinterface.MainChannel // The main channel NetNodeInfo []channelinterface.NetNodeInfo // The local connection information StorageFileName string // name of the storage file RetExtraParRegInfo [][]byte // Per process extra info (usually generated by the state machine, ex an init block) NumCons []int // Number of connections to make FinishedChan chan channelinterface.ChannelCloseType // Where we wait for cons to finish FailFinishedChan chan channelinterface.ChannelCloseType // Where we wait for failure cons to finish ConsState cons.ConsStateInterface MemberCheckerState consinterface.ConsStateInterface BcastFunc consinterface.ByzBroadcastFunc // Function to check if should act byzantine Sc consinterface.ConsItem // The init consensus object Ds storage.StoreInterface // The interface to the disk storage Stats stats.StatsInterface // The statsistics tracking // NwStats stats.NwStatsInterface // Network statistics tracking ParReg network.ParRegClientInterface // RPC connection to the participant register ParRegsInt []network.PregInterface // Interface to ParReg for using functions from cons package Gc *generalconfig.GeneralConfig // the general config }
SingleConsState tracks the state of a single node when running an experiment over a network.