Documentation
¶
Index ¶
- type DummyOrderer
- func (do *DummyOrderer) CheckSig(data []byte, senderID int32, signature []byte) error
- func (do *DummyOrderer) HandleEntry(entry *log.Entry)
- func (do *DummyOrderer) HandleMessage(msg *pb.ProtocolMessage)
- func (do *DummyOrderer) Init(mngr manager.Manager)
- func (do *DummyOrderer) Sign(data []byte) ([]byte, error)
- func (do *DummyOrderer) Start(wg *sync.WaitGroup)
- type HotStuffOrderer
- func (ho *HotStuffOrderer) AssembleCert(data []byte, signatures [][]byte) ([]byte, error)
- func (ho *HotStuffOrderer) CheckCert(data []byte, signature []byte) error
- func (ho *HotStuffOrderer) CheckSig(data []byte, senderID int32, signature []byte) error
- func (ho *HotStuffOrderer) HandleEntry(entry *log.Entry)
- func (ho *HotStuffOrderer) HandleMessage(msg *pb.ProtocolMessage)
- func (ho *HotStuffOrderer) Init(mngr manager.Manager)
- func (ho *HotStuffOrderer) Sign(data []byte) ([]byte, error)
- func (ho *HotStuffOrderer) Start(wg *sync.WaitGroup)
- type Instance
- type Orderer
- type PbftOrderer
- func (ho *PbftOrderer) AssembleCert(data []byte, signatures [][]byte, ids [][]byte) ([]byte, error)
- func (ho *PbftOrderer) CheckCert(data []byte, signature []byte) error
- func (ho *PbftOrderer) CheckSig(data []byte, senderID int32, signature []byte) error
- func (ho *PbftOrderer) CheckSigShare(data []byte, k int32, signature []byte) error
- func (ho *PbftOrderer) CompareSig(sig1 []byte, sig2 []byte) bool
- func (ho *PbftOrderer) DesIdToString(id []byte) string
- func (po *PbftOrderer) HandleEntry(entry *log.Entry)
- func (po *PbftOrderer) HandleMessage(msg *pb.ProtocolMessage)
- func (po *PbftOrderer) Init(mngr manager.Manager)
- func (ho *PbftOrderer) Sign(data []byte) ([]byte, error)
- func (ho *PbftOrderer) SignWithKthKey(data []byte, k int32) ([]byte, []byte, error)
- func (po *PbftOrderer) Start(wg *sync.WaitGroup)
- type RaftOrderer
- func (ro *RaftOrderer) CheckSig(data []byte, senderID int32, signature []byte) error
- func (ro *RaftOrderer) HandleEntry(entry *log.Entry)
- func (ro *RaftOrderer) HandleMessage(msg *pb.ProtocolMessage)
- func (ro *RaftOrderer) Init(mngr manager.Manager)
- func (ro *RaftOrderer) Sign(data []byte) ([]byte, error)
- func (ro *RaftOrderer) Start(wg *sync.WaitGroup)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DummyOrderer ¶
type DummyOrderer struct {
// contains filtered or unexported fields
}
Represents a dummy Orderer implementation (a stub). For each sequence number in each Segment received from the Manager, the leader (defined to be the first node in the Segment's leader list, never changes) sends a single message with dummy data to the followers. A follower receiving such a message directly announces a log Entry with that data as the decision for that sequence number.
func (*DummyOrderer) CheckSig ¶
func (do *DummyOrderer) CheckSig(data []byte, senderID int32, signature []byte) error
func (*DummyOrderer) HandleEntry ¶
func (do *DummyOrderer) HandleEntry(entry *log.Entry)
func (*DummyOrderer) HandleMessage ¶
func (do *DummyOrderer) HandleMessage(msg *pb.ProtocolMessage)
This function is called by the messenger each time an Orderer-issued message is received over the network. DummyOrderer only knows one such message, through which the leader proposes a decision for a sequence number. DummyOrderer directly announces the contents of the message as the decision, removing the corresponding requests from the Bucket of pending requests.
func (*DummyOrderer) Init ¶
func (do *DummyOrderer) Init(mngr manager.Manager)
Initializes the DummyOrderer by subscribing to new segments issued by the Manager.
func (*DummyOrderer) Start ¶
func (do *DummyOrderer) Start(wg *sync.WaitGroup)
Starts the DummyOrderer. Listens on the channel where the Manager issues new Segemnts and starts a goroutine to handle each of them. Meant to be run as a separate goroutine. Decrements the provided wait group when done.
type HotStuffOrderer ¶
type HotStuffOrderer struct {
// contains filtered or unexported fields
}
Represents a HotStuff Orderer implementation.
func (*HotStuffOrderer) AssembleCert ¶
func (ho *HotStuffOrderer) AssembleCert(data []byte, signatures [][]byte) ([]byte, error)
AssembleCert combines validates signature shares in a threshold signature. A threshold signature form the quorum certificate.
func (*HotStuffOrderer) CheckCert ¶
func (ho *HotStuffOrderer) CheckCert(data []byte, signature []byte) error
CheckCert checks if the certificate is a valid threshold signature
func (*HotStuffOrderer) CheckSig ¶
func (ho *HotStuffOrderer) CheckSig(data []byte, senderID int32, signature []byte) error
CheckSig checks if a signature share is valid.
func (*HotStuffOrderer) HandleEntry ¶
func (ho *HotStuffOrderer) HandleEntry(entry *log.Entry)
func (*HotStuffOrderer) HandleMessage ¶
func (ho *HotStuffOrderer) HandleMessage(msg *pb.ProtocolMessage)
HandleMessage is called by the messenger each time an Orderer-issued message is received over the network.
func (*HotStuffOrderer) Init ¶
func (ho *HotStuffOrderer) Init(mngr manager.Manager)
func (*HotStuffOrderer) Sign ¶
func (ho *HotStuffOrderer) Sign(data []byte) ([]byte, error)
Sign generates a signature share.
func (*HotStuffOrderer) Start ¶
func (ho *HotStuffOrderer) Start(wg *sync.WaitGroup)
Starts the HotStuff orderer. Listens on the channel where the Manager issues new Segemnts and starts a goroutine to handle each of them. Meant to be run as a separate goroutine. Decrements the provided wait group when done.
type Orderer ¶
type Orderer interface { // Initializes the orderer. // Attaches a Manager to the Orderer. All the Segments that are created by the Manager and in which this node is // involved (as a leader, as a follower, or both) will be handled by this Orderer. // Init() must be called before the Manager is started, so the Orderer does not miss any segments. // Init() must be called before Strat() is called. // After Init() returns, the Orderer mus be ready to process incoming messages, but must not send any itself // (sending messages only can start after the call to Start()). Init(manager manager.Manager) // Message handler function. To be assigned to the messenger.OrdererMsgHandler variable, which the messenger calls // on reception of a message belonging to the ordering subprotocol. HandleMessage(message *pb.ProtocolMessage) // Must be called when an entry is being inserted to the log otherwise than by the orderer itself, // e.g. by the state transfer protocol. HandleEntry(entry *log.Entry) // Satrts the Orderer. Meant to be run as a separate goroutine. Decrements the passed wait group on termination. // Before starting the Orderer, it must be attached to the Manager and its message handler must be registered with // the messanger. Start(group *sync.WaitGroup) // Signs the data with the private key (share) of the orderer. Sign(data []byte) ([]byte, error) // Verifies that the signature on the (unhashed) data with public key of the sender is correct. // SenderID must correspond to an orderer, whose key is known in system's membership config. CheckSig(data []byte, senderID int32, signature []byte) error }
The Orderer is responsible for ordering log Entries, i.e., creating the mapping between Entries and sequence numbers. It receives Segments (representing parts of the log) from the Manager and "fills" these parts of the log with Entries. The Orderer can process multiple Segments in parallel, executing multiple instances of an ordering protocol (or even different protocols) - one for each Segment. When a (final and irreversible) assignment of an Entry to a sequence number is made by the ordering protocol, the protocol calls announcer.Announce() to announce the decision.
type PbftOrderer ¶
type PbftOrderer struct {
// contains filtered or unexported fields
}
Represents a PBFT Orderer implementation.
func (*PbftOrderer) AssembleCert ¶
AssembleCert combines validates signature shares in a threshold signature. A threshold signature form the quorum certificate.
func (*PbftOrderer) CheckCert ¶
func (ho *PbftOrderer) CheckCert(data []byte, signature []byte) error
CheckCert checks if the certificate is a valid threshold signature
func (*PbftOrderer) CheckSig ¶
func (ho *PbftOrderer) CheckSig(data []byte, senderID int32, signature []byte) error
CheckSig checks if a signature share is valid.
func (*PbftOrderer) CheckSigShare ¶
func (ho *PbftOrderer) CheckSigShare(data []byte, k int32, signature []byte) error
CheckSigShare checks if a signature share is valid.
func (*PbftOrderer) CompareSig ¶
func (ho *PbftOrderer) CompareSig(sig1 []byte, sig2 []byte) bool
func (*PbftOrderer) DesIdToString ¶
func (ho *PbftOrderer) DesIdToString(id []byte) string
func (*PbftOrderer) HandleEntry ¶
func (po *PbftOrderer) HandleEntry(entry *log.Entry)
Handles entries produced externally.
func (*PbftOrderer) HandleMessage ¶
func (po *PbftOrderer) HandleMessage(msg *pb.ProtocolMessage)
HandleMessage is called by the messenger each time an Orderer-issued message is received over the network.
func (*PbftOrderer) Init ¶
func (po *PbftOrderer) Init(mngr manager.Manager)
Initializes the PbftOrderer. Subscribes to new segments issued by the Manager and allocates internal buffers and data structures.
func (*PbftOrderer) Sign ¶
func (ho *PbftOrderer) Sign(data []byte) ([]byte, error)
Sign generates a signature share. k represent the k th private key the peer use.
func (*PbftOrderer) SignWithKthKey ¶
Sign generates a signature share. k represent the k th private key the peer use.
func (*PbftOrderer) Start ¶
func (po *PbftOrderer) Start(wg *sync.WaitGroup)
Starts the PbftOrderer. Listens on the channel where the Manager issues new Segemnts and starts a goroutine to handle each of them. Meant to be run as a separate goroutine. Decrements the provided wait group when done.
type RaftOrderer ¶
type RaftOrderer struct {
// contains filtered or unexported fields
}
func (*RaftOrderer) CheckSig ¶
func (ro *RaftOrderer) CheckSig(data []byte, senderID int32, signature []byte) error
func (*RaftOrderer) HandleEntry ¶
func (ro *RaftOrderer) HandleEntry(entry *log.Entry)
func (*RaftOrderer) HandleMessage ¶
func (ro *RaftOrderer) HandleMessage(msg *pb.ProtocolMessage)
HandleMessage is called by the messenger each time an Orderer-issued message is received over the network.
func (*RaftOrderer) Init ¶
func (ro *RaftOrderer) Init(mngr manager.Manager)
Init initializes the Raft orderer. Subscribes to new segments issued by the Manager and allocates internal buffers and data structures.
func (*RaftOrderer) Start ¶
func (ro *RaftOrderer) Start(wg *sync.WaitGroup)
Start starts the Raft orderer. Listens on the channel where the Manager issues new segments and starts a goroutine to handle each of them. Meant to be run as a separate goroutine. Decrements the provided wait group when done.