Skip to content

Commit 869a236

Browse files
Merge pull request #77 from o7studios/76-refactor-get-route
Refactore Get Route
2 parents 3f00047 + 2d9a1b5 commit 869a236

3 files changed

Lines changed: 299 additions & 88 deletions

File tree

proto/v1/api.proto

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ service Octopus {
1616
* key pattern. Can optionally include expired (include all
1717
* revisions) objects and filter by creation time.
1818
*/
19+
rpc Query(QueryRequest) returns (QueryResponse);
20+
/**
21+
* Retrieves only one existing entry from the database matching a key.
22+
*/
1923
rpc Get(GetRequest) returns (GetResponse);
2024
/**
2125
* Stores an object on key.
@@ -86,9 +90,9 @@ message Entry {
8690
}
8791

8892
/**
89-
* Filters and options for `Get` RPC.
93+
* Filters and options for `Query` RPC.
9094
*/
91-
message GetRequest {
95+
message QueryRequest {
9296
// Pattern to match keys. Supports wildcards:
9397
// * — matches exactly one token (between dots), e.g., "foo.*.bar" matches "foo.x.bar" but not "foo.x.y.bar"
9498
// > — matches one or more tokens until the end, e.g., "foo.>" matches "foo", "foo.bar", "foo.bar.baz", etc.
@@ -111,6 +115,23 @@ message GetRequest {
111115
Paginator paginator = 6;
112116
}
113117

118+
/**
119+
* For getting an exact value to a key you already have
120+
*/
121+
message GetRequest {
122+
// Exact key to a object
123+
string key = 1;
124+
}
125+
126+
message GetResponse {
127+
oneof result {
128+
// If the key points only to one value it will be returned
129+
Object object = 1;
130+
// If no object is found for the given key, this field is set
131+
google.protobuf.Empty empty = 2;
132+
}
133+
}
134+
114135
/**
115136
* Paginator for database entry cursor-pagination.
116137
*/
@@ -134,9 +155,9 @@ message PageInfo {
134155
}
135156

136157
/**
137-
* Result of `Get` RPC.
158+
* Result of `Query` RPC.
138159
*/
139-
message GetResponse {
160+
message QueryResponse {
140161
// List of found entries including revision, ID and timestamps.
141162
repeated Entry entries = 1;
142163

0 commit comments

Comments
 (0)