{"id":17218741,"url":"https://github.com/ysimonson/binlog","last_synced_at":"2026-03-10T04:04:43.055Z","repository":{"id":40434044,"uuid":"476528178","full_name":"ysimonson/binlog","owner":"ysimonson","description":"A rust library for creating and managing logs of arbitrary binary data.","archived":false,"fork":false,"pushed_at":"2022-05-09T02:52:46.000Z","size":142,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-27T08:21:04.202Z","etag":null,"topics":["database","library","log","python","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ysimonson.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":"2022-04-01T01:03:45.000Z","updated_at":"2025-02-17T07:42:31.000Z","dependencies_parsed_at":"2022-08-09T20:20:37.442Z","dependency_job_id":null,"html_url":"https://github.com/ysimonson/binlog","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ysimonson/binlog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysimonson%2Fbinlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysimonson%2Fbinlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysimonson%2Fbinlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysimonson%2Fbinlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ysimonson","download_url":"https://codeload.github.com/ysimonson/binlog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysimonson%2Fbinlog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30324185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T01:36:58.598Z","status":"online","status_checked_at":"2026-03-10T02:00:06.579Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","library","log","python","rust"],"created_at":"2024-10-15T03:48:00.510Z","updated_at":"2026-03-10T04:04:43.035Z","avatar_url":"https://github.com/ysimonson.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# binlog\n\n[![Test](https://github.com/ysimonson/binlog/actions/workflows/test.yml/badge.svg)](https://github.com/ysimonson/binlog/actions/workflows/test.yml)\n[![crates.io](https://img.shields.io/crates/v/binlog.svg)](https://crates.io/crates/binlog)\n[![API docs](https://docs.rs/binlog/badge.svg)](https://docs.rs/binlog)\n\nA rust library for creating and managing logs of arbitrary binary data. Presently it's used to collect sensor data. But it should generally be helpful in cases where you need to store timeseries data, in a nearly (but not strictly) append-only fashion.\n\nThe underlying storage of logs are pluggable via a few [traits](https://github.com/ysimonson/binlog/blob/main/src/stores/traits.rs). Binlog includes built-in implementations via sqlite, redis, and in-memory-only. Additionally, python bindings allow you to use (a subset of) binlog from python.\n\n## Usage\n\n### From Rust\n\nA small example:\n\n```rust\nuse binlog::{Entry, Error, Range, RangeableStore, SqliteStore, Store};\nuse std::borrow::Cow;\nuse string_cache::Atom;\n\n/// Demonstrates the sqlite store, with results in `example.db`. You may want to delete that before\n/// running this to see the results of this on an empty database.\nfn main() -\u003e Result\u003c(), Error\u003e {\n    // Create a new datastore with sqlite backing. The result will be stored in example.db, with\n    // default compression options. In-memory is also possible via\n    // `binlog::MemoryStore::default()`.\n    let store = SqliteStore::new(\"example.db\", None)?;\n\n    // Add 10 entries.\n    for i in 1..11u8 {\n        let entry = Entry::new_with_timestamp(i as i64, Atom::from(\"sqlite_example\"), vec![i]);\n        store.push(Cow::Owned(entry))?;\n    }\n\n    // Queries are done via `range`. Here we grab entries with any timestamp and any name.\n    let range = store.range(.., Option::\u003cString\u003e::None)?;\n    // Count the number of entries.\n    println!(\"initial count: {}\", range.count()?);\n    // We can also iterate on the entries.\n    for entry in range.iter()? {\n        println!(\"entry: {:?}\", entry?);\n    }\n\n    // Remove the entries with 4 \u003c= ts \u003c= 6 and with the name `sqlite_example`.\n    store.range(4..=6, Some(Atom::from(\"sqlite_example\")))?.remove()?;\n\n    // Now get the range of entries with 5 \u003c= ts and with the name `sqlite_example`.\n    let range = store.range(5.., Some(Atom::from(\"sqlite_example\")))?;\n    println!(\"count after range deletion: {}\", range.count()?);\n    for entry in range.iter()? {\n        println!(\"entry: {:?}\", entry?);\n    }\n\n    Ok(())\n}\n```\n\n### From Python\n\nA small example:\n\n```python\nfrom binlog import binlog\nstore = binlog.SqliteStore(\"example.db\")\nstore.push(binlog.Entry(1, \"pytest_push\", [1, 2, 3]))\n```\n\n## Stores\n\nStores implement the [`Store` trait, and zero or more optional extensions](https://github.com/ysimonson/binlog/blob/main/src/stores/traits.rs) depending on their supported functionality. A few stores implementations are built-in to `binlog`:\n\n### In-memory-only\n\nThe in-memory-only store has no means of persistence, but offers the full log functionality. This is also used internally for fuzzing other implementations against.\n\n### Redis\n\nThe redis implementation is enableable via the `redis-store` feature. Under the hood, it uses redis streams. It supports subscriptions, but not ranges.\n\n### Sqlite\n\nThe sqlite implementation is enableable via the `sqlite-store` feature. It supports ranges, but not subscriptions.\n\n## Testing\n\n### Unit tests\n\nTests can be run via `make test`. This will also be run in CI.\n\n### Benchmarks\n\nBenchmarks can be run via `make bench`.\n\n### Fuzzing\n\nA fuzzer is available, ensuring the the sqlite and in-memory datastores operate identically. Run it via `make fuzz`.\n\n### Checks\n\nLint and formatting checks can be run via `make check`. Equivalent checks will also run in CI.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysimonson%2Fbinlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fysimonson%2Fbinlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysimonson%2Fbinlog/lists"}