2019-10-11 16:08:50 +03: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 16:41:30 +03:00
|
|
|
rpc List(ListRequest) returns (stream ListResponse) {};
|
2020-04-09 18:37:32 +03:00
|
|
|
rpc Databases(DatabasesRequest) returns (DatabasesResponse) {};
|
|
|
|
rpc Tables(TablesRequest) returns (TablesResponse) {};
|
2019-10-11 16:08:50 +03:00
|
|
|
}
|
|
|
|
|
2020-06-03 11:45:08 +03:00
|
|
|
message Field {
|
|
|
|
// type of value e.g string, int, int64, bool, float64
|
|
|
|
string type = 1;
|
|
|
|
// the actual value
|
|
|
|
string value = 2;
|
|
|
|
}
|
|
|
|
|
2019-10-11 16:08:50 +03:00
|
|
|
message Record {
|
|
|
|
// key of the record
|
|
|
|
string key = 1;
|
|
|
|
// value in the record
|
|
|
|
bytes value = 2;
|
2020-03-12 16:41:30 +03:00
|
|
|
// time.Duration (signed int64 nanoseconds)
|
2019-10-11 16:08:50 +03:00
|
|
|
int64 expiry = 3;
|
2020-06-03 11:45:08 +03:00
|
|
|
// the associated metadata
|
|
|
|
map<string,Field> metadata = 4;
|
2019-10-11 16:08:50 +03:00
|
|
|
}
|
|
|
|
|
2020-01-09 01:23:14 +03:00
|
|
|
message ReadOptions {
|
2020-05-01 00:51:25 +03:00
|
|
|
string database = 1;
|
|
|
|
string table = 2;
|
|
|
|
bool prefix = 3;
|
|
|
|
bool suffix = 4;
|
|
|
|
uint64 limit = 5;
|
|
|
|
uint64 offset = 6;
|
2020-01-09 01:23:14 +03:00
|
|
|
}
|
|
|
|
|
2019-10-11 16:08:50 +03:00
|
|
|
message ReadRequest {
|
2020-03-12 16:41:30 +03:00
|
|
|
string key = 1;
|
2020-01-09 01:23:14 +03:00
|
|
|
ReadOptions options = 2;
|
2019-10-11 16:08:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
message ReadResponse {
|
|
|
|
repeated Record records = 1;
|
|
|
|
}
|
|
|
|
|
2020-03-12 16:41:30 +03:00
|
|
|
message WriteOptions {
|
2020-05-01 00:51:25 +03:00
|
|
|
string database = 1;
|
|
|
|
string table = 2;
|
2020-03-12 16:41:30 +03:00
|
|
|
// time.Time
|
2020-05-01 00:51:25 +03:00
|
|
|
int64 expiry = 3;
|
2020-03-12 16:41:30 +03:00
|
|
|
// time.Duration
|
2020-05-01 00:51:25 +03:00
|
|
|
int64 ttl = 4;
|
2020-03-12 16:41:30 +03:00
|
|
|
}
|
|
|
|
|
2019-10-11 16:08:50 +03:00
|
|
|
message WriteRequest {
|
2020-03-12 16:41:30 +03:00
|
|
|
Record record = 1;
|
|
|
|
WriteOptions options = 2;
|
2019-10-11 16:08:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
message WriteResponse {}
|
|
|
|
|
2020-05-01 00:51:25 +03:00
|
|
|
message DeleteOptions {
|
|
|
|
string database = 1;
|
|
|
|
string table = 2;
|
|
|
|
}
|
2020-03-12 16:41:30 +03:00
|
|
|
|
2019-10-11 16:08:50 +03:00
|
|
|
message DeleteRequest {
|
2020-03-12 16:41:30 +03:00
|
|
|
string key = 1;
|
|
|
|
DeleteOptions options = 2;
|
2019-10-11 16:08:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
message DeleteResponse {}
|
|
|
|
|
2020-03-12 16:41:30 +03:00
|
|
|
message ListOptions {
|
2020-05-01 00:51:25 +03:00
|
|
|
string database = 1;
|
|
|
|
string table = 2;
|
|
|
|
string prefix = 3;
|
|
|
|
string suffix = 4;
|
|
|
|
uint64 limit = 5;
|
|
|
|
uint64 offset = 6;
|
2020-03-12 16:41:30 +03:00
|
|
|
}
|
|
|
|
|
2020-05-01 00:51:25 +03:00
|
|
|
|
2020-03-12 16:41:30 +03:00
|
|
|
message ListRequest {
|
|
|
|
ListOptions options = 1;
|
|
|
|
}
|
2019-10-11 16:08:50 +03:00
|
|
|
|
2019-10-24 00:05:39 +03:00
|
|
|
message ListResponse {
|
2020-03-12 16:41:30 +03:00
|
|
|
reserved 1; //repeated Record records = 1;
|
|
|
|
repeated string keys = 2;
|
2019-10-11 16:08:50 +03:00
|
|
|
}
|
2020-04-09 18:37:32 +03:00
|
|
|
|
|
|
|
message DatabasesRequest {}
|
|
|
|
|
|
|
|
message DatabasesResponse {
|
|
|
|
repeated string databases = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TablesRequest {
|
|
|
|
string database = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TablesResponse {
|
|
|
|
repeated string tables = 1;
|
|
|
|
}
|