-
Notifications
You must be signed in to change notification settings - Fork 263
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
Changes from 5 commits
ea5e147
a6f2d0f
26c4225
97f8984
febb070
856cbb4
e7f8b3a
6436687
3e5f26e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
@@ -217,6 +226,10 @@ message GetRequest { | |
bytes key = 1; | ||
} | ||
|
||
message GetByIndexRequest { | ||
int64 index = 1; | ||
} | ||
|
||
message GetVersionedRequest { | ||
int64 version = 1; | ||
bytes key = 2; | ||
|
@@ -283,6 +296,12 @@ message HasResponse { | |
message GetResponse { | ||
int64 index = 1; | ||
bytes value = 2; | ||
bool missing = 3; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about changing to more standard There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, |
||
} | ||
|
||
message GetByIndexResponse { | ||
bytes key = 1; | ||
bytes value = 2; | ||
} | ||
|
||
message SetResponse { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need that breaking change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe there is a supported way of returning structured error information in gRPC, so in order to return the index of the nearest key when accessing a missing key we have to change from an error response to a regular response. See original issue #354.