{"id":19665238,"url":"https://github.com/alttch/yedb-rs","last_synced_at":"2025-04-28T22:31:04.801Z","repository":{"id":57672722,"uuid":"340895862","full_name":"alttch/yedb-rs","owner":"alttch","description":"Rugged embedded and client/server key-value database (Rust implementation)","archived":false,"fork":false,"pushed_at":"2025-01-18T01:41:50.000Z","size":233,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T11:24:19.348Z","etag":null,"topics":["client-server","crash-free","database","iot","key-value","reliable","rugged","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alttch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-02-21T12:26:56.000Z","updated_at":"2025-01-18T01:41:51.000Z","dependencies_parsed_at":"2024-03-05T02:57:39.497Z","dependency_job_id":null,"html_url":"https://github.com/alttch/yedb-rs","commit_stats":{"total_commits":198,"total_committers":1,"mean_commits":198.0,"dds":0.0,"last_synced_commit":"77d45d4cb17281422c8616249b3451f3c62dc587"},"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alttch%2Fyedb-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alttch%2Fyedb-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alttch%2Fyedb-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alttch%2Fyedb-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alttch","download_url":"https://codeload.github.com/alttch/yedb-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251318165,"owners_count":21570303,"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":["client-server","crash-free","database","iot","key-value","reliable","rugged","rust"],"created_at":"2024-11-11T16:21:44.175Z","updated_at":"2025-04-28T22:31:04.399Z","avatar_url":"https://github.com/alttch.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yedb - rugged crash-free embedded and client/server key-value database (Rust implementation)\n\n## Cargo crate\n\n[crates.io/crates/yedb](https://crates.io/crates/yedb)\n\nFeatures:\n\n- **client-sync** synchronous client\n- **client-async** asynchronous client\n- **cli** yedb-cli\n- **server** yedb-server\n\n## Why YEDB?\n\n- Is it fast?\n- Rust version is pretty fast, except writes are still slow if auto-flush is\n  enabled.\n\n- Is it smart?\n- No\n\n- So what is YEDB for?\n- YEDB is ultra-reliable, thread-safe and very easy to use.\n\n- I don't like Rust\n- There are other [implementations](https://yedb.bma.ai).\n\n[![Power loss data survive\ndemo](https://img.youtube.com/vi/i3hSWjrNqLo/0.jpg)](https://www.youtube.com/watch?v=i3hSWjrNqLo)\n\n\u003chttps://www.youtube.com/watch?v=i3hSWjrNqLo\u003e\n\n\nYEDB is absolutely reliable rugged key-value database, which can survive in any\npower loss, unless the OS file system die. Keys data is saved in the very\nreliable way and immediately flushed to disk (this can be disabled to speed up\nthe engine but is not recommended - why then YEDB is used for).\n\n## Rust version features\n\n- Rust version is built on top of [Serde](https://serde.rs) framework.\n\n- All key values are *serde_json::Value* objects.\n\n- Storage serialization formats supported: JSON (default), YAML, MessagePack\n  and CBOR.\n\n- As byte type is not supported by *serde_json::Value* at this moment, Rust\n  version can not handle byte key values.\n\n- Contains: embedded library, async server and command-line client (TCP/Unix\n  socket only).\n\n- The command-line client is very basic. If you need more features, use [yedb\n  Python CLI](https://github.com/alttch/yedb-py).\n\n## Additional features over YEDB specs\n\n- \"delete\" command does not delete keys, they are moved to .trash folder\n  instead\n\n- .trash folder is being cleaned when \"purge\" method is invoked.\n\n- \"auto\\_bak\" property tells server to automatically create backup key versions\n  when key data is modified\n\n- \"bak\" keys are hidden\n\n## Client/server\n\nBinaries available at the [releases\npage](https://github.com/alttch/yedb-rs/releases).\n\nRun server:\n\n```shell\n./yedb-server /tmp/db1\n```\n\nUse client:\n\n```shell\n# get server info\n./yedb-cli info\n# set key value\n./yedb-cli set x 5 -p number\n# list all keys\n./yedb-cli ls /\n# edit key with $EDITOR\n./yedb-cli edit x\n# get key as JSON\n./yedb-cli get x\n# get help for all commands\n./yedb-cli -h\n```\n\n## Code examples\n\nThe database/client objects can be safely shared between threads using any kind\nof Lock/Mutex preferred.\n\n### Embedded example\n\n```rust,ignore\nuse yedb::Database;\nuse serde_json::Value;\n\nlet mut db = Database::new();\ndb.set_db_path(\"/tmp/db1\").unwrap();\ndb.open().unwrap();\nlet key_name = \"test/key1\";\ndb.key_set(\u0026key_name, Value::from(123_u8)).unwrap();\nprintln!(\"{:?}\", db.key_get(\u0026key_name));\ndb.key_delete(\u0026key_name).unwrap();\ndb.close().unwrap();\n```\n\n### TCP/Unix socket client example\n\n```rust,ignore\nuse yedb::YedbClient;\nuse serde_json::Value;\n\nlet mut client = YedbClient::new(\"tcp://127.0.0.1:8870\");\nlet key_name = \"test/key1\";\nclient.key_set(\u0026key_name, Value::from(123_u8)).unwrap();\nprintln!(\"{:?}\", client.key_get(\u0026key_name));\nclient.key_delete(\u0026key_name).unwrap();\n```\n\n### Async TCP/Unix socket client example\n\n```rust,ignore\nuse serde_json::Value;\nuse yedb::{YedbClientAsync, YedbClientAsyncExt};\n\nasync fn test() {\n    let mut client = YedbClientAsync::new(\"tcp://127.0.0.1:8870\");\n    let key_name = \"test/key1\";\n    client.key_set(\u0026key_name, Value::from(123_u8)).await.unwrap();\n    println!(\"{:?}\", client.key_get(\u0026key_name).await);\n    client.key_delete(\u0026key_name).await.unwrap();\n}\n```\n\n### Async TCP/Unix socket client pool example\n\n```rust,ignore\nuse serde_json::Value;\nuse std::sync::Arc;\nuse std::time::Duration;\nuse yedb::{YedbClientPoolAsync, YedbClientAsyncExt};\n\nasync fn test() {\n    let pool = Arc::new(\n        YedbClientPoolAsync::create()\n            .size(10)\n            .path(\"tcp://127.0.0.1:8870\")\n            .retries(3)\n            .timeout(Duration::from_secs(2))\n            .build()\n    );\n    let mut futs = Vec::new();\n    for i in 0..10 {\n        let task_pool = pool.clone();\n        let fut = tokio::spawn(async move {\n            let mut client = task_pool.get().await;\n            let key = format!(\"test/key{}\", i);\n            client.key_set(\u0026key, Value::from(i)).await.unwrap();\n            println!(\"{}\", client.key_get(\u0026key).await.unwrap());\n            client.key_delete(\u0026key).await.unwrap();\n        });\n        futs.push(fut);\n    }\n    for fut in futs {\n        fut.await.unwrap();\n    }\n}\n```\n\n## Specification\n\n[yedb.bma.ai](https://yedb.bma.ai/)\n\n## Some benchmark data\n\n* CPU: Intel Core i7-8550U (4 cores)\n* Drive: Samsung MZVLB512HAJQ-000L7 (NVMe)\n\n- auto\\_flush: false\n- connection: Unix socket\n- server workers: 2\n- client threads: 4\n\n```shell\nset/number: 8164 ops/sec\nset/string: 7313 ops/sec\nset/array: 7152 ops/sec\nset/object: 5272 ops/sec\n\nget/number: 49709 ops/sec\nget/string: 33338 ops/sec\nget/array: 31426 ops/sec\nget/object: 11654 ops/sec\n\nget(cached)/number: 122697 ops/sec\nget(cached)/string: 61206 ops/sec\nget(cached)/array: 59309 ops/sec\nget(cached)/object: 34583 ops/sec\n\nincrement: 7079 ops/sec\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falttch%2Fyedb-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falttch%2Fyedb-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falttch%2Fyedb-rs/lists"}