Skip to content

Commit

Permalink
update merkle proto definition (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Laine authored Feb 20, 2024
1 parent c1a0bd3 commit b3f6e28
Showing 1 changed file with 42 additions and 41 deletions.
83 changes: 42 additions & 41 deletions grpc-testtool/proto/merkle/merkle.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,52 @@ package merkle;

import "google/protobuf/empty.proto";

// Methods on this service return status code NOT_FOUND if a requested
// view, iterator or root hash is not found.
service Merkle {
rpc NewProposal(NewProposalRequest) returns (NewProposalResponse);
rpc ProposalCommit(ProposalCommitRequest) returns (ProposalCommitResponse);
rpc NewProposal(NewProposalRequest) returns (NewProposalResponse);
rpc ProposalCommit(ProposalCommitRequest) returns (google.protobuf.Empty);

rpc NewView(NewViewRequest) returns (NewViewResponse);
// The methods below may be called with a view ID that corresponds to either a (committable) proposal
// or (non-committable) historical view.
rpc ViewHas(ViewHasRequest) returns (ViewHasResponse);
rpc ViewGet(ViewGetRequest) returns (ViewGetResponse);
rpc ViewNewIteratorWithStartAndPrefix(ViewNewIteratorWithStartAndPrefixRequest) returns (ViewNewIteratorWithStartAndPrefixResponse);
rpc ViewRelease(ViewReleaseRequest) returns (google.protobuf.Empty);
rpc NewView(NewViewRequest) returns (NewViewResponse);
// The methods below may be called with an ID that corresponds to either a (committable) proposal
// or (non-committable) historical view.
rpc ViewHas(ViewHasRequest) returns (ViewHasResponse);
rpc ViewGet(ViewGetRequest) returns (ViewGetResponse);
rpc ViewNewIteratorWithStartAndPrefix(ViewNewIteratorWithStartAndPrefixRequest) returns (ViewNewIteratorWithStartAndPrefixResponse);
// Returns status code NOT_FOUND when the iterator is done.
rpc IteratorNext(IteratorNextRequest) returns (IteratorNextResponse);
rpc IteratorError(IteratorErrorRequest) returns (google.protobuf.Empty);
// Iterator can't be used (even to check error) after release.
rpc IteratorRelease(IteratorReleaseRequest) returns (google.protobuf.Empty);
rpc ViewRelease(ViewReleaseRequest) returns (google.protobuf.Empty);
}

message NewProposalRequest {
// If not given, the parent view is the current database revision.
optional uint32 parent_view_id = 1;
optional uint32 parent_id = 1;
repeated PutRequest puts = 2;
// The keys being deleted.
repeated bytes deletes = 3;
}

message NewProposalResponse {
uint32 proposal_id = 1;
uint32 id = 1;
}

message ProposalCommitRequest {
uint32 proposal_id = 1;
}

message ProposalCommitResponse {
CommitError err = 1;
uint32 id = 1;
}

message NewViewRequest {
bytes root_id = 1;
bytes root_hash = 1;
}

message NewViewResponse {
uint32 view_id = 1;
uint32 id = 1;
}

message ViewHasRequest {
uint32 view_id = 1;
uint32 id = 1;
bytes key = 2;
}

Expand All @@ -55,48 +58,46 @@ message ViewHasResponse {
}

message ViewGetRequest {
uint32 view_id = 1;
uint32 id = 1;
bytes key = 2;
}

message ViewGetResponse {
bytes value = 1;
GetError err = 2;
}

message ViewNewIteratorWithStartAndPrefixRequest {
uint32 view_id = 1;
uint32 id = 1;
bytes start = 2;
bytes prefix = 3;
}

message ViewNewIteratorWithStartAndPrefixResponse {
uint32 iterator_id = 1;
uint32 id = 1;
}

message IteratorNextRequest {
uint32 id = 1;
}

message IteratorNextResponse {
PutRequest data = 1;
}

message IteratorErrorRequest {
uint32 id = 1;
}

message IteratorReleaseRequest {
uint32 id = 1;
}

message ViewReleaseRequest {
uint32 view_id = 1;
uint32 id = 1;
}

// TODO import this from the rpcdb package.
message PutRequest {
bytes key = 1;
bytes value = 2;
}

enum GetError {
// ERROR_UNSPECIFIED_GET is used to indicate that no error occurred.
ERROR_UNSPECIFIED_GET = 0;
ERROR_CLOSED_GET = 1;
ERROR_NOT_FOUND = 2;
}

enum CommitError {
// ERROR_UNSPECIFIED_COMMIT is used to indicate that no error occurred.
ERROR_UNSPECIFIED_COMMIT = 0;
ERROR_CLOSED_COMMIT = 1;
ERROR_INVALID = 2;
ERROR_COMMITTED = 3;
ERROR_PARENT_NOT_DATABASE = 4;
ERROR_NON_PROPOSAL_ID = 5;
}

0 comments on commit b3f6e28

Please sign in to comment.