Skip to content

Commit

Permalink
feat: add trailers proto (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-kugler authored Aug 12, 2024
1 parent 9200656 commit 2038613
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions proto/store.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,38 @@ option csharp_namespace = "Momento.Protos.Store";

package store;

// Found on the `err` trailer for error responses, when the error is sent by the server and it has a relevant value to set
// {
// Key: "err"
// Values: [
// This is to indicate the error is coming from Momento, and not tonic or other middleware
// "momento_general_err",
// The server may or may not have tried to process this command, but it was unable
// to complete it either way. A resource was exhausted which prevented the request
// from completing.
// "server_is_busy",
// Indicates that the stored type for the key supplied isn't compatiable with the
// requested operation
// "invalid_type",
// Indicates the item doesn't exist for the given key
// "item_not_found",
// Indicates the store doesn't exist
// "store_not_found"
// ]
// },
// Found on the `retry_disposition` trailer for error responses, when the value is known by the service
// {
// Key: "retry_disposition"
// Values: [
// This rpc is safe to retry, even if it is non-idempotent. It was not executed by the server.
// "retryable",
// This rpc may be safe to retry, but it may have been applied.
// Non-idempotent commands should not be retried, unless configured explicitly.
// Idempotent commands should be considered eligible for retry.
// "possibly_retryable"
// ]
// }

service Store {
rpc Get(_StoreGetRequest) returns (_StoreGetResponse) {}
rpc Put(_StorePutRequest) returns (_StorePutResponse) {}
Expand All @@ -26,6 +58,11 @@ message _StoreGetRequest {
string key = 1;
}

// This response is for when a get request concludes successfully.
// These are some of the Errors and their corresponding GRPC status codes.
// 1. Invalid argument was provided, value is missing -> grpc code = INVALID_ARGUMENT. Metadata: "err" -> "momento_general_err"
// 2. Item does not exist. grpc code = NOT_FOUND. Metadata: "err" -> "item_not_found"
// 3. Store not found. grpc code = NOT_FOUND. Metadata: "err" -> "store_not_found"
message _StoreGetResponse {
_StoreValue value = 1;
}
Expand All @@ -35,10 +72,20 @@ message _StorePutRequest {
_StoreValue value = 2;
}

// This response is for when a put request concludes successfully.
// These are some of the Errors and their corresponding GRPC status codes.
// 1. Invalid argument was provided, value is missing -> grpc code = INVALID_ARGUMENT. Metadata: "err" -> "momento_general_err"
// 2. Store is currently busy. grpc code = UNAVAILABLE. Metadata: "err" -> "server_is_busy", "retry_disposition" -> "retryable"
// 3. Store not found. grpc code = NOT_FOUND. Metadata: "err" -> "store_not_found"
message _StorePutResponse { }

message _StoreDeleteRequest {
string key = 1;
}

// This response is for when a delete request concludes successfully.
// These are some of the Errors and their corresponding GRPC status codes.
// 1. Invalid argument was provided, value is missing -> grpc code = INVALID_ARGUMENT. Metadata: "err" -> "momento_general_err"
// 2. Store is currently busy. grpc code = UNAVAILABLE. Metadata: "err" -> "server_is_busy", "retry_disposition" -> "retryable"
// 3. Store not found. grpc code = NOT_FOUND. Metadata: "err" -> "store_not_found"
message _StoreDeleteResponse { }

0 comments on commit 2038613

Please sign in to comment.