-
Notifications
You must be signed in to change notification settings - Fork 15
Command types #5
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
Conversation
try await resp3Upgrade(outbound: outbound, inboundIterator: &inboundIterator) | ||
} | ||
for await (request, continuation) in requestStream { | ||
do { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shows quite nicely that working with subscriptions at the same time can get weird... we don't want to wait for a write in order to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess in this situation a subscription will change the state of the pipeline. And turn into a loop returning the published content. The difficulty is in RESP3 where you can continue to send commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow you here. Sure we can add another case for subscriptions. Problem is we might not consume those if we are stuck in writing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three small comments. All in all I really like this!
public static func clusterSlaves(nodeId: String) -> RESPCommand { | ||
RESPCommand("CLUSTER", "SLAVES", nodeId) | ||
/// Returns the mapping of cluster slots to shards. | ||
public struct CLUSTERSHARDS: RedisCommand { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered using namespaces here? So that we get CLUSTER.SHARDS
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be a little more complex but should be easy enough
RESPCommand("CLUSTER", "SLAVES", nodeId) | ||
/// Returns the mapping of cluster slots to shards. | ||
public struct CLUSTERSHARDS: RedisCommand { | ||
public typealias Response = [RESPToken] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we autogen the responses here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resp3_replies.json file is a bit shit. It does not define responses particularly well. The text for this one is
"[Array reply](/docs/reference/protocol-spec#arrays): a nested list of [Map reply](/docs/reference/protocol-spec#maps) of hash ranges and shard nodes describing individual shards."
I was thinking of adding in some way to patch the responses, as some of them end up being quite complex.
Makes the assumption the map key is always a string
9dfabf3
to
47b9ed8
Compare
* Command types * fix hello 3 command * writeToRESPBuffer -> encode * Add support for returning maps Makes the assumption the map key is always a string * Enum namespaces for containers * Catch more response arrays in replies * Parameter pack return from pipeline * Update README * Make sure we parse all responses from pipelined requests
* Command types * fix hello 3 command * writeToRESPBuffer -> encode * Add support for returning maps Makes the assumption the map key is always a string * Enum namespaces for containers * Catch more response arrays in replies * Parameter pack return from pipeline * Update README * Make sure we parse all responses from pipelined requests
@fabianfett @Joannis
As discussed on Discord