diff --git a/grpc-testtool/proto/merkle/merkle.proto b/grpc-testtool/proto/merkle/merkle.proto index 7519288c7..94261d3ea 100644 --- a/grpc-testtool/proto/merkle/merkle.proto +++ b/grpc-testtool/proto/merkle/merkle.proto @@ -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; } @@ -55,27 +58,42 @@ 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. @@ -83,20 +101,3 @@ 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; -}