-
Notifications
You must be signed in to change notification settings - Fork 64
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
add default slot and keys recognition #754
Conversation
def encode(data: Iterable[A])(implicit codec: BinaryCodec): Chunk[RespValue.BulkString] = | ||
data.foldLeft(Chunk.empty: Chunk[RespValue.BulkString])((acc, a) => acc ++ input.encode(a)) | ||
def encode(data: Iterable[A])(implicit codec: BinaryCodec): RespCommand = | ||
data.foldLeft(RespCommand.empty)((acc, a) => acc ++ input.encode(a)) | ||
} | ||
|
||
final case class EvalInput[-K, -V](inputK: Input[K], inputV: Input[V]) extends Input[(String, Chunk[K], Chunk[V])] { |
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.
Controversial idea. What Is interface ideally wanted: inputK would have type KeyInput[K] that inherit Input[K] and we can translate there any dependency, but we cannot to do that cause we have to have contramap that in the inherited interface that return main trait Input. 🤔
@mijicd What do you think?
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 am not sure about that one. Can you draft some poc and let's see what are the pros and cons?
7906aed
to
10d3577
Compare
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.
Please split the pull request as suggested, and I'll re-review 🙏
c179d43
to
a8e1677
Compare
a8e1677
to
a62b266
Compare
@@ -27,7 +27,7 @@ trait BaseSpec extends ZIOSpecDefault { | |||
|
|||
/* TODO | |||
* We can try to support the most unsupported commands for cluster with: | |||
* - default connection for commands without a key and for multiple key commands with | |||
* - [DONE] default connection for commands without a key and for multiple key commands with |
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 we can remove the [DONE]
:)
def encode(data: Iterable[A])(implicit codec: BinaryCodec): Chunk[RespValue.BulkString] = | ||
data.foldLeft(Chunk.empty: Chunk[RespValue.BulkString])((acc, a) => acc ++ input.encode(a)) | ||
def encode(data: Iterable[A])(implicit codec: BinaryCodec): RespCommand = | ||
data.foldLeft(RespCommand.empty)((acc, a) => acc ++ input.encode(a)) | ||
} | ||
|
||
final case class EvalInput[-K, -V](inputK: Input[K], inputV: Input[V]) extends Input[(String, Chunk[K], Chunk[V])] { |
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 am not sure about that one. Can you draft some poc and let's see what are the pros and cons?
val key = RespArgument.Key("hello world") | ||
assertTrue(15332 == key.asCRC16) |
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.
Nitpick (I'm fine with leaving it as it is as well):
val key = RespArgument.Key("hello world") | |
assertTrue(15332 == key.asCRC16) | |
assertTrue(15332 == RespArgument.Key("hello world").asCRC16) |
add default connection for commands without a key and for multiple key commands with the limitation that all keys have to be in the same slot
#673