{"id":17251051,"url":"https://github.com/fumieval/liszt","last_synced_at":"2025-04-14T05:19:17.304Z","repository":{"id":56846122,"uuid":"89127786","full_name":"fumieval/liszt","owner":"fumieval","description":"Publish \u0026 Subscribe","archived":false,"fork":false,"pushed_at":"2020-12-15T15:28:00.000Z","size":155,"stargazers_count":13,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T19:07:49.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fumieval.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-23T08:29:11.000Z","updated_at":"2020-12-31T16:18:08.000Z","dependencies_parsed_at":"2022-09-09T01:00:13.304Z","dependency_job_id":null,"html_url":"https://github.com/fumieval/liszt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fliszt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fliszt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fliszt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fliszt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fumieval","download_url":"https://codeload.github.com/fumieval/liszt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248732359,"owners_count":21152844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T06:50:12.960Z","updated_at":"2025-04-14T05:19:17.287Z","avatar_url":"https://github.com/fumieval.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Liszt\n\nLiszt is an append-only key-list database.\n\n## Insertion\n\nFor the sake of reliability, insertion is performed locally.\nInsertions can be batched up to one commit in order to reduce overheads.\n\n```haskell\ncommitFile :: FilePath -\u003e Transaction a -\u003e IO a\ninsert :: Key -\u003e Builder -\u003e Transaction ()\n\n\u003e commitFile \"foo.liszt\" $ insert \"message\" \"hello, world\"\n```\n\n## Query\n\n`lisztd` starts a server. The first argument is the root directory to find liszt\nfiles.\n\n```\n$ lisztd .\n```\n\nYou can use the command line utility to watch a stream. `-b 0` follows a stream\nfrom offset 0. `-f \"%p\\n\"` prints payloads with newlines.\n\n```\n$ liszt foo.liszt message -b 0 -f \"%p\\n\"\nhello, world\n```\n\n# Representation\n\nLiszt employs a 2-3 tree (special case of B tree) of skew binary random access lists as its on-disk format.\n\nA liszt file consists of six types of contents: keys, payloads, tags, nodes, trees, and a footer.\n\n`Key`s, `Tag`s, and `Payload`s are bytestrings with arbitrary length.\n\nA pointer to a content with type `t` is denoted by `P t`.\nIt's a pair of the byte offset and the length of the content, encoded in unsigned VLQ.\n\nA node is one of the following:\n\n* Empty node: `0x00`\n* 1-leaf: `0x01 (P Key) Spine`\n* 2-leaf: `0x02 (P Key) Spine (P Key) Spine`\n* 2-node: `0x12 (P Node) (P Key) Spine (P Node)`\n* 3-node: `0x13 (P Node) (P Key) Spine (P Node) (P Key) Spine (P Node)`\n\nSpine is a list of pairs of:\n\n* Rank: the number of payloads in a tree\n* Pointer to a tree\n\nSpine prefixed by the length of the list.\n\n* `Spine`: `Int [Int (P Tree)]`\n\nTree is either\n\n* Tip: `0x80 Int Tag (P Payload)`\n* Bin: `0x81 Int Tag (P Payload) (P Node) (P Node)`\n\nwhere the Int represents the length of the `Tag`.\n\nA footer is a root node padded to 256 bytes long, and the padding must end with the following byte sequence:\n\n```\n8df4 c865 fa3d 300a f3f8 9962 e049 e379 489c e4cd 2b52 a630 5584 004c 4953 5a54\n```\n\n(the last 5 bytes are \"LISZT\")\n\nCommitting is performed in the following steps. This append-only scheme grants robustness to some extent.\n\n* Read the root node from the file.\n* Append payloads.\n* Append a new footer.\n\nWhen an exception occurs in the middle, it will put the original footer to prevent corruption\n(TODO: find the last footer in case of corrupted file).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumieval%2Fliszt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffumieval%2Fliszt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumieval%2Fliszt/lists"}