TigerBeetle as a File Storage
8 days ago
- #FileStorage
- #TigerBeetle
- #DoubleEntryBookkeeping
- TigerBeetle is a high-performance, reliable database for financial accounting, capable of handling double-entry bookkeeping with exceptional durability.
- The author explores using TigerBeetle for file storage by encoding filenames and metadata in Account records and file data in Transfer records.
- File storage implementation involves storing filenames in the Account's `id` field, file size in `user_data_64`, and filename length in `user_data_32`.
- File data is stored in Transfer records using `user_data_128`, `user_data_64`, and `user_data_32` fields, with the `amount` field indicating bytes used.
- Double-entry bookkeeping ensures auditability, with transfers from a system file to the target file for tracking.
- File retrieval involves querying credit Transfers for a specific Account, ordered by timestamp.
- Performance tests show file storage at ~642 kB/s and retrieval at ~2,228 kB/s, with data integrity verified via SHA-256 checksums.