{"id":21163336,"url":"https://github.com/arthurdw/firefly","last_synced_at":"2025-07-06T12:03:03.294Z","repository":{"id":56743507,"uuid":"518040227","full_name":"Arthurdw/firefly","owner":"Arthurdw","description":"A \"blazingly\" fast key-value pair database without bloat written in rust","archived":false,"fork":false,"pushed_at":"2023-12-02T12:54:26.000Z","size":252,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-12-02T13:38:08.276Z","etag":null,"topics":["database","rust","session"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Arthurdw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-07-26T11:51:20.000Z","updated_at":"2023-12-02T13:38:11.319Z","dependencies_parsed_at":"2023-12-02T13:48:22.567Z","dependency_job_id":null,"html_url":"https://github.com/Arthurdw/firefly","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arthurdw%2Ffirefly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arthurdw%2Ffirefly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arthurdw%2Ffirefly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Arthurdw%2Ffirefly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Arthurdw","download_url":"https://codeload.github.com/Arthurdw/firefly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225567312,"owners_count":17489479,"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":["database","rust","session"],"created_at":"2024-11-20T13:45:53.686Z","updated_at":"2024-11-20T13:45:54.132Z","avatar_url":"https://github.com/Arthurdw.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Firefly](./assets/logo.png)\n\nA fast key-value pair in memory database. With a very simple and fast API. At\n[Xiler](https://www.xiler.net) it gets used to store and manage client sessions\nthroughout the platform.\n\n![CLI help menu](https://user-images.githubusercontent.com/38541241/184537875-5fcbdfd3-3da8-429e-ab34-f755e5ee3192.png)\n\n## Installation\n\n**Cargo:**\n`$ cargo install ffly`\n\n**AUR:**\n`$ paru -S ffly`\n\n**Docker image:**\n[arthurdw/firefly](https://hub.docker.com/r/arthurdw/firefly)\n\n## Performance comparison\n\n| Database                                         | ops  |\n| ------------------------------------------------ | ---- |\n| Firefly                                          | 167k |\n| [Skytable](https://github.com/skytable/skytable) | 143k |\n| [Redis](https://github.com/redis/redis)          | 67k  |\n\n_(`push_it` scripts can be found in `ffly-rs/examples/`)_\n\n## Query Language\n\nFirefly only has three data operators, `NEW`, `GET`, `DROP`. We'll walk over\neach one.\n\n### Important note on values\n\nALL values must be valid ASCII, if not the server will reject the query.\n\n### Defining query types\n\nThe server may only accept one query type per TCP connection type. The default\ntype is a string query. But this can be changed by using the `QUERY TYPE`\nkeyword.\n\n```ffly\nQUERY TYPE 'STRING' | 'BITWISE';\n```\n\n### String queries\n\nThe simplest way to query something is by querying it using a string query. But\nbecause the parsing, and bandwidth of this is more than that is necessary we\nalso provide bitwise queries.\n\nString queries are very loosely defined, as it evaluates the query definition\nfrom left to right. And can derive that if you use e.g. `GETV`, you mean\n`GET VALUE`. This works for any query, identifiers are case-insensitive.\n\n#### Create\n\nYou can create a new record by using the `NEW` keyword, the arguments should be\nwrapped within quotes. The first argument _(after `NEW`)_ is the key, this\nshould be unique throughout the db. If no TLL value is provided, the server\nwill use 0 _(aka no expiry)_.\n\n```ffly\nNEW '{key}'\n[ VALUE ] '{value}'\n[ WITH TTL '{ttl}'];\n```\n\n##### Create examples\n\n```ffly\nNEW 's2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y'\nVALUE '86ebe1a0-11bf-11ed-aa8e-13602e2ad46b';\n```\n\n```ffly\nNEW 's2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y'\nVALUE '86ebe1a0-11bf-11ed-aa8e-13602e2ad46b'\nWITH TTL '604800';\n```\n\n#### Fetch\n\nThe `GET` keyword returns the value and TTL by default. But if you only want\none of the two, you can specify this. You can only search by key!\n\n```ffly\nGET [VALUE | TTL] '{key}';\n```\n\n##### Fetch examples\n\n```ffly\nGET 's2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y';\n```\n\n```ffly\nGET TTL 's2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y';\n```\n\n#### Delete\n\nDeleting one record is as straightforward as fetching one. You can only delete\nwhole records. If required all records that have a value can also be deleted,\nbut this action is very expensive and generally not recommended.\n\n```ffly\nDROP '{key}';\nDROP ALL '{value}';\n```\n\n### Bitwise queries\n\nBecause string queries can consume more resources than what is required, there\nis a more efficient _(less friendly)_ way to interact with Firefly. This is by\nsending the bits in a specific format. This section just describes the formats,\nif you want more information about the queries itself, then you can find it in\nthe `String queries` section.\n\nPlease keep in mind that all the bitwise queries are very strict, and if a\nquery is unrecognized it will discard it.\n\n#### General notes\n\n-   All values are delimited by a NUL character. _(`0x0`)_\n-   The end of the query is assumed to be the last byte.\n-   Queries start with their type, this is a numeric value\n    -   0: `NEW`\n    -   1: `GET`\n    -   2: `GET VALUE`\n    -   3: `GET TTL`\n    -   4: `DROP`\n    -   5: `DROP ALL`\n    -   6: `QUERY TYPE STRING`\n    -   7: `QUERY TYPE BITWISE`\n-   The query type does not need to be delimited\n\n#### Bitwise create\n\nA with TTL must always be provided. If you don't want a TTL set this to 0.\n\n`0{key}0x0{value}0x0{ttl}`\n\nThese are the two same create examples from the string queries:\n`0s2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y0x086ebe1a0-11bf-11ed-aa8e-13602e2ad46b0x0`\n`0s2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y0x086ebe1a0-11bf-11ed-aa8e-13602e2ad46b0x0602800`\n\n#### Bitwise fetch\n\n`1s2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y`\n`2s2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y`\n`3s2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y`\n\n#### Bitwise delete\n\n`4s2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y`\n`5s2.8eqYursP2McHeQvHB2bauyE6n3vptOj8M96PxmGAQMDfimeZ31WAzP3hSw5Ixv5Y`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurdw%2Ffirefly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farthurdw%2Ffirefly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurdw%2Ffirefly/lists"}