-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathread.proto
95 lines (59 loc) · 2.22 KB
/
read.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
syntax = "proto3";
package sf.substreams.sink.kv.v1;
option go_package = "github.com/streamingfast/substreams-sink-kv/pb;pbkv";
service Kv {
// Get returns the requested value as bytes if it exists, not found error code otherwise.
rpc Get(GetRequest) returns (GetResponse);
// GetMany returns the requested values as bytes if all of them exists, not found error code otherwise.
rpc GetMany(GetManyRequest) returns (GetManyResponse);
// GetByPrefix returns the next _limit_ key/value pair that match the requested prefix if any exist, not found error code otherwise.
rpc GetByPrefix(GetByPrefixRequest) returns (GetByPrefixResponse);
// Scan returns then next _limit_ key/value pairs starting lexicographically at the given key, not found error code otherwise.
rpc Scan(ScanRequest) returns (ScanResponse);
}
message GetRequest {
// Key to fetch
string key = 1;
}
message GetManyRequest {
// Keys to fetch
repeated string keys = 1;
}
message GetByPrefixRequest {
// server may impose a hard limit, trying to go above it would return grpc_error: INVALID_ARGUMENT
uint64 limit = 1;
// requested prefix
string prefix = 2;
}
message ScanRequest {
// server may impose a hard limit, trying to go above it would return grpc_error: INVALID_ARGUMENT
uint64 limit = 1;
// scanning will start at this point, lexicographically
string begin = 2;
// If set, scanning will stop when it reaches this point or above, excluding this exact key
optional string exclusive_end = 3;
}
message GetResponse {
// Value that was found for the requested key
bytes value = 1;
}
message GetManyResponse {
// Values that were found for the requested keys
repeated bytes values = 1;
}
message GetByPrefixResponse {
// KV are the key/value pairs that were found with the given prefix
repeated KV key_values = 1;
// limit_reached is true if there is at least ONE MORE result than the requested limit
bool limit_reached = 2;
}
message ScanResponse {
// KV are the key/value pairs that were found during scan
repeated KV key_values = 1;
// limit_reached is true if there is at least ONE MORE result than the requested limit
bool limit_reached = 2;
}
message KV {
string key = 1;
bytes value = 2;
}