2019-10-11 14:08:50 +01:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package go.micro.store;
|
|
|
|
|
|
|
|
service Store {
|
|
|
|
rpc Read(ReadRequest) returns (ReadResponse) {};
|
|
|
|
rpc Write(WriteRequest) returns (WriteResponse) {};
|
|
|
|
rpc Delete(DeleteRequest) returns (DeleteResponse) {};
|
2020-03-12 13:41:30 +00:00
|
|
|
rpc List(ListRequest) returns (stream ListResponse) {};
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message Record {
|
|
|
|
// key of the record
|
|
|
|
string key = 1;
|
|
|
|
// value in the record
|
|
|
|
bytes value = 2;
|
2020-03-12 13:41:30 +00:00
|
|
|
// time.Duration (signed int64 nanoseconds)
|
2019-10-11 14:08:50 +01:00
|
|
|
int64 expiry = 3;
|
|
|
|
}
|
|
|
|
|
2020-01-08 22:23:14 +00:00
|
|
|
message ReadOptions {
|
2020-03-12 13:41:30 +00:00
|
|
|
bool prefix = 1;
|
|
|
|
bool suffix = 2;
|
|
|
|
uint64 limit = 3;
|
|
|
|
uint64 offset = 4;
|
2020-01-08 22:23:14 +00:00
|
|
|
}
|
|
|
|
|
2019-10-11 14:08:50 +01:00
|
|
|
message ReadRequest {
|
2020-03-12 13:41:30 +00:00
|
|
|
string key = 1;
|
2020-01-08 22:23:14 +00:00
|
|
|
ReadOptions options = 2;
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message ReadResponse {
|
|
|
|
repeated Record records = 1;
|
|
|
|
}
|
|
|
|
|
2020-03-12 13:41:30 +00:00
|
|
|
message WriteOptions {
|
|
|
|
// time.Time
|
|
|
|
int64 expiry = 1;
|
|
|
|
// time.Duration
|
|
|
|
int64 ttl = 2;
|
|
|
|
}
|
|
|
|
|
2019-10-11 14:08:50 +01:00
|
|
|
message WriteRequest {
|
2020-03-12 13:41:30 +00:00
|
|
|
Record record = 1;
|
|
|
|
WriteOptions options = 2;
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message WriteResponse {}
|
|
|
|
|
2020-03-12 13:41:30 +00:00
|
|
|
message DeleteOptions {}
|
|
|
|
|
2019-10-11 14:08:50 +01:00
|
|
|
message DeleteRequest {
|
2020-03-12 13:41:30 +00:00
|
|
|
string key = 1;
|
|
|
|
DeleteOptions options = 2;
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
message DeleteResponse {}
|
|
|
|
|
2020-03-12 13:41:30 +00:00
|
|
|
message ListOptions {
|
|
|
|
string prefix = 1;
|
|
|
|
string suffix = 2;
|
|
|
|
uint64 limit = 3;
|
|
|
|
uint64 offset = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListRequest {
|
|
|
|
ListOptions options = 1;
|
|
|
|
}
|
2019-10-11 14:08:50 +01:00
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
message ListResponse {
|
2020-03-12 13:41:30 +00:00
|
|
|
reserved 1; //repeated Record records = 1;
|
|
|
|
repeated string keys = 2;
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|