Documentation
¶
Index ¶
- func NewPulse(numberDelta uint32, previousPulseNumber core.PulseNumber, ...) *core.Pulse
- type BftCell
- type EntropyGenerator
- type EntropyPayload
- type EntropySignaturePayload
- type GetLastPulsePayload
- type Handler
- func (handler *Handler) GetLastPulseNumber(request *Payload, response *Payload) error
- 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) ReceiveSignatureForEntropy(request *Payload, response *Payload) error
- func (handler *Handler) ReceiveVector(request *Payload, response *Payload) error
- type HandshakePayload
- type Neighbour
- type Payload
- type Pulsar
- func (pulsar *Pulsar) BroadcastEntropy()
- func (pulsar *Pulsar) BroadcastSignatureOfEntropy()
- func (pulsar *Pulsar) BroadcastVector()
- func (pulsar *Pulsar) EstablishConnection(pubKey string) error
- func (pulsar *Pulsar) RefreshConnections()
- func (pulsar *Pulsar) StartConsensusProcess(pulseNumber core.PulseNumber) error
- func (pulsar *Pulsar) StartServer()
- func (pulsar *Pulsar) StopServer()
- func (pulsar *Pulsar) SyncLastPulseWithNeighbour(neighbour *Neighbour) (*core.Pulse, error)
- 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) SetRPCClient(client *rpc.Client)
- func (impl *RPCClientWrapperImpl) Unlock()
- type RequestType
- type SenderConfirmationPayload
- type StandardEntropyGenerator
- type State
- type VectorPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPulse ¶
func NewPulse(numberDelta uint32, previousPulseNumber core.PulseNumber, entropyGenerator EntropyGenerator) *core.Pulse
NewPulse creates a new pulse with using of custom GeneratedEntropy Generator
Types ¶
type EntropyGenerator ¶
type EntropyPayload ¶ added in v0.4.0
type EntropyPayload struct {
PulseNumber core.PulseNumber
Entropy core.Entropy
}
type EntropySignaturePayload ¶ added in v0.4.0
type EntropySignaturePayload struct {
PulseNumber core.PulseNumber
Signature []byte
}
type GetLastPulsePayload ¶ added in v0.4.0
type Handler ¶ added in v0.3.0
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) GetLastPulseNumber ¶ added in v0.4.0
func (*Handler) HealthCheck ¶ added in v0.4.0
func (*Handler) MakeHandshake ¶ added in v0.3.0
func (*Handler) ReceiveChosenSignature ¶ added in v0.4.0
func (*Handler) ReceiveEntropy ¶ added in v0.4.0
func (*Handler) ReceiveSignatureForEntropy ¶ added in v0.4.0
type HandshakePayload ¶ added in v0.3.0
type Neighbour ¶ added in v0.3.0
type Neighbour struct {
ConnectionType configuration.ConnectionType
ConnectionAddress string
OutgoingClient RPCClientWrapper
PublicKey *ecdsa.PublicKey
}
Helper for functionality of connection to another pulsar
func (*Neighbour) CheckAndRefreshConnection ¶ added in v0.4.0
Check connection error, write it to the log and try to refresh connection
type Pulsar ¶
type Pulsar struct {
Sock net.Listener
SockConnectionType configuration.ConnectionType
RPCServer *rpc.Server
Neighbours map[string]*Neighbour
PrivateKey *ecdsa.PrivateKey
Config configuration.Pulsar
Storage pulsarstorage.PulsarStorage
EntropyGenerator EntropyGenerator
State State
EntropyGenerationLock sync.Mutex
GeneratedEntropy core.Entropy
GeneratedEntropySign []byte
EntropyForNodes core.Entropy
PulseSenderToNodes string
SignsConfirmedSending map[string]core.PulseSenderConfirmation
ProcessingPulseNumber core.PulseNumber
LastPulse *core.Pulse
OwnedBftRow map[string]*BftCell
BftGrid map[string]map[string]*BftCell
}
Base pulsar's struct
func NewPulsar ¶
func NewPulsar( configuration configuration.Pulsar, storage pulsarstorage.PulsarStorage, rpcWrapperFactory RPCClientWrapperFactory, entropyGenerator EntropyGenerator, listener func(string, string) (net.Listener, error)) (*Pulsar, error)
NewPulse creates a new pulse with using of custom GeneratedEntropy Generator
func (*Pulsar) BroadcastEntropy ¶ added in v0.4.0
func (pulsar *Pulsar) BroadcastEntropy()
func (*Pulsar) BroadcastSignatureOfEntropy ¶ added in v0.4.0
func (pulsar *Pulsar) BroadcastSignatureOfEntropy()
func (*Pulsar) BroadcastVector ¶ added in v0.4.0
func (pulsar *Pulsar) BroadcastVector()
func (*Pulsar) EstablishConnection ¶ added in v0.3.0
func (*Pulsar) RefreshConnections ¶ added in v0.4.0
func (pulsar *Pulsar) RefreshConnections()
func (*Pulsar) StartConsensusProcess ¶ added in v0.4.0
func (pulsar *Pulsar) StartConsensusProcess(pulseNumber core.PulseNumber) error
func (*Pulsar) StartServer ¶ added in v0.4.0
func (pulsar *Pulsar) StartServer()
StartServer starts listening of the rpc-server
func (*Pulsar) StopServer ¶ added in v0.4.0
func (pulsar *Pulsar) StopServer()
StopServer stops listening of the rpc-server
type RPCClientWrapper ¶ added in v0.4.0
type RPCClientWrapper interface {
// Take current neighbour's lock
Lock()
// Release current neighbour's lock
Unlock()
// Check if client initialised
IsInitialised() bool
// Set wrapper's undercover rpc client
SetRPCClient(client *rpc.Client)
// Create connection and reinit client
CreateConnection(connectionType configuration.ConnectionType, connectionAddress string) error
// Close wrapped client
Close() error
// Make rpc call in async-style
Go(serviceMethod string, args interface{}, reply interface{}, done chan *rpc.Call) *rpc.Call
}
Interface for wrappers around rpc clients
type RPCClientWrapperFactory ¶ added in v0.4.0
type RPCClientWrapperFactory interface {
CreateWrapper() RPCClientWrapper
}
Interface for factory of rpc wrappers Needed for creation wrappers objects
type RPCClientWrapperFactoryImpl ¶ added in v0.4.0
type RPCClientWrapperFactoryImpl struct {
}
Standard factory implementation Returns RPCClientWrapperImpl
func (RPCClientWrapperFactoryImpl) CreateWrapper ¶ added in v0.4.0
func (RPCClientWrapperFactoryImpl) CreateWrapper() RPCClientWrapper
Standard factory implementation Returns RPCClientWrapperImpl
type RPCClientWrapperImpl ¶ added in v0.4.0
Base RPCClientWrapper impl for rpc.Client
func (*RPCClientWrapperImpl) Close ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) Close() error
Close wrapped client
func (*RPCClientWrapperImpl) CreateConnection ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) CreateConnection(connectionType configuration.ConnectionType, connectionAddress string) error
Create base rpc connection
func (*RPCClientWrapperImpl) Go ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) Go(serviceMethod string, args interface{}, reply interface{}, done chan *rpc.Call) *rpc.Call
Make a call in async style, with done channel as async-marker
func (*RPCClientWrapperImpl) IsInitialised ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) IsInitialised() bool
func (*RPCClientWrapperImpl) Lock ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) Lock()
Take current neighbour's lock
func (*RPCClientWrapperImpl) SetRPCClient ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) SetRPCClient(client *rpc.Client)
Set wrapper's undercover rpc client
func (*RPCClientWrapperImpl) Unlock ¶ added in v0.4.0
func (impl *RPCClientWrapperImpl) Unlock()
Release current neighbour's lock
type RequestType ¶ added in v0.3.0
type RequestType string
const ( HealthCheck RequestType = "Pulsar.HealthCheck" Handshake RequestType = "Pulsar.MakeHandshake" GetLastPulseNumber RequestType = "Pulsar.SyncLastPulseWithNeighbour" ReceiveSignatureForEntropy RequestType = "Pulsar.ReceiveSignatureForEntropy" ReceiveEntropy RequestType = "Pulsar.ReceiveEntropy" ReceiveVector RequestType = "Pulsar.ReceiveVector" ReceiveChosenSignature RequestType = "Pulsar.ReceiveChosenSignature" )
func (RequestType) String ¶ added in v0.3.0
func (state RequestType) String() string
type SenderConfirmationPayload ¶ added in v0.4.0
type SenderConfirmationPayload struct {
PulseNumber core.PulseNumber
Signature []byte
ChosenPublicKey string
}
type StandardEntropyGenerator ¶
type StandardEntropyGenerator struct {
}
func (*StandardEntropyGenerator) GenerateEntropy ¶
func (generator *StandardEntropyGenerator) GenerateEntropy() core.Entropy
type VectorPayload ¶ added in v0.4.0
type VectorPayload struct {
PulseNumber core.PulseNumber
Vector map[string]*BftCell
}