* WIP store rewrite * Fix memory store tests * Store hard expiry times rather than duration! * Clarify memory test * Add limit to store interface * Implement suffix option * Don't return nils from noop store * Fix syncmap * Start fixing store service * wip service and cache * Use _ for special characters in cockroachdb namespace * Improve cockroach namespace comment * Use service name as default store namespace * Fixes * Implement Store Scope * Start fixing etcd * implement read and write with expiry and prefix * Fix etcd tests * Fix cockroach store * Fix cloudflare interface * Fix certmagic / cloudflare store * comment lint * cache isn't implemented yet * Only prepare DB staements once Co-authored-by: Ben Toogood <ben@micro.mu> Co-authored-by: ben-toogood <bentoogood@gmail.com>
		
			
				
	
	
		
			75 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Protocol Buffer
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			1.2 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) {};
 | 
						|
}
 | 
						|
 | 
						|
message Record {
 | 
						|
	// key of the record
 | 
						|
	string key = 1;
 | 
						|
	// value in the record
 | 
						|
	bytes value = 2;
 | 
						|
	// time.Duration (signed int64 nanoseconds)
 | 
						|
	int64 expiry = 3;
 | 
						|
}
 | 
						|
 | 
						|
message ReadOptions {
 | 
						|
	bool prefix   = 1;
 | 
						|
	bool suffix   = 2;
 | 
						|
	uint64 limit  = 3;
 | 
						|
	uint64 offset = 4;
 | 
						|
}
 | 
						|
 | 
						|
message ReadRequest {
 | 
						|
	string key          = 1;
 | 
						|
	ReadOptions options = 2;
 | 
						|
}
 | 
						|
 | 
						|
message ReadResponse {
 | 
						|
	repeated Record records = 1;
 | 
						|
}
 | 
						|
 | 
						|
message WriteOptions {
 | 
						|
	// time.Time
 | 
						|
	int64 expiry = 1;
 | 
						|
	// time.Duration
 | 
						|
	int64 ttl = 2;
 | 
						|
}
 | 
						|
 | 
						|
message WriteRequest {
 | 
						|
	Record record        = 1;
 | 
						|
	WriteOptions options = 2;
 | 
						|
}
 | 
						|
 | 
						|
message WriteResponse {}
 | 
						|
 | 
						|
message DeleteOptions {}
 | 
						|
 | 
						|
message DeleteRequest {
 | 
						|
	string key            = 1;
 | 
						|
	DeleteOptions options = 2;
 | 
						|
}
 | 
						|
 | 
						|
message DeleteResponse {}
 | 
						|
 | 
						|
message ListOptions {
 | 
						|
	string prefix = 1;
 | 
						|
	string suffix = 2;
 | 
						|
	uint64 limit  = 3;
 | 
						|
	uint64 offset = 4;
 | 
						|
}
 | 
						|
 | 
						|
message ListRequest {
 | 
						|
	ListOptions options = 1;
 | 
						|
}
 | 
						|
 | 
						|
message ListResponse {
 | 
						|
	reserved 1; //repeated Record records = 1;
 | 
						|
	repeated string keys = 2;
 | 
						|
}
 |