@@ -2,16 +2,16 @@ syntax = "proto3";
22option java_multiple_files = true ;
33package org.vss ;
44
5- /*
6- StoreId: All APIs operate within a single storeId.
7- StoreId is keyspace identifier.
8- Ref: https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store)
9- It is up to clients to use single or multiple store's for their usage.
10- This can be used for client-isolation/ rate-limiting / throttling on server-side.
11- Authorization and billing can also be performed at storeId level.
12- */
135message GetObjectRequest {
146
7+ /*
8+ StoreId: All APIs operate within a single storeId.
9+ StoreId is a keyspace identifier.
10+ Ref: https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store)
11+ It is up to clients to use single or multiple stores for their use-case.
12+ This can be used for client-isolation/ rate-limiting / throttling on the server-side.
13+ Authorization and billing can also be performed at the storeId level.
14+ */
1515 string storeId = 1 ;
1616
1717 /*
@@ -23,63 +23,74 @@ message GetObjectRequest {
2323
2424 Read Isolation:
2525 Get/Read operations against a key are ensured to have read-committed isolation.
26- Read-committed is an isolation level that guarantees that any data read was committed at the
27- moment it is read. It will not return with any intermediate, uncommitted or 'dirty' read while
28- another PutObjectRequest was concurrently updating the same keys.
29- Read-committed isolation does not prevent modifications of the key-value immediately after the
30- read.
26+ Ref: https://en.wikipedia.org/wiki/Isolation_(database_systems)#Read_committed
3127 */
3228 string key = 2 ;
3329}
3430
3531
3632message GetObjectResponse {
3733 /*
38- Fetched value and version along with corresponding key in request.
34+ Fetched value and version along with the corresponding key in the request.
3935 */
4036 KeyValue value = 2 ;
4137}
4238
4339
4440message PutObjectRequest {
4541
42+ /*
43+ StoreId: All APIs operate within a single storeId.
44+ StoreId is a keyspace identifier.
45+ Ref: https://en.wikipedia.org/wiki/Keyspace_(distributed_data_store)
46+ It is up to clients to use single or multiple stores for their use-case.
47+ This can be used for client-isolation/ rate-limiting / throttling on the server-side.
48+ Authorization and billing can also be performed at the storeId level.
49+ */
4650 string storeId = 1 ;
4751 /*
48- If present, write will only succeed if current DB globalVersion against a storeId is
49- same as in request.
50- Client is expected to store(client-side) global version against storeId.
51- And PutObjectRequest should contain their client-side value of globalVersion.
52-
53- For first write of store, global version should be '0'. If write succeeds, clients must increment
54- their global version(client-side) by 1. This updated global version should be used in subsequent
55- PutObjectRequests for the store.
56-
57- Requests with conflicting version will fail with [`ConflictException`] as ErrorCode.
52+ If present, the write will only succeed if the current server-side globalVersion against
53+ a storeId is same as in the request.
54+ Clients are expected to store (client-side) the global version against storeId.
55+ And the request should contain their client-side value of globalVersion.
56+
57+ For the first write of the store, global version should be '0'. If the write succeeds, clients
58+ must increment their global version (client-side) by 1.
59+ The server increments globalVersion (server-side) for every successful write, hence this
60+ client-side increment is required to ensure matching versions. This updated global version
61+ should be used in subsequent PutObjectRequests for the store.
62+
63+ Requests with conflicting version will fail with `ConflictException` as ErrorCode.
5864 */
5965 optional int64 globalVersion = 2 ;
6066
6167 /*
62- Each key is supplied with its corresponding value and version.
63- Clients can choose to encrypt keys client-side in order to obfuscate user's usage patterns.
64- If write is successful, previous value of key will be overwritten.
68+ Items to be written as a result of this PutObjectRequest.
69+
70+ In an item, each key is supplied with its corresponding value and version.
71+ Clients can choose to encrypt the keys client-side in order to obfuscate user's usage patterns.
72+ If write is successful, previous value corresponding to the key will be overwritten.
6573
66- Multiple items in transactionItems of single PutObjectRequest are written in
74+ Multiple items in transactionItems of a single PutObjectRequest are written in
6775 a database-transaction in all-or-nothing fashion.
68- Items in single PutObjectRequest should have distinct keys.
76+ Items in single PutObjectRequest must have distinct keys.
6977
7078 Write will only succeed if current DB version against key is same as in request.
7179 Client is expected to store version against every key.
72- When initiating a PutObjectRequest, request should contain their client-side version for that key.
80+ When initiating a PutObjectRequest, the request should contain their client-side version for
81+ that key-value.
7382
74- For first write of key, version should be '0'. If write succeeds, clients must increment
75- their corresponding key versions(client-side) by 1. These updated key versions should be used in
76- subsequent PutObjectRequests for the keys.
83+ For first write of key, version should be '0'. If the write succeeds, clients must increment
84+ their corresponding key versions (client-side) by 1.
85+ The server increments key version (server-side) for every successful write, hence this
86+ client-side increment is required to ensure matching versions. These updated key versions should
87+ be used in subsequent PutObjectRequests for the keys.
7788
78- Requests with conflicting version will fail with [ `ConflictException`] as ErrorCode.
89+ Requests with conflicting version will fail with `ConflictException` as ErrorCode.
7990
8091 Considerations for transactions:
8192 Transaction writes of multiple items have a performance overhead, hence it is recommended to use
82- them only if required by client application to ensure logic/code correctness.
93+ them only if required by the client application to ensure logic/code correctness.
8394 That is, transactionItems are not a substitute for batch-write of multiple unrelated items.
8495 When write of multiple unrelated items is desired, it is recommended to use separate
8596 PutObjectRequests.
@@ -96,20 +107,20 @@ message PutObjectResponse {
96107
97108
98109/*
99- When HttpStatusCode is not ok(200), response `content` contains serialized ErrorResponse with
100- relevant ErrorCode and errorCode 's integer value as HttpStatusCode.
110+ When HttpStatusCode is not ok (200), the response `content` contains serialized ErrorResponse with
111+ the relevant ErrorCode and ErrorCode 's integer value as HttpStatusCode.
101112 */
102113message ErrorResponse {
103114 /*
104- The error code is a string that uniquely identifies an error condition.
105- It is meant to be read and understood programmatically by code that detects/handles errors by
115+ The error code enum-value uniquely identifies an error condition.
116+ It is meant to be read and understood programmatically by code that detects/handles errors by
106117 type.
107118 */
108119 ErrorCode errorCode = 1 ;
109120 /*
110121 The error message contains a generic description of the error condition in English.
111122 It is intended for a human audience only. And should not be parsed to extract any information
112- programmatically. Client side code may use it for logging only.
123+ programmatically. Client- side code may use it for logging only.
113124 */
114125 string message = 2 ;
115126}
@@ -121,19 +132,19 @@ message ErrorResponse {
121132 */
122133enum ErrorCode {
123134 /*
124- Default protobuf Enum value, will not be used as ErrorCode by server.
135+ Default protobuf Enum value. Will not be used as ErrorCode by server.
125136 */
126137 Unknown = 0 ;
127138 /*
128- ConflictException is used when request contains mismatched version (either key or global)
139+ ConflictException is used when the request contains mismatched version (either key or global)
129140 in PutObjectRequest. For more info refer PutObjectRequest.
130141 */
131142 ConflictException = 409 ;
132143 /*
133- InvalidRequestException is used in following cases:
134- - Request was missing a required argument.
144+ InvalidRequestException is used in the following cases:
145+ - The request was missing a required argument.
135146 - The specified argument was invalid, incomplete or in the wrong format.
136- - Request body of api cannot be deserialized into corresponding protobuf object.
147+ - The request body of api cannot be deserialized into corresponding protobuf object.
137148 */
138149 InvalidRequestException = 400 ;
139150 /*
@@ -151,15 +162,17 @@ message KeyValue {
151162 string key = 1 ;
152163
153164 /*
154- For first write of key, version should be '0'. If write succeeds, clients must increment
155- their corresponding key version(client-side) by 1. These updated key versions should be used in
156- subsequent PutObjectRequests for the keys.
165+ For first write of key, version should be '0'. If the write succeeds, clients must increment
166+ their corresponding key version (client-side) by 1.
167+ The server increments key version (server-side) for every successful write, hence this
168+ client-side increment is required to ensure matching versions. These updated key versions should
169+ be used in subsequent PutObjectRequests for the keys.
157170 */
158171 int64 version = 2 ;
159172
160173 /*
161- Object value in bytes which is stored(in put) and fetched (in get).
162- Clients must encrypt this blob client-side before sending it over wire to server in order
174+ Object value in bytes which is stored (in put) and fetched (in get).
175+ Clients must encrypt this blob client-side before sending it over the wire to server in order
163176 to preserve privacy and security.
164177 */
165178 bytes value = 3 ;
0 commit comments