Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canceller ¶
type Canceller interface {
Cancel()
}
Canceller allows cancelling of a scheduled timer event.
type Receiver ¶
type Receiver interface { Receive(msg *sb.Msg, src uint64) Request(req []byte) Connection(replica uint64) GetChainId() string }
Receiver defines the API that is exposed by SBFT to the system.
type SBFT ¶
type SBFT struct {
// contains filtered or unexported fields
}
SBFT is a simplified PBFT implementation.
func New ¶
func New(id uint64, chainID string, support consensus.ConsenterSupport, config *sb.Options, sys System) (*SBFT, error)
New creates a new SBFT instance.
func (*SBFT) Connection ¶
Connection is an event from system to notify a new connection with replica. On connection, we send our latest (weak) checkpoint, and we expect to receive one from replica.
func (*SBFT) GetChainId ¶
type System ¶
type System interface { Send(chainId string, msg *sb.Msg, dest uint64) Timer(d time.Duration, f func()) Canceller Deliver(chainId string, batch *sb.Batch) AddReceiver(chainId string, receiver Receiver) Persist(chainId string, key string, data proto.Message) Restore(chainId string, key string, out proto.Message) bool LastBatch(chainId string) *sb.Batch Sign(data []byte) []byte CheckSig(data []byte, src uint64, sig []byte) error Reconnect(chainId string, replica uint64) Validate(chainID string, req *sb.Request) ([][]*sb.Request, bool) Cut(chainID string) []*sb.Request }
System defines the API that needs to be provided for SBFT.
Click to show internal directories.
Click to hide internal directories.