Differences between Ruby 3.0.1 and 1.3.15

Hello Couchbase team,
I am very happy to see a new Ruby library for your database and I am looking forward to use it.

By experimenting with it I noticed several changes from the last stable version (1.3.15) and this new version.
Is it possible to have a changelog?

In particular I am not able to use these methods anymore.

  • get of multiple items with one request: get([“a”, “b”])
  • set of multiple objects at once: set({a: 1, b: 2})
  • delete of multiple objects at once: delete(“a”, “b”)

Of course, this three cases can be handled by using a loop and sending single requests for each entry. But how does it perform respect to before? Does it exist a better equivalent?

  • set up “quiet: true” for get request to silent error for not found objects

This can be solved by rescuing the error, but does it exist a better way?

  • engine eventmachine and connection pools are not anymore supported

A possible alternative can be the usage of EventMachine::Synchrony::ConnectionPool of EM synchrony gem. Is it equivalent to the previous solution?

Thank you for your attention.
Stefano

Couchbase 3.0 is complete reimplementation of new SDK design.

  • get_multi, upsert_multi and remove_multi will be available in 3.0.2
  • quiet: true is not implemented yet, but I might consider adding it. Could you describe your usecase?
  • There is no engines at this moment, but I plan to add asynchronous interface later. Again, what is the usecase here? Is it some performance issue or framework integration?

Thank you avsej for your fast answer.

  • In my implementation I try to do less requests as possible to the database this means multi get and multi upsert done at once respectively at the begin and at the end of the request.
    Suppose something like this:
    • Fetch many ids at once from Couchbase
    • Do many operations, return an error if something bad happens (without modifying the database)
    • Save everything at once on Couchbase (modifying the database) and return success

I am really happy to see that these are going to be implemented.
PS: An exist_multi could be also great.

  • Quiet: true comes comfortable when I try to fetch multiple items and I do not want to handle rescue.
    Suppose for example that I am doing get(["id1", "id2", "id3"], quiet: true) where “id2” does not exist.
    The output in this case will be something like this:
    { id1: "something", id2: nil, id3: "something else"}
    This is useful since now I know that “b” has not been found without having to handle any exception.
    Furthermore I suppose that your C implementation of quiet: true could be faster and cleaner than my implementation on Ruby.
    a = get("id2") rescue nil

  • In my implementation I try to not do blocking request to the database, by using the engine EM the API can switch the used fiber and continue with other requests.

I’ve just released 3.0.2, which does have Collection#get_multi. This is how it could be used

res = collection.get(["foo", "bar"])
res[0].content #=> content of "foo"
res[1].content #=> content of "bar"

Multi-APIs are quiet by default, i.e. it does not generate exceptions for server error codes. So when document is not found, it will return nil for #content and #error attribute will contain exception object to handle.

I think in future version I will add support for fibers/continuations or probably Ractor.

Thanks for suggestion of exists_multi. I will add it in 3.0.3

You were really fast with your implementation.
Thank you a lot for your support!