* Add metadata to store record * Add metadata to cockroach store * add metadata to store service implementation * fix breaking cache test * Test/fix cockroach metadata usage * fix store memory metadata bug
		
			
				
	
	
		
			110 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
			
		
		
	
	
			110 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
| syntax = "proto3";
 | |
| 
 | |
| package go.micro.store;
 | |
| 
 | |
| service Store {
 | |
| 	rpc Read(ReadRequest) returns (ReadResponse) {};
 | |
| 	rpc Write(WriteRequest) returns (WriteResponse) {};
 | |
| 	rpc Delete(DeleteRequest) returns (DeleteResponse) {};
 | |
| 	rpc List(ListRequest) returns (stream ListResponse) {};
 | |
| 	rpc Databases(DatabasesRequest) returns (DatabasesResponse) {};
 | |
| 	rpc Tables(TablesRequest) returns (TablesResponse) {};
 | |
| }
 | |
| 
 | |
| message Field {
 | |
| 	// type of value e.g string, int, int64, bool, float64
 | |
| 	string type = 1;
 | |
| 	// the actual value
 | |
| 	string value = 2;
 | |
| }
 | |
| 
 | |
| message Record {
 | |
| 	// key of the record
 | |
| 	string key = 1;
 | |
| 	// value in the record
 | |
| 	bytes value = 2;
 | |
| 	// time.Duration (signed int64 nanoseconds)
 | |
| 	int64 expiry = 3;
 | |
| 	// the associated metadata
 | |
| 	map<string,Field> metadata = 4;
 | |
| }
 | |
| 
 | |
| message ReadOptions {
 | |
| 	string database = 1;
 | |
| 	string table = 2;
 | |
| 	bool prefix   = 3;
 | |
| 	bool suffix   = 4;
 | |
| 	uint64 limit  = 5;
 | |
| 	uint64 offset = 6;
 | |
| }
 | |
| 
 | |
| message ReadRequest {
 | |
| 	string key          = 1;
 | |
| 	ReadOptions options = 2;
 | |
| }
 | |
| 
 | |
| message ReadResponse {
 | |
| 	repeated Record records = 1;
 | |
| }
 | |
| 
 | |
| message WriteOptions {
 | |
| 	string database = 1;
 | |
| 	string table = 2;
 | |
| 	// time.Time
 | |
| 	int64 expiry = 3;
 | |
| 	// time.Duration
 | |
| 	int64 ttl = 4;
 | |
| }
 | |
| 
 | |
| message WriteRequest {
 | |
| 	Record record        = 1;
 | |
| 	WriteOptions options = 2;
 | |
| }
 | |
| 
 | |
| message WriteResponse {}
 | |
| 
 | |
| message DeleteOptions {
 | |
| 	string database = 1;
 | |
| 	string table = 2;
 | |
| }
 | |
| 
 | |
| message DeleteRequest {
 | |
| 	string key            = 1;
 | |
| 	DeleteOptions options = 2;
 | |
| }
 | |
| 
 | |
| message DeleteResponse {}
 | |
| 
 | |
| message ListOptions {
 | |
| 	string database = 1;
 | |
| 	string table = 2;
 | |
| 	string prefix   = 3;
 | |
| 	string suffix   = 4;
 | |
| 	uint64 limit  = 5;
 | |
| 	uint64 offset = 6;
 | |
| }
 | |
| 
 | |
| 
 | |
| message ListRequest {
 | |
| 	ListOptions options = 1;
 | |
| }
 | |
| 
 | |
| message ListResponse {
 | |
| 	reserved 1; //repeated Record records = 1;
 | |
| 	repeated string keys = 2;
 | |
| }
 | |
| 
 | |
| message DatabasesRequest {}
 | |
| 
 | |
| message DatabasesResponse {
 | |
| 	repeated string databases = 1;
 | |
| }
 | |
| 
 | |
| message TablesRequest {
 | |
| 	string database = 1;
 | |
| }
 | |
| 
 | |
| message TablesResponse {
 | |
| 	repeated string tables = 1;
 | |
| }
 |