Skip to content

v2.4.1 - Overhaul

Compare
Choose a tag to compare
@NotJustAnna NotJustAnna released this 04 Mar 17:17
c312908

Overhaul

This release brings in the two week effort to rewrite of driver, bringing in some breaking changes as well as new features and bug fixes.

Breaking Changes ⚠️

  • #7 ReqlAst.run doesn't return T anymore.
    • Now it always returns Result<T>, no matter if it's an atom or sequence.
  • #7 Cursor<T> was removed.
    • Replaced with Result<T>, which implements the same functionality.
  • #7 java.util.Optional usage was replaced by @Nullable annotations.
    • Code that previously looked like conn.db().get() or conn.db().orElse(null), will now look like conn.db(). Use null checks (Objects.requireNotNull, if (value != null) { }) instead of the Optional API.
  • #7 MapObject now has generics.
    • Raw usage of MapObject will require generics, r.hashMap() will work as usual.
    • GroupedResult also now has generics.
  • #7 Connection.Builder doesn't implement Cloneable anymore.
    • The clone() method was renamed to copyOf(), if you need that functionality.
  • #7 Internal classes Query, Response, Util, Crypto were modified; SocketWrapper, Handshake, ScramAtributtes were deleted. It should be noted that you weren't supposed to use them.
  • #7 Annotation @id was moved from com.rethinkdb.converter to com.rethinkdb.annotations.

New Features 🚀

  • #7 New Result<T>, the replacement class for Cursor<T>
    • ReqlAsr.run() always returns Result<T>, which covers all result types and implements Iterator<T>, Iterable<T> and Closeable.
    • toList(), collect(Collector), stream(), parallelStream(), first(), single(), forEach(Consumer) methods.
      • Those methods automatically close the Result, so you don't need to worry about closing it.
    • Auto-closing: If result.hasNext() return false, the result was automatically closd.
    • Fetch modes for partial sequences, which can be set on the connection or overwritten manually.
    • If enabled, unwraps atom responses which are lists (Result<List<T>>, with a single result, will be unwrapped to Result<T>, with multiple results)
    • Exposed Response's Profile to the Result
    • Pending, leaking Results can be closed from the Connection
  • #7 The connection and the response pump are now wrapped in an interface and custom factories can be set in the builder, with the default factories implemented at DefaultConnectionFactory
  • #7 Added r.pathspec(...) (Implements #16)
  • #7 Implemented CoerceType to use on coerceTo instead of strings.
  • #7 Added support for db-urls (Implements rethinkdb/rethinkdb#4101)
  • #7 New Connection.noreplyWaitAsync(), which returns CompletableFuture<Void>, so you can asynchronous wait your noreply.
  • #7 New Connection.server() and Connection.serverAsync() (Implements #14)

Bug Fixes 🔧

  • #7 Fixes Util.toReqlAst() wrongly resetting the remaining depth.
  • #7 Now Util.toReqlAst() properly serializes primitive arrays and other Collections as well.
  • #22 [GRADLE] Fixed signing being required on Gradle assemble task.

Improvements 👍

  • #7 ReqlAst improvements
    • Support for Jackson's TypeReference<T> on ReqlAst.run(), so you can pass a new TypeReference<Map<String,List<PersonalStuff>>>(){} instead of a poor Map.class
    • New ReqlAst.runAsync(), which returns CompletableFuture<Result<T>>, for all the async goodness.
    • ReqlAst.toString() now pretty-prints the AST
  • #7 Connection rewrite
    • Use of ConnectionSocket and ResponsePump
    • The handshake is entirely handled by the HandshakeProtocol class instead of the connection socket.
  • #7 Documentation for most public methods
  • #7 A lot of small performance improvements.

Other Changes 🗒️

  • #7 [GRADLE] Added option to generate main files out of local json files.
  • #7 [GRADLE] Added Bintray support.
  • #19 [GRADLE] Replaced email address.
  • #20 [GRADLE] Travis CI initial configuration.
  • #24 [GRADLE] Added support for confidential.properties file.

Dependencies 📦

  • #7 Removed json-simple dependency (Jackson provides all functionality)
  • #7 Bumped jackson-databind to 2.10.2
  • #7 Added annotations by JetBrains
  • #7 Bumped slf4j-api to 1.7.30
  • #7 Bumped concurrentunit (test dependency) to 0.4.6
  • #7 Bumped logback-classic (test dependency) to 1.2.3