Documentation
¶
Index ¶
- Variables
- type App
- func (a *App) AssembleProposal(metadata []byte, requests [][]byte) types.Proposal
- func (a *App) AuxiliaryData(msg []byte) []byte
- func (a *App) ClearMutateSend(target uint64)
- func (a *App) Connect()
- func (a *App) ConnectTo(target uint64)
- func (a *App) DelaySync(c <-chan struct{})
- func (a *App) Deliver(proposal types.Proposal, signatures []types.Signature) types.Reconfig
- func (a *App) Disconnect()
- func (a *App) DisconnectFrom(target uint64)
- func (a *App) LoseMessages(filter func(*smartbftprotos.Message) bool)
- func (a *App) MembershipChange() bool
- func (a *App) MutateSend(target uint64, mutating func(uint64, *smartbftprotos.Message))
- func (a *App) Mute()
- func (a *App) RequestID(req []byte) types.RequestInfo
- func (a *App) RequestsFromProposal(proposal types.Proposal) []types.RequestInfo
- func (a *App) Restart()
- func (a *App) RestartSync(sync bool)
- func (a *App) Sign([]byte) []byte
- func (a *App) SignProposal(_ types.Proposal, aux []byte) *types.Signature
- func (a *App) Submit(req Request)
- func (a *App) Sync() types.SyncResponse
- func (a *App) UnMute()
- func (a *App) VerificationSequence() uint64
- func (a *App) VerifyConsenterSig(signature types.Signature, _ types.Proposal) ([]byte, error)
- func (a *App) VerifyProposal(proposal types.Proposal) ([]types.RequestInfo, error)
- func (a *App) VerifyRequest(val []byte) (types.RequestInfo, error)
- func (a *App) VerifySignature(_ types.Signature) error
- type AppRecord
- type Configuration
- type FwdMessage
- type Network
- type Node
- type Reconfig
- type Request
Constants ¶
This section is empty.
Variables ¶
var File_test_test_messages_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
ID uint64
Delivered chan *AppRecord
Consensus *consensus.Consensus
Setup func()
Node *Node
// contains filtered or unexported fields
}
App implements all interfaces required by an application using this library
func (*App) AssembleProposal ¶
AssembleProposal assembles a new proposal from the given requests
func (*App) AuxiliaryData ¶
func (*App) ClearMutateSend ¶
ClearMutateSend clears any mutating function called before sending a message to the target node
func (*App) Disconnect ¶
func (a *App) Disconnect()
Disconnect disconnects the node from the network
func (*App) DisconnectFrom ¶
DisconnectFrom disconnects the node from a specific node
func (*App) LoseMessages ¶
func (a *App) LoseMessages(filter func(*smartbftprotos.Message) bool)
func (*App) MembershipChange ¶
func (*App) MutateSend ¶
func (a *App) MutateSend(target uint64, mutating func(uint64, *smartbftprotos.Message))
MutateSend set the mutating function to be called before sending a message to the target node
func (*App) RequestID ¶
func (a *App) RequestID(req []byte) types.RequestInfo
RequestID returns info about the given request
func (*App) RequestsFromProposal ¶
func (a *App) RequestsFromProposal(proposal types.Proposal) []types.RequestInfo
RequestsFromProposal returns from the given proposal the included requests' info
func (*App) RestartSync ¶
func (*App) SignProposal ¶
SignProposal signs on the given proposal
func (*App) Sync ¶
func (a *App) Sync() types.SyncResponse
Sync synchronizes and returns the latest decision
func (*App) VerificationSequence ¶
VerificationSequence returns the current verification sequence
func (*App) VerifyConsenterSig ¶
VerifyConsenterSig verifies a nodes signature on the given proposal
func (*App) VerifyProposal ¶
VerifyProposal verifies the given proposal and returns the included requests
func (*App) VerifyRequest ¶
func (a *App) VerifyRequest(val []byte) (types.RequestInfo, error)
VerifyRequest verifies the given request and returns its info
type AppRecord ¶
type AppRecord struct {
Batch *batch
Metadata []byte
}
AppRecord represents a committed batch and metadata
type Configuration ¶
type Configuration struct {
// SelfID is added by the application
RequestBatchMaxCount int64
RequestBatchMaxBytes int64
RequestBatchMaxInterval time.Duration
IncomingMessageBufferSize int64
RequestPoolSize int64
RequestForwardTimeout time.Duration
RequestComplainTimeout time.Duration
RequestAutoRemoveTimeout time.Duration
ViewChangeResendInterval time.Duration
ViewChangeTimeout time.Duration
LeaderHeartbeatTimeout time.Duration
LeaderHeartbeatCount int64
NumOfTicksBehindBeforeSyncing int64
CollectTimeout time.Duration
SyncOnStart bool
SpeedUpViewChange bool
LeaderRotation bool
DecisionsPerLeader int64
RequestMaxBytes int64
RequestPoolSubmitTimeout time.Duration
}
type FwdMessage ¶
type FwdMessage struct {
Sender uint64 `protobuf:"varint,1,opt,name=sender,proto3" json:"sender,omitempty"`
Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
// contains filtered or unexported fields
}
func (*FwdMessage) Descriptor
deprecated
func (*FwdMessage) Descriptor() ([]byte, []int)
Deprecated: Use FwdMessage.ProtoReflect.Descriptor instead.
func (*FwdMessage) GetPayload ¶
func (x *FwdMessage) GetPayload() []byte
func (*FwdMessage) GetSender ¶
func (x *FwdMessage) GetSender() uint64
func (*FwdMessage) ProtoMessage ¶
func (*FwdMessage) ProtoMessage()
func (*FwdMessage) ProtoReflect ¶
func (x *FwdMessage) ProtoReflect() protoreflect.Message
func (*FwdMessage) Reset ¶
func (x *FwdMessage) Reset()
func (*FwdMessage) String ¶
func (x *FwdMessage) String() string
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network is a map of ids and nodes
func NewNetwork ¶
func NewNetwork() *Network
func (*Network) AddOrUpdateNode ¶
AddOrUpdateNode adds or updates a node in the network
func (*Network) StartServe ¶
func (n *Network) StartServe()
StartServe calls serve on all nodes in the network
type Node ¶
Node represents a node in a network
func (*Node) SendConsensus ¶
func (node *Node) SendConsensus(targetID uint64, m *smartbftprotos.Message)
SendConsensus sends a consensus related message to a target node
func (*Node) SendTransaction ¶
SendTransaction sends a client's request to a target node
type Reconfig ¶
type Reconfig struct {
InLatestDecision bool
CurrentNodes []int64
CurrentConfig Configuration
}