Hacker News new | ask | show | jobs
by benwilson-512 3161 days ago
Hey folks! I’m one of the Absinthe co authors, happy to answer any questions!

We’re hoping to get the 1.4 release out soon, it’s was delayed a bit to make sure some features were in place for the book. For now though the 1.4.0–rc is available and we’ve been using it in production.

3 comments

Looking forward to reading your book: (https://pragprog.com/book/wwgraphql/craft-graphql-apis-in-el...) and thanx for all the amazing work!
Hey Ben, thanks for all your great work on Absinthe (and for being so helpful on Slack!)
Thanks! Stay tuned for for a deluge of new guide content: https://github.com/absinthe-graphql/absinthe/pull/416

We've been super busy getting the book finished but we want to make sure that we've also got everything someone needs to get going available in the docs.

A) How would one implement real time crud?

B) How to do record locking?

C) How to implement pagination with a quickly changing dataset?

D) What do you think about existing algorithms like e.g. conflict-free replicated data type (CRDT) or operational transformation (OT)?

Hey! Good questions.

A) Absinthe 1.4 provides first class support for GraphQL Subscriptions, which give you the ability to push data to clients based on subscription documents they submit, triggered by events within the system. GraphQL Mutations are the way you push changes at the server, and Absinthe provides tools when building your schema to indicate a mapping of mutation fields to interested subscription fields.

B) This significantly depends on your underlying datastore. GraphQL (and consequently Absinthe) is entirely agnostic about how, where, or in what you're storing and managing your data. This may seem like a non answer but the point really is that you're entirely free to pick whatever approach works best for your data and your means of storage.

C) A significant portion of this answer is the same as B, although there are some conventions within the GraphQL community that help here. The Relay connection pattern uses opaque cursor values alongside each item returned in a page, and you can encode in these cursors whatever information you need to provide a coherent pagination experience.

D) I'm a big fan. Phoenix has actually done some really amazing stuff with an ORSWOT CRDT in order to track channel presence within a cluster. We're in the middle of looking at how to integrate that with subscriptions. More generally, I think when you can work your problem into the feature set of a CRDT they can be immensely powerful.

All in all though I think you may be ascribing to GraphQL or Absinthe a stronger role in the management of the data than it has. If you want to use CRDTs then you just articulate one in your schema and push it to clients and let them push diffs at you. Same could be said for much fo B, C, D. Absinthe doesn't manage the _state_ of your application your clients. Rather, it provides a way for your to communicate that state in whatever way you choose.

Thanks for your attention!

Any hints on implementation details would be very welcome, also it would be very nice to find a chapter about these important real-life issues and how to handle them in the book!

Have a nice weekend!