NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
TigerBeetle as a File Storage (aivarsk.com)
winny314 14 hours ago [-]
In the first example:

    def create_a_file(filename, size):
        if len(filename) > 16:
            raise ValueError("Invalid filename, more than 16 bytes")
        account = tb.Account(
            id=int.from_bytes(filename.encode()),
            ...
        ...
Is `filename` a str? In which case `len(str)` returns the number of codepoints in the unicode string, not the number of bytes in an encoded representation. Yup the `filename.encode()` sounds like `str.encode()` which itself returns a `bytes` object. Not sure if it matters, but semantically it bugs the heck out of me.
WJW 1 days ago [-]
Tigerbeetle is very cool and I would love to see more of it. AFAIR they have been hinting that you could in theory plug in storage engines different from the debit/credit model they've using for some time. Has any of this materialized? I would love to use it but just don't have any bookkeeping to do at the scale where bringing in Tigerbeetle would make sense. :(
matklad 1 days ago [-]
It is the other way around --- it is _relatively_ easy to re-use the storage engine, but plug your custom state machine (implemented in Zig). We have two state machines, an accounting one, and a simple echo one here: https://github.com/tigerbeetle/tigerbeetle/blob/main/src/tes....

I am not aware of any "serious" state machine other than accounting one though.

WJW 11 hours ago [-]
Oh cool, thanks for providing the correct way around :)

Do you know if there is some type of guide around the state machines?

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 09:35:49 GMT+0000 (Coordinated Universal Time) with Vercel.