diff --git a/csharp/Momento.Protos.csproj b/csharp/Momento.Protos.csproj index d881158b..ff661d84 100644 --- a/csharp/Momento.Protos.csproj +++ b/csharp/Momento.Protos.csproj @@ -24,6 +24,7 @@ + diff --git a/proto/cacheclient.proto b/proto/cacheclient.proto index 9b116397..ed772e5e 100644 --- a/proto/cacheclient.proto +++ b/proto/cacheclient.proto @@ -1,5 +1,7 @@ syntax = "proto3"; +import "common.proto"; + option go_package = "github.com/momentohq/client-sdk-go;client_sdk_go"; option java_multiple_files = true; option java_package = "grpc.cache_client"; @@ -21,6 +23,7 @@ service Scs { rpc GetBatch (_GetBatchRequest) returns (stream _GetResponse) {} rpc Set (_SetRequest) returns (_SetResponse) {} rpc SetBatch (_SetBatchRequest) returns (stream _SetResponse) {} + rpc SetIf (_SetIfRequest) returns (_SetIfResponse) {} rpc SetIfNotExists (_SetIfNotExistsRequest) returns (_SetIfNotExistsResponse) {} rpc Delete (_DeleteRequest) returns (_DeleteResponse) {} rpc KeysExist (_KeysExistRequest) returns (_KeysExistResponse) {} @@ -124,6 +127,29 @@ message _SetBatchRequest { repeated _SetRequest items = 1; } +message _SetIfRequest { + bytes cache_key = 1; + bytes cache_body = 2; + uint64 ttl_milliseconds = 3; + oneof condition { + common.Present present = 4; + common.PresentAndNotEqual present_and_not_equal = 5; + common.Absent absent = 6; + common.Equal equal = 7; + common.AbsentOrEqual absent_or_equal = 8; + common.NotEqual not_equal = 9; + } +} + +message _SetIfResponse { + oneof result { + _Stored stored = 1; + _NotStored not_stored = 2; + } + message _Stored { } + message _NotStored { } +} + message _SetIfNotExistsRequest { bytes cache_key = 1; bytes cache_body = 2; @@ -455,7 +481,7 @@ message _SetPopResponse { oneof set { _Found found = 1; _Missing missing = 2; - } + } } message _ListConcatenateFrontRequest { diff --git a/proto/common.proto b/proto/common.proto new file mode 100644 index 00000000..cbfd6cf5 --- /dev/null +++ b/proto/common.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package common; + +message Present { } + +message PresentAndNotEqual { + bytes value_to_check = 1; +} + +message Absent { } + +message Equal { + bytes value_to_check = 1; +} + +message AbsentOrEqual { + bytes value_to_check = 1; +} + +message NotEqual { + bytes value_to_check = 1; +} diff --git a/rust/momento-protos/src/lib.rs b/rust/momento-protos/src/lib.rs index 01cfb83c..e67fefb8 100644 --- a/rust/momento-protos/src/lib.rs +++ b/rust/momento-protos/src/lib.rs @@ -2,6 +2,10 @@ pub mod permission_messages { include!("permission_messages.rs"); } +pub mod common { + include!("common.rs"); +} + pub mod auth { include!("auth.rs"); }