Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
messages/protobuf: Add documentation comments
Browse files Browse the repository at this point in the history
Signed-off-by: Sergey Fedorov <sergey.fedorov@neclab.eu>
  • Loading branch information
Sergey Fedorov committed Jan 3, 2020
1 parent 547b7e3 commit 97045db
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 28 deletions.
3 changes: 3 additions & 0 deletions messages/protobuf/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package protobuf implements protocol message interface using
// Protocol Buffers as serialization mechanism.
package protobuf

import (
Expand All @@ -24,6 +26,7 @@ import (

type impl struct{}

// NewImpl returns the package's implementation of protocol messages.
func NewImpl() messages.MessageImpl {
return &impl{}
}
Expand Down
48 changes: 36 additions & 12 deletions messages/protobuf/pb/messages.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 51 additions & 16 deletions messages/protobuf/pb/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

syntax = "proto3";

// Package pb defines MinBFT protocol messages in Protobuf format.
package pb;

// MessageType represents message type tag.
enum MessageType {
UNKNOWN = 0;
REQUEST = 1;
Expand All @@ -27,6 +29,7 @@ enum MessageType {
COMMIT = 4;
}

// Message represents arbitrary protocol message.
message Message{
oneof typed {
Request request = 1;
Expand All @@ -36,30 +39,62 @@ message Message{
}
}

// Request represents REQUEST message.
message Request {
uint32 client_id = 1; // c: client id
uint64 seq = 2; // seq: request sequence per client
bytes operation = 3; // op: operation payload
bytes signature = 4; // client signature
// Client identifier
uint32 client_id = 1;

// Request identifier (timestamp / sequence number)
uint64 seq = 2;

// Operation to execute on replicated state machine
bytes operation = 3;

// Client's signature
bytes signature = 4;
}

// Reply represents REPLY message.
message Reply {
uint32 replica_id = 1; // s: replica id
uint32 client_id = 2; // c: client id
uint64 seq = 3; // seq: corresponding request sequence
bytes result = 4; // res: result
bytes signature = 5; // replica's signature
// Replica identifier
uint32 replica_id = 1;

// Client identifier
uint32 client_id = 2;

// Request identifier
uint64 seq = 3;

// Result of requested operation execution
bytes result = 4;

// Replica's signature
bytes signature = 5;
}

// Prepare represents PREPARE message.
message Prepare {
uint32 replica_id = 1; // s_i: replica id
uint64 view = 2; // v: view
Request request = 3; // m: request message
bytes ui = 4; // UI_i: replica UI
// Replica identifier
uint32 replica_id = 1;

// View number
uint64 view = 2;

// Client's REQUEST
Request request = 3;

// Replica's UI
bytes ui = 4;
}

// Commit represents COMMIT message.
message Commit {
uint32 replica_id = 1; // s_j: replica id
Prepare prepare = 2; // prepare message
bytes ui = 3; // UI_j: replica UI
// Replica identifier
uint32 replica_id = 1;

// Primary's PREPARE
Prepare prepare = 2;

// Replica's UI
bytes ui = 3;
}

0 comments on commit 97045db

Please sign in to comment.