Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add protos for SetIf #267

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions csharp/Momento.Protos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<Protobuf Include="../proto/cachepubsub.proto" GrpcServices="Client" />
<Protobuf Include="../proto/token.proto" GrpcServices="Client" />
<Protobuf Include="../proto/extensions.proto" GrpcServices="Client" />
<Protobuf Include="../proto/common.proto" GrpcServices="Client" />
</ItemGroup>

<ItemGroup>
Expand Down
28 changes: 27 additions & 1 deletion proto/cacheclient.proto
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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) {}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -455,7 +481,7 @@ message _SetPopResponse {
oneof set {
_Found found = 1;
_Missing missing = 2;
}
}
}

message _ListConcatenateFrontRequest {
Expand Down
23 changes: 23 additions & 0 deletions proto/common.proto
Original file line number Diff line number Diff line change
@@ -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;
}
4 changes: 4 additions & 0 deletions rust/momento-protos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ pub mod permission_messages {
include!("permission_messages.rs");
}

pub mod common {
include!("common.rs");
}

pub mod auth {
include!("auth.rs");
}
Expand Down
Loading