TigerBeetle : Support a new data layer in Ash

Hello All,

We are interested to check a new data layer for our financial payments application “https://tigerbeetle.com/” and would like some help about what needs to be done with Ash to support it

1 Like

They don’t have an Elixir client and I don’t think they have a documented wire protocol, so either you need to ask them to create one or you need to embed another client in Elixir.

Poking around in their repo they seem to have a C client but it has no docs and is not listed in their docs, so I think it’s probably for internal use. There also seems to be a WIP Rust client which would be a good candidate for a NIF when it’s finished.

Another option would be to create a proxy application (in say Go or Java) which accepts API calls from Elixir and delegates them to the actual client. People used to do this with FoundationDB because their client is very, uh, particular.

2 Likes

there’s GitHub - rbino/tigerbeetlex: An Elixir client for TigerBeetle

5 Likes

For a database to be supported by Ash, you need to implement a data layer extension. The core Ash codebase has a simple ETS datalayer implementation you could look at as examples, and there are several other database extensions, e.g. AshSqlite and AshPostgres that offer more complex implementation examples.

2 Likes

Oh wow, I did not even bother to look for third party clients because I figured Tigerbeetle was still too niche for anyone to have gotten around to it.

Looks like a nice client, much respect to the author!

1 Like

For tigerbeetle, I don’t think a data layer would be necessary. It’s just a financial transaction store. You’d likely provide manual action implementations, or a resource extension etc.

2 Likes

Hello @zachdaniel ,
So if I understand you well you suggest to use it as some external backend to store financial transaction details while maybe utilize another data layer for other data resources like system configuration , business rules ,..etc?
So for my resources the data layer will be the second one while reading/writing to TigerBeetle will be like calling a backend service

A data layer is typically preferred for things that can “generically” store data. Tigerbeetle has a limited number of abstractions. You’d never store a “user” or a “blog post” or an “event” in there, only ever transfers and accounts. So I’d suggest wrapping it either with manual actions, Ash.DataLayer.Simple or just calling into it from other resources etc. using a client library.

1 Like

thats not to say that you couldn’t do it as a data layer. If someone thinks that is a good idea they should try :smiley: I could be wrong.

1 Like

Though the resilience shown in one of their youtube video is quite expressive.
Multi node with Re-election of a new leader in case of a crash, still processing requests at a decent speed.

Nothing not to like putting aside its just a ledger DB

Currently TigerBeetlex returns its own structs (i.e. TigerBeetlex.Account, TigerBeetlex.Transfer etc), while to use Ash.DataLayer.Simple I guess you have to define structs as resources from the Ash side and return those. That’s why in my ElixirConf talk I’ve cited user-defined structs first as next step in TigerBeetlex before doing any kind of Ash interaction.

Although for a quick and dirty test one might also define an Ash resource with the same attributes as TigerBeetlex.Account and just replace the __struct__ field.

3 Likes

I’m interested in this integration as well.

TigerBeetle seems to fill this interesting new spot of a backing store for Ash Double Entry Accounting - while also potentially being a simple Data Store (closer to CubDB?) or just a new, simpler wrapper over TigerBeetleEx to map the actions.

I assumed the structs like Account and Transfer would map to Ash Resources - but I can see where it’s a bit tricker then that.

1 Like

Yeah, would be pretty fun to explore if there would be a good way to go about it. We’d want to avoid the expense of loading from one struct to the other etc.

1 Like

Hello,

Is it only about just the account, ledger like data or it could be used to record/log all transaction related data?
As you know in online processing of payments you usually had to parse message then log/retrieve multiple times with all related data while calling multiple backend services whether internal or external and all of this have to happen in few seconds “E2E”.