Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc/proto changes for GetByIndex #355

Merged
merged 9 commits into from
Feb 3, 2021
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog


## Unreleased

### Breaking Changes
- [\#355](https://github.com/cosmos/iavl/pull/355) `Get` in `iavlServer` no longer returns an error if the requested key does not exist. `GetResponse` now contains a `NotFound` boolean to indicate that a key does not exist, and the returned index will be that of the next occupied key.

### Improvements
- [\#355](https://github.com/cosmos/iavl/pull/355) Add support for `GetByIndex` to `iavlServer`

## 0.15.3 (December 21, 2020)

Special thanks to external contributors on this release: @odeke-em
Expand Down
21 changes: 20 additions & 1 deletion proto/iavl/iavl_api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,23 @@ service IAVLService {
};
}

// Get returns a result containing the IAVL tree version and value for a given
// Get returns a result containing the index and value for a given
// key based on the current state (version) of the tree.
// If the key does not exist, Get returns the index of the next value.
rpc Get(GetRequest) returns (GetResponse) {
option (google.api.http) = {
get: "/v1/get"
};
}

// GetByIndex returns a result containing the key and value for a given
// index based on the current state (version) of the tree.
rpc GetByIndex(GetByIndexRequest) returns (GetByIndexResponse) {
option (google.api.http) = {
get: "/v1/getbyindex"
};
}

// GetWithProof returns a result containing the IAVL tree version and value for
// a given key based on the current state (version) of the tree including a
// verifiable Merkle proof.
Expand Down Expand Up @@ -217,6 +226,10 @@ message GetRequest {
bytes key = 1;
}

message GetByIndexRequest {
int64 index = 1;
}

message GetVersionedRequest {
int64 version = 1;
bytes key = 2;
Expand Down Expand Up @@ -283,6 +296,12 @@ message HasResponse {
message GetResponse {
int64 index = 1;
bytes value = 2;
bool not_found = 3;
}

message GetByIndexResponse {
bytes key = 1;
bytes value = 2;
}

message SetResponse {
Expand Down