@@ -3,39 +3,57 @@ option java_multiple_files = true;
33package org.ess ;
44
55service EncryptedStorageService {
6- rpc get (GetRequest ) returns (GetResponse );
7- rpc put (PutRequest ) returns (PutResponse );
8- //TODO: Add getKeysSummary (Gives version numbers for all keys in a store) and list by prefix API's
6+ rpc get (GetObjectRequest ) returns (GetObjectResponse );
7+ rpc put (PutObjectRequest ) returns (PutObjectResponse );
8+ //TODO: Add getKeysSummary (Gives version numbers for all keys in a store) and list by prefix APIs
99}
1010
11- message GetRequest {
11+ message GetObjectRequest {
1212 /*
13- All API's operate within a single storeId.
13+ All APIs operate within a single storeId.
1414 StoreId is keyspace identifier. Ref: https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store)
1515 It is up to clients to use single or multiple store's for their usage.
1616 */
1717 string storeId = 1 ;
1818 string key = 2 ;
1919}
20- message GetResponse {
20+ message GetObjectResponse {
2121 bool success = 1 ;
2222 KeyValue value = 2 ;
2323
24- // Only present when success = false
24+ // Optional, only present when success = false
2525 optional ErrorResponse errorResponse = 3 ;
2626}
2727
28- message PutRequest {
28+ message PutObjectRequest {
2929 string storeId = 1 ;
3030 /*
31- If present, write will only succeed if current DB globalVersion against a storeId is
32- same as in request.
31+ If present, write will only succeed if current DB globalVersion against a storeId is
32+ same as in request.
33+ Client is expected to send their current global version at hand.
34+
35+ For first write of store, version should be '0'. If write succeeds, clients must increment
36+ their global version(on device) by 1.
37+
38+ Requests with conflicting version will fail with [`ConflictException`] as ErrorCode.
3339 */
3440 optional int64 globalVersion = 2 ;
41+
42+ /*
43+ Each key is supplied with its corresponding version.
44+
45+ Write will only succeed if current DB version against key is same as in request.
46+ Clients are expected to send their current version at hand in the request.
47+
48+ For first write of key, version should be '0'. If write succeeds, clients must increment
49+ their corresponding key versions(on device) by 1.
50+
51+ Requests with conflicting version will fail with [`ConflictException`] as ErrorCode.
52+ */
3553 repeated KeyValue transactionItems = 3 ;
3654}
3755
38- message PutResponse {
56+ message PutObjectResponse {
3957 bool success = 1 ;
4058 optional ErrorResponse errorResponse = 2 ;
4159}
@@ -54,7 +72,6 @@ enum ErrorCode{
5472message KeyValue {
5573 string key = 1 ;
5674
57- // Write will only succeed if current DB version against key is same as in request.
5875 int64 version = 2 ;
5976
6077 bytes value = 3 ;
0 commit comments