{"id":33926403,"url":"https://github.com/canmi21/kvmap","last_synced_at":"2025-12-12T10:12:52.519Z","repository":{"id":316426582,"uuid":"1063274102","full_name":"canmi21/kvmap","owner":"canmi21","description":"A path-driven, namespaced data store for Rust, powered by SQLite.","archived":false,"fork":false,"pushed_at":"2025-11-03T10:31:02.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-03T12:15:50.235Z","etag":null,"topics":["key","namespace","pathmap","rust","sql","value"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/pathmap","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/canmi21.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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-24T12:02:00.000Z","updated_at":"2025-11-03T11:15:04.000Z","dependencies_parsed_at":"2025-09-24T15:28:01.826Z","dependency_job_id":"99a683d6-8e20-427e-8149-355e879ffa41","html_url":"https://github.com/canmi21/kvmap","commit_stats":null,"previous_names":["canmi21/pathmap","canmi21/kvmap"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/canmi21/kvmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canmi21%2Fkvmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canmi21%2Fkvmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canmi21%2Fkvmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canmi21%2Fkvmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canmi21","download_url":"https://codeload.github.com/canmi21/kvmap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canmi21%2Fkvmap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27680599,"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","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"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":["key","namespace","pathmap","rust","sql","value"],"created_at":"2025-12-12T10:12:51.790Z","updated_at":"2025-12-12T10:12:52.509Z","avatar_url":"https://github.com/canmi21.png","language":"Rust","readme":"# Kvmap (formerly Pathmap)\n\n[![Crates.io](https://img.shields.io/crates/v/kvmap.svg)](https://crates.io/crates/kvmap)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Documentation](https://docs.rs/kvmap/badge.svg)](https://docs.rs/kvmap)\n\nKvmap is a path-driven, namespaced data store for Rust, powered by SQLite. It provides a simple and efficient way to store and retrieve data using a path-like syntax, such as `namespace::group.key`, with support for JSON-serializable values and asynchronous operations.\n\n## Features\n\n- **Path-based Access**: Store and retrieve data using a hierarchical path syntax (`namespace::group.key`).\n- **SQLite Backend**: Persistent storage with SQLite, ensuring reliability and performance.\n- **Asynchronous API**: Built with `tokio` and `sqlx` for non-blocking operations.\n- **Namespace Management**: Create, delete, and manage namespaces with ease.\n- **JSON Serialization**: Store and retrieve any JSON-serializable data using `serde`.\n- **Background Cleanup**: Automatic database maintenance with customizable intervals.\n- **Error Handling**: Comprehensive error handling with `thiserror`.\n\n## Installation\n\nAdd the following to your `Cargo.toml`:\n\n```toml\n[dependencies]\nkvmap = \"0.1\"\n```\n\nEnsure you have the required dependencies (`tokio`, `sqlx`, etc.) as specified in the `Cargo.toml` file.\n\n## Usage\n\nBelow is a quick example demonstrating how to use Pathmap. For a complete example, see the `examples/demo.rs` file.\n\n```rust\nuse kvmap::Pathmap;\nuse serde::{Deserialize, Serialize};\n\n#[derive(Serialize, Deserialize, Debug)]\nstruct User {\n    name: String,\n    email: String,\n}\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // Initialize Pathmap with a custom base path\n    let pm = Pathmap::new().with_base_path(\"/opt/ns\");\n\n    // Create a namespace\n    pm.init_ns(\"users\").await?;\n\n    // Store a value\n    let user = User {\n        name: \"John Doe\".to_string(),\n        email: \"john.doe@example.com\".to_string(),\n    };\n    pm.overwrite(\"users::profiles.john\", \u0026user).await?;\n\n    // Retrieve a value\n    let retrieved: User = pm.get(\"users::profiles.john\").await?;\n    println!(\"Retrieved: {:?}\", retrieved);\n\n    // Check existence\n    println!(\"Exists: {}\", pm.exists(\"users::profiles.john\").await?);\n\n    // Delete a value\n    pm.delete(\"users::profiles.john\").await?;\n\n    // Clean up namespace\n    pm.delete_ns(\"users\").await?;\n\n    Ok(())\n}\n```\n\n## Project Structure\n\n```\nkvmap/\n├── examples/\n│   └── demo.rs         # Example usage of Pathmap\n├── src/\n│   ├── db.rs           # SQLite database operations\n│   ├── error.rs        # Custom error types\n│   └── lib.rs          # Core Pathmap implementation\n├── .editorconfig       # Editor configuration\n├── .env                # Environment variables\n├── .gitattributes      # Git attributes\n├── .gitignore          # Git ignore file\n├── Cargo.lock          # Dependency lock file\n├── Cargo.toml          # Project manifest\n├── clay-config.json    # Configuration file\n└── LICENSE             # MIT License\n```\n\n## API Overview\n\n- **`Pathmap::new()`**: Creates a new Pathmap instance with the default base path (`/opt/pathmap/`).\n- **`with_base_path(path)`**: Overrides the default base path.\n- **`init_ns(ns)`**: Initializes a new namespace, creating a SQLite file.\n- **`delete_ns(ns)`**: Deletes a namespace and its SQLite file.\n- **`get\u003cT\u003e(path)`**: Retrieves a JSON-deserializable value from a path.\n- **`set\u003cT\u003e(path, value)`**: Sets a value at a path (fails if the key exists).\n- **`overwrite\u003cT\u003e(path, value)`**: Sets or updates a value at a path.\n- **`delete(path)`**: Deletes a value at a path.\n- **`exists(path)`**: Checks if a namespace, group, or value exists.\n- **`manual_cleanup(ns)`**: Triggers a manual database cleanup (VACUUM).\n- **`start_background_cleanup(interval, timeout)`**: Starts automatic cleanup for idle namespaces.\n\n## Dependencies\n\nPathmap relies on the following Rust crates:\n\n- `tokio = { version = \"1\", features = [\"full\"] }`\n- `fancy-log = \"0.1\"`\n- `sqlx = { version = \"0.8\", features = [\"runtime-tokio-native-tls\", \"sqlite\"] }`\n- `thiserror = \"2\"`\n- `shellexpand = \"3\"`\n- `serde = { version = \"1.0\", features = [\"derive\"] }`\n- `serde_json = \"1\"`\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please submit issues or pull requests to the [GitHub repository](https://github.com/canmi21/pathmap).\n\n## Contact\n\nFor questions or feedback, open an issue on the [GitHub repository](https://github.com/canmi21/pathmap).","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanmi21%2Fkvmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanmi21%2Fkvmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanmi21%2Fkvmap/lists"}