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 PayloadData
- type Pulsar
- func (currentPulsar *Pulsar) AddItemToVector(pubKey string, cell *BftCell)
- func (currentPulsar *Pulsar) CheckConnectionsToPulsars(ctx context.Context)
- func (currentPulsar *Pulsar) ClearVector()
- func (currentPulsar *Pulsar) CreateVectorCopy() map[string]*BftCell
- func (currentPulsar *Pulsar) EstablishConnectionToPulsar(ctx context.Context, pubKey string) error
- func (currentPulsar *Pulsar) FetchNeighbour(pubKey string) (*Neighbour, error)
- func (currentPulsar *Pulsar) GetBftGridItem(row string, column string) *BftCell
- func (currentPulsar *Pulsar) GetCurrentSlotEntropy() *core.Entropy
- func (currentPulsar *Pulsar) GetGeneratedEntropy() *core.Entropy
- func (currentPulsar *Pulsar) GetItemFromVector(pubKey string) (*BftCell, bool)
- func (currentPulsar *Pulsar) GetLastPulse() *core.Pulse
- func (currentPulsar *Pulsar) IsStateFailed() bool
- func (currentPulsar *Pulsar) SetBftGridItem(key string, value map[string]*BftCell)
- func (currentPulsar *Pulsar) SetCurrentSlotEntropy(currentSlotEntropy *core.Entropy)
- func (currentPulsar *Pulsar) SetGeneratedEntropy(currentSlotEntropy *core.Entropy)
- func (currentPulsar *Pulsar) SetLastPulse(newPulse *core.Pulse)
- func (currentPulsar *Pulsar) StartConsensusProcess(ctx context.Context, pulseNumber core.PulseNumber) error
- func (currentPulsar *Pulsar) StartServer(ctx context.Context)
- func (currentPulsar *Pulsar) StopServer(ctx context.Context)
- type PulsePayload
- type PulseSenderConfirmationPayload
- 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 EntropySignature []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 NewHandler ¶ added in v0.7.5
NewHandler is a constructor of Handler
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 crypto.PublicKey }
Neighbour is a helper struct, which contains info about pulsar-neighbour
type Payload ¶ added in v0.3.0
type Payload struct { PublicKey string Signature []byte Body PayloadData }
Payload is a base struct for pulsar's rpc-message
type PayloadData ¶ added in v0.7.5
PayloadData is a body of Payload
type Pulsar ¶
type Pulsar struct { ID string Sock net.Listener SockConnectionType configuration.ConnectionType RPCServer *rpc.Server Neighbours map[string]*Neighbour PublicKey crypto.PublicKey PublicKeyRaw string Config configuration.Pulsar Storage pulsarstorage.PulsarStorage EntropyGenerator entropygenerator.EntropyGenerator StartProcessLock sync.Mutex GeneratedEntropySign []byte CurrentSlotPulseSender string CurrentSlotSenderConfirmations map[string]core.PulseSenderConfirmation ProcessingPulseNumber core.PulseNumber BftGridLock sync.RWMutex StateSwitcher StateSwitcher Certificate certificate.Certificate CryptographyService core.CryptographyService PlatformCryptographyScheme core.PlatformCryptographyScheme KeyProcessor core.KeyProcessor PulseDistributor core.PulseDistributor // 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, cryptographyService core.CryptographyService, scheme core.PlatformCryptographyScheme, keyProcessor core.KeyProcessor, pulseDistributor core.PulseDistributor, storage pulsarstorage.PulsarStorage, rpcWrapperFactory RPCClientWrapperFactory, entropyGenerator entropygenerator.EntropyGenerator, stateSwitcher StateSwitcher, listener func(string, string) (net.Listener, error)) (*Pulsar, error)
NewPulsar creates a new pulse with using of custom GeneratedEntropy Generator
func (*Pulsar) AddItemToVector ¶ added in v0.7.5
func (*Pulsar) CheckConnectionsToPulsars ¶ added in v0.5.0
CheckConnectionsToPulsars is a method refreshing connections between pulsars
func (*Pulsar) ClearVector ¶ added in v0.7.5
func (currentPulsar *Pulsar) ClearVector()
func (*Pulsar) CreateVectorCopy ¶ added in v0.7.5
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) GetCurrentSlotEntropy ¶ added in v0.6.3
GetCurrentSlotEntropy returns currentSlotEntropy in the thread-safe mode
func (*Pulsar) GetGeneratedEntropy ¶ added in v0.6.3
GetGeneratedEntropy returns generatedEntropy in the thread-safe mode
func (*Pulsar) GetItemFromVector ¶ added in v0.7.5
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) SetCurrentSlotEntropy ¶ added in v0.6.3
SetCurrentSlotEntropy sets currentSlotEntropy in the thread-safe mode
func (*Pulsar) SetGeneratedEntropy ¶ added in v0.6.3
SetGeneratedEntropy sets generatedEntropy in the thread-safe mode
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(ctx context.Context, pulseNumber core.PulseNumber) error
StartConsensusProcess starts process of calculating consensus between pulsars
func (*Pulsar) StartServer ¶ added in v0.4.0
StartServer starts listening of the rpc-server
func (*Pulsar) StopServer ¶ added in v0.4.0
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 PulseSenderConfirmationPayload ¶ added in v0.7.5
type PulseSenderConfirmationPayload struct {
core.PulseSenderConfirmation
}
PulseSenderConfirmationPayload is a struct with info about pulse's confirmations
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 State ¶ added in v0.4.0
type State int
const ( // Failed means that current iteration is broken Failed State = iota // WaitingForStart means that state machine is waiting for the start WaitingForStart // GenerateEntropy means that state machine is generating entropy for a current slot GenerateEntropy // WaitingForEntropySigns means that state machine is waiting for other pulsars' signs of entropy WaitingForEntropySigns // SendingEntropy means that state machine is sending entropy to other pulsars SendingEntropy // WaitingForEntropy means that state machine is waiting for the entropy for other pulsars WaitingForEntropy // SendingVector means that state machine is sending verctor to other pulsars SendingVector // WaitingForVectors means that state machine is waiting for other pulsars' vectors WaitingForVectors // Verifying means that state machine is verifying bft-table Verifying // SendingPulseSign means that state machine is sending sign to chosen pulsar SendingPulseSign // WaitingForPulseSigns means that state machine is waiting for signs to chosen pulsar WaitingForPulseSigns // SendingPulseSign means that state machine is sending pulse to network SendingPulse )
type StateSwitcher ¶ added in v0.5.0
type StateSwitcher interface { SwitchToState(ctx context.Context, 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(ctx context.Context, state State, args interface{})
SwitchToState switches the state-machine to another step
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 |