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

Support RethinkDB JSON protocol w/ sinesignal/ottoman's minimal JSON library #176

Merged
merged 13 commits into from
Oct 24, 2014

Conversation

mfenniak
Copy link
Owner

Work-in-progress to convert to the JSON protocol.

Incorporated a small JSON library from sinesignal/ottoman, SineSignal.Ottoman.Serialization, with minor modifications; mostly deleting a few things that weren't required. This eliminates the need for us to add a large third-party dependency for a JSON library.

TODO:

  • Fix whatever issues are breaking unit tests.
  • FIXME on ability to read backtraces from the server.
  • FIXME around using the correct JSON encoding for text->bytes, currently using UTF-8 and need to verify that's correct. Also remove encoding creation on every command run.
  • Converting Query objects into JSON, and JSON into Response objects, is currently intermingled in the Connection class. I'm thinking I'd like to separate that into a "JSONProtocol" class, and possibly even restore the protobuf-based code into it's own class. This would allow comparison between the code (eg. performance testing, bug tracking down), and maybe even runtime selection between the protocol (although I don't know why, it just seems practical). The biggest goal would be code cleanup first.
  • Review all code changes and see if I've left anything else ugly lying around.
  • Incorporate the requirements of the Apache License with regard to the code that will be redistributed from sinesignal/ottoman. Requirements in section 4 of the Apache License will be followed.
  • Update release notes.

This PR will address issue #175.

@mfenniak mfenniak self-assigned this Oct 23, 2014
@mfenniak mfenniak changed the title Support RethinkDB JSON protocol Support RethinkDB JSON protocol w/ sinesignal/ottoman's minimal JSON library Oct 23, 2014
The state of JSON in .NET is a bit abysmal.  I don't want to add new
third-party dependencies like JSON.NET, the .NET's own JSON support
is highly coupled to using data contracts rather than free-form objects,
and I can't find a decent, simple parser that I can incorporate with
the correct licensing and an approach that doesn't build an object model
which I would have to translate into a Response object model.

On the plus side, I benchmarked a simple JsonWriter against the Protobuf
library for writing queries.  It showed a bit of a speed-up, but not
enough to salivate over.  I'm shelving this work until RethinkDB threatens
to kill the protobuf protocol. :-)
This branch is now partially working with the JSON protocol; some tests
pass.  There's obviously a few mistakes in that all tests don't pass,
and there are a few FIXMEs for things that I've half-assed to get a start
on, and there's a lot of code added to Connection that probably doesn't
belong there.

It might be a good idea to separate out the protocol details from the
Connection class entirely, and make rethinkdb-net capable of using
either protocol.  Mostly that will make it clear what code is related
to the JSON protocol, but it would also be easy to support both in
the driver if there was a pressing need to.
This keeps support for V0_2, V0_3 / Protobuf, and V0_3 / JSON.
mfenniak added a commit that referenced this pull request Oct 24, 2014
Support RethinkDB JSON protocol w/ sinesignal/ottoman's minimal JSON library
@mfenniak mfenniak merged commit 65b4b99 into master Oct 24, 2014
@mfenniak mfenniak deleted the issue_175 branch October 24, 2014 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant