Documentation ¶
Index ¶
- func NewPulse(numberDelta uint32, previousPulseNumber core.PulseNumber, ...) *core.Pulse
- type BftCell
- func (bftCell *BftCell) GetEntropy() core.Entropy
- func (bftCell *BftCell) GetIsEntropyReceived() bool
- func (bftCell *BftCell) GetSign() []byte
- func (bftCell *BftCell) SetEntropy(entropy core.Entropy)
- func (bftCell *BftCell) SetIsEntropyReceived(isEntropyReceived bool)
- func (bftCell *BftCell) SetSign(sign []byte)
- type EntropyPayload
- type EntropySignaturePayload
- type Handler
- func (handler *Handler) HealthCheck(request *Payload, response *Payload) error
- func (handler *Handler) MakeHandshake(request *Payload, response *Payload) error
- func (handler *Handler) ReceiveChosenSignature(request *Payload, response *Payload) error
- func (handler *Handler) ReceiveEntropy(request *Payload, response *Payload) error
- func (handler *Handler) ReceivePulse(request *Payload, response *Payload) error
- func (handler *Handler) ReceiveSignatureForEntropy(request *Payload, response *Payload) error
- func (handler *Handler) ReceiveVector(request *Payload, response *Payload) error
- type HandshakePayload
- type Neighbour
- type Payload
- type Pulsar
- func (currentPulsar *Pulsar) CheckConnectionsToPulsars()
- func (currentPulsar *Pulsar) EstablishConnectionToPulsar(pubKey string) error
- func (currentPulsar *Pulsar) FetchNeighbour(pubKey string) (*Neighbour, error)
- func (currentPulsar *Pulsar) GetBftGridItem(row string, column string) *BftCell
- func (currentPulsar *Pulsar) GetLastPulse() *core.Pulse
- func (currentPulsar *Pulsar) IsStateFailed() bool
- func (currentPulsar *Pulsar) SetBftGridItem(key string, value map[string]*BftCell)
- func (currentPulsar *Pulsar) SetLastPulse(newPulse *core.Pulse)
- func (currentPulsar *Pulsar) StartConsensusProcess(pulseNumber core.PulseNumber) error
- func (currentPulsar *Pulsar) StartServer()
- func (currentPulsar *Pulsar) StopServer()
- type PulsePayload
- type RPCClientWrapper
- type RPCClientWrapperFactory
- type RPCClientWrapperFactoryImpl
- type RPCClientWrapperImpl
- func (impl *RPCClientWrapperImpl) Close() error
- func (impl *RPCClientWrapperImpl) CreateConnection(connectionType configuration.ConnectionType, connectionAddress string) error
- func (impl *RPCClientWrapperImpl) Go(serviceMethod string, args interface{}, reply interface{}, done chan *rpc.Call) *rpc.Call
- func (impl *RPCClientWrapperImpl) IsInitialised() bool
- func (impl *RPCClientWrapperImpl) Lock()
- func (impl *RPCClientWrapperImpl) ResetClient()
- func (impl *RPCClientWrapperImpl) Unlock()
- type RequestType
- type State
- type StateSwitcher
- type StateSwitcherImpl
- type VectorPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPulse ¶
func NewPulse(numberDelta uint32, previousPulseNumber core.PulseNumber, entropyGenerator entropygenerator.EntropyGenerator) *core.Pulse
NewPulse creates a new pulse with using of custom GeneratedEntropy Generator
Types ¶
type BftCell ¶ added in v0.4.0
type BftCell struct { Sign []byte Entropy core.Entropy IsEntropyReceived bool // contains filtered or unexported fields }
BftCell is a cell in NxN btf-grid
func (*BftCell) GetEntropy ¶ added in v0.6.1
GetEntropy gets Entropy in the thread-safe way
func (*BftCell) GetIsEntropyReceived ¶ added in v0.6.1
GetIsEntropyReceived gets IsEntropyReceived in the thread-safe way
func (*BftCell) SetEntropy ¶ added in v0.6.1
SetEntropy sets Entropy in the thread-safe way
func (*BftCell) SetIsEntropyReceived ¶ added in v0.6.1
SetIsEntropyReceived sets IsEntropyReceived in the thread-safe way
type EntropyPayload ¶ added in v0.4.0
type EntropyPayload struct { PulseNumber core.PulseNumber Entropy core.Entropy }
EntropyPayload is a struct for sending Entropy step
type EntropySignaturePayload ¶ added in v0.4.0
type EntropySignaturePayload struct { PulseNumber core.PulseNumber Signature []byte }
EntropySignaturePayload is a struct for sending Sign of Entropy step
type Handler ¶ added in v0.3.0
type Handler struct {
Pulsar *Pulsar
}
Handler is a wrapper for rpc-calls It contains rpc-methods logic and pulsar's methods
func (*Handler) HealthCheck ¶ added in v0.4.0
HealthCheck is a handler of call with nil-payload It uses for checking connection status between pulsars
func (*Handler) MakeHandshake ¶ added in v0.3.0
MakeHandshake is a handler of call with handshake purpose
func (*Handler) ReceiveChosenSignature ¶ added in v0.4.0
ReceiveChosenSignature is a handler of call with the confirmation signature
func (*Handler) ReceiveEntropy ¶ added in v0.4.0
ReceiveEntropy is a handler of call for receiving Entropy from one of the pulsars
func (*Handler) ReceivePulse ¶ added in v0.6.0
ReceivePulse is a handler of call with the freshest pulse
func (*Handler) ReceiveSignatureForEntropy ¶ added in v0.4.0
ReceiveSignatureForEntropy is a handler of call for receiving Sign of Entropy from one of the pulsars
type HandshakePayload ¶ added in v0.3.0
HandshakePayload is a struct for handshake step
type Neighbour ¶ added in v0.3.0
type Neighbour struct { ConnectionType configuration.ConnectionType ConnectionAddress string OutgoingClient RPCClientWrapper PublicKey *ecdsa.PublicKey }
Neighbour is a helper struct, which contains info about pulsar-neighbour
type Pulsar ¶
type Pulsar struct { Sock net.Listener SockConnectionType configuration.ConnectionType RPCServer *rpc.Server Neighbours map[string]*Neighbour PrivateKey *ecdsa.PrivateKey PublicKeyRaw string Config configuration.Pulsar Storage pulsarstorage.PulsarStorage EntropyGenerator entropygenerator.EntropyGenerator StartProcessLock sync.Mutex GeneratedEntropy core.Entropy GeneratedEntropySign []byte CurrentSlotEntropy core.Entropy CurrentSlotPulseSender string CurrentSlotSenderConfirmations map[string]core.PulseSenderConfirmation ProcessingPulseNumber core.PulseNumber OwnedBftRow map[string]*BftCell BftGridLock sync.RWMutex StateSwitcher StateSwitcher Certificate certificate.Certificate // contains filtered or unexported fields }
Pulsar is a base struct for pulsar's node It contains all the stuff, which is needed for working of a pulsar
func NewPulsar ¶
func NewPulsar( configuration configuration.Pulsar, storage pulsarstorage.PulsarStorage, rpcWrapperFactory RPCClientWrapperFactory, entropyGenerator entropygenerator.EntropyGenerator, stateSwitcher StateSwitcher, certificate core.Certificate, listener func(string, string) (net.Listener, error)) (*Pulsar, error)
NewPulsar creates a new pulse with using of custom GeneratedEntropy Generator
func (*Pulsar) CheckConnectionsToPulsars ¶ added in v0.5.0
func (currentPulsar *Pulsar) CheckConnectionsToPulsars()
CheckConnectionsToPulsars is a method refreshing connections between pulsars
func (*Pulsar) EstablishConnectionToPulsar ¶ added in v0.5.0
EstablishConnectionToPulsar is a method for creating connection to another pulsar
func (*Pulsar) FetchNeighbour ¶ added in v0.6.0
FetchNeighbour searches neighbour of the pulsar by pubKey of a neighbout
func (*Pulsar) GetBftGridItem ¶ added in v0.6.0
GetBftGridItem returns a grid item i nthe thread-safe way
func (*Pulsar) GetLastPulse ¶ added in v0.6.1
GetLastPulse returns last pulse in the thread-safe mode
func (*Pulsar) IsStateFailed ¶ added in v0.6.0
IsStateFailed checks if state of the pulsar is failed or not
func (*Pulsar) SetBftGridItem ¶ added in v0.6.0
SetBftGridItem set item of the bftGrid in the thread-safe way
func (*Pulsar) SetLastPulse ¶ added in v0.6.1
SetLastPulse sets last pulse in the thread-safe mode
func (*Pulsar) StartConsensusProcess ¶ added in v0.4.0
func (currentPulsar *Pulsar) StartConsensusProcess(pulseNumber core.PulseNumber) error
StartConsensusProcess starts process of calculating consensus between pulsars
func (*Pulsar) StartServer ¶ added in v0.4.0
func (currentPulsar *Pulsar) StartServer()
StartServer starts listening of the rpc-server
func (*Pulsar) StopServer ¶ added in v0.4.0
func (currentPulsar *Pulsar) StopServer()
StopServer stops listening of the rpc-server
type PulsePayload ¶ added in v0.6.0
PulsePayload is a struct for sending finished pulse to all pulsars
type RPCClientWrapper ¶ added in v0.4.0
type RPCClientWrapper interface { // Lock takes current neighbour's lock Lock() // Unlock releases current neighbour's lock Unlock() // IsInitialised compares underhood rpc-client with nil IsInitialised() bool // CreateConnection creates connection to an another pulsar CreateConnection(connectionType configuration.ConnectionType, connectionAddress string) error // Close closes connection Close() error // Go makes rpc-call to an another pulsar Go(serviceMethod string, args interface{}, reply interface{}, done chan *rpc.Call) *rpc.Call // ResetClient clears rpc-client ResetClient() }
RPCClientWrapper describes interface of the wrapper around rpc-client
type RPCClientWrapperFactory ¶ added in v0.4.0
type RPCClientWrapperFactory interface {
CreateWrapper() RPCClientWrapper
}
RPCClientWrapperFactory describes interface for the wrappers factory
type RPCClientWrapperFactoryImpl ¶ added in v0.4.0
type RPCClientWrapperFactoryImpl struct { }
RPCClientWrapperFactoryImpl is a base impl of the RPCClientWrapperFactory
func (RPCClientWrapperFactoryImpl) CreateWrapper ¶ added in v0.4.0
func (RPCClientWrapperFactoryImpl) CreateWrapper() RPCClientWrapper
CreateWrapper return new RPCClientWrapper
type RPCClientWrapperImpl ¶ added in v0.4.0
RPCClientWrapperImpl is a standard impl of RPCClientWrapper
func (*RPCClientWrapperImpl) Close ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) Close() error
Close closes connection
func (*RPCClientWrapperImpl) CreateConnection ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) CreateConnection(connectionType configuration.ConnectionType, connectionAddress string) error
CreateConnection creates connection to an another pulsar
func (*RPCClientWrapperImpl) Go ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) Go(serviceMethod string, args interface{}, reply interface{}, done chan *rpc.Call) *rpc.Call
Go makes rpc-call to an another pulsar
func (*RPCClientWrapperImpl) IsInitialised ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) IsInitialised() bool
IsInitialised compares underhood rpc-client with nil
func (*RPCClientWrapperImpl) Lock ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) Lock()
Lock takes current neighbour's lock
func (*RPCClientWrapperImpl) ResetClient ¶ added in v0.5.0
func (impl *RPCClientWrapperImpl) ResetClient()
ResetClient clears rpc-client
func (*RPCClientWrapperImpl) Unlock ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) Unlock()
Unlock releases current neighbour's lock
type RequestType ¶ added in v0.3.0
type RequestType string
RequestType is a enum-like strings It identifies the type of the rpc-call
const ( // HealthCheck is a method for checking connection between pulsars HealthCheck RequestType = "Pulsar.HealthCheck" // Handshake is a method for creating connection between pulsars Handshake RequestType = "Pulsar.MakeHandshake" // ReceiveSignatureForEntropy is a method for receiving signs from peers ReceiveSignatureForEntropy RequestType = "Pulsar.ReceiveSignatureForEntropy" // ReceiveEntropy is a method for receiving Entropy from peers ReceiveEntropy RequestType = "Pulsar.ReceiveEntropy" // ReceiveVector is a method for receiving vectors from peers ReceiveVector RequestType = "Pulsar.ReceiveVector" // ReceiveChosenSignature is a method for receiving signature for sending from peers ReceiveChosenSignature RequestType = "Pulsar.ReceiveChosenSignature" // ReceivePulse is a method for receiving pulse from the sender ReceivePulse RequestType = "Pulsar.ReceivePulse" )
func (RequestType) String ¶ added in v0.3.0
func (state RequestType) String() string
type StateSwitcher ¶ added in v0.5.0
type StateSwitcher interface { SwitchToState(state State, args interface{}) GetState() State SetPulsar(pulsar *Pulsar) // contains filtered or unexported methods }
StateSwitcher is a base for pulsar's state machine
type StateSwitcherImpl ¶ added in v0.5.0
type StateSwitcherImpl struct {
// contains filtered or unexported fields
}
StateSwitcherImpl is a base implementation of the pulsar's state machine
func (*StateSwitcherImpl) GetState ¶ added in v0.6.0
func (switcher *StateSwitcherImpl) GetState() State
func (*StateSwitcherImpl) SetPulsar ¶ added in v0.5.0
func (switcher *StateSwitcherImpl) SetPulsar(pulsar *Pulsar)
SetPulsar sets pulsar of the current instance
func (*StateSwitcherImpl) SwitchToState ¶ added in v0.6.0
func (switcher *StateSwitcherImpl) SwitchToState(state State, args interface{})
type VectorPayload ¶ added in v0.4.0
type VectorPayload struct { PulseNumber core.PulseNumber Vector map[string]*BftCell }
VectorPayload is a struct for sending vector of Entropy step
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package pulsartestutil - test utils for pulsar package
|
Package pulsartestutil - test utils for pulsar package |