Open
Conversation
Fixes search test with clj protobuf object put
Contributor
|
Hello, thank you for the PR. Somehow I overlooked this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While I understand (and agree with) the rationale (in the README) for not using lein-protobuf, it's companion library clj-protobuf seems like it might be a pretty good fit to replace the code currently under
/src/clojure/kria/pb, favoring a data-driven approach to constructing messages.This pull demonstrates the usage of clojure-protobuf with the same riak-pb compiled java provided by Basho, but without any of the direct interop formerly found in the pb namspaces.
Pros
Pair->pbover stuff.Cons
Breaking Changes
There are some small breaking changes to the API, namely every api fn that formerly took plain clojure string args has been changed to require pb byte-strings instead. This eases the burden of coercion on subsequent calls, for instance using Links, etc, and makes the API consistent.
Parsing/Dispatch
kria.core/callno longer takes the req->bytes and bytes->resp fns, dispatching instead on the request/response keys given. This also removes the need to supply no-ops like(fn [_] true)and(fn [_] (byte-array 0))in api functions, as these are provided when there is no definition found for the message. Clojure-protobuf has the added benefit of more human-readable exceptions when it gets a bad message to write, which should ease use considerably, with direct interop I found myself hunting down NPE's a lot.The tests only required minor changes mostly concerning api functions that formerly took strings.
Further Work
I plan to do more investigation into the best way to declare/call protobuf definitions, you can see the way I am currently doing it in the
pbnamespaces.