Skip to content

Commit

Permalink
Core: add PubSub commands types
Browse files Browse the repository at this point in the history
Signed-off-by: Shoham Elias <shohame@amazon.com>
  • Loading branch information
shohamazon committed Jul 29, 2024
1 parent 1e3a396 commit 6d1be49
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions glide-core/src/protobuf/command_request.proto
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ enum RequestType {
Scan = 206;
Wait = 208;
XClaim = 209;
PubSubChannels = 210;
PubSubNumPat = 211;
PubSubNumSub = 212;
PubSubSChannels = 213;
PubSubSNumSub = 214;
}

message Command {
Expand Down
15 changes: 15 additions & 0 deletions glide-core/src/request_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ pub enum RequestType {
Scan = 206,
Wait = 208,
XClaim = 209,
PubSubChannels = 210,
PubSubNumPat = 211,
PubSubNumSub = 212,
PubSubSChannels = 213,
PubSubSNumSub = 214,
}

fn get_two_word_command(first: &str, second: &str) -> Cmd {
Expand Down Expand Up @@ -439,6 +444,11 @@ impl From<::protobuf::EnumOrUnknown<ProtobufRequestType>> for RequestType {
ProtobufRequestType::Wait => RequestType::Wait,
ProtobufRequestType::XClaim => RequestType::XClaim,
ProtobufRequestType::Scan => RequestType::Scan,
ProtobufRequestType::PubSubChannels => RequestType::PubSubChannels,
ProtobufRequestType::PubSubNumSub => RequestType::PubSubNumSub,
ProtobufRequestType::PubSubNumPat => RequestType::PubSubNumPat,
ProtobufRequestType::PubSubSChannels => RequestType::PubSubSChannels,
ProtobufRequestType::PubSubSNumSub => RequestType::PubSubSNumSub,
}
}
}
Expand Down Expand Up @@ -658,6 +668,11 @@ impl RequestType {
RequestType::Wait => Some(cmd("WAIT")),
RequestType::XClaim => Some(cmd("XCLAIM")),
RequestType::Scan => Some(cmd("SCAN")),
RequestType::PubSubChannels => Some(get_two_word_command("PUBSUB", "CHANNELS")),
RequestType::PubSubNumSub => Some(get_two_word_command("PUBSUB", "NUMSUB")),
RequestType::PubSubNumPat => Some(get_two_word_command("PUBSUB", "NUMPAT")),
RequestType::PubSubSChannels => Some(get_two_word_command("PUBSUB", "SHARDCHANNELS")),
RequestType::PubSubSNumSub => Some(get_two_word_command("PUBSUB", "SHARDNUMSUB")),
}
}
}

0 comments on commit 6d1be49

Please sign in to comment.