### Get Item Source: https://github.com/fjall-rs/fjall/blob/main/examples/actix-kv/README.md Retrieves a single item by its key. ```APIDOC ## GET /{key} ### Description Returns a single item. ### Method GET ### Endpoint /\{key\} ``` -------------------------------- ### Basic Fjall Database Usage in Rust Source: https://github.com/fjall-rs/fjall/blob/main/README.md Demonstrates opening a database, creating a keyspace, inserting, getting, removing data, and performing prefix and range searches. Iterators support reverse traversal. Data durability can be ensured by calling `persist`. ```rust use fjall::{Database, KeyspaceCreateOptions, PersistMode}; fn main() -> fjall::Result<()> { // A database may contain multiple keyspaces // You should probably only use a single database for your application let db = Database::builder(path).open()?; // TxDatabase::builder for transactional semantics // Each keyspace is its own physical LSM-tree, and thus isolated from other keyspaces let items = db.keyspace("my_items", KeyspaceCreateOptions::default)?; // Write some data items.insert("a", "hello")?; // And retrieve it let bytes = items.get("a")?; // Or remove it again items.remove("a")?; // Search by prefix for kv in items.prefix("prefix") { // ... } // Search by range for kv in items.range("a"..="z") { // ... } // Iterators implement DoubleEndedIterator, so you can search backwards, too! for kv in items.prefix("prefix").rev() { // ... } // Sync the journal to disk to make sure data is definitely durable // When the database is dropped, it will try to persist with `PersistMode::SyncAll` automatically db.persist(PersistMode::SyncAll) } ``` -------------------------------- ### Get Item Source: https://github.com/fjall-rs/fjall/blob/main/examples/axum-kv/README.md Retrieves a single item from the key-value store by its key. ```APIDOC ## GET /{key} ### Description Returns a single item. ### Method GET ### Endpoint /`{key}` ### Parameters #### Path Parameters - **key** (string) - Required - The key of the item to retrieve. ``` -------------------------------- ### Add Fjall Dependency to Cargo Project Source: https://github.com/fjall-rs/fjall/blob/main/README.md Use this command to add the Fjall crate as a dependency in your Rust project. ```bash cargo add fjall ``` -------------------------------- ### Batch Upsert/Remove Source: https://github.com/fjall-rs/fjall/blob/main/examples/axum-kv/README.md Atomically upserts and/or removes items from the key-value store. ```APIDOC ## POST /batch ### Description Upserts and/or removes items in an atomic batch. ### Method POST ### Endpoint /batch ### Request Body - **upsert** (array) - Optional - An array of key-value pairs to upsert. - **remove** (array) - Optional - An array of keys to remove. ### Request Example ```json { "upsert": [ ["key", "value"] ], "remove": ["another_key"] } ``` ``` -------------------------------- ### Upsert Item Source: https://github.com/fjall-rs/fjall/blob/main/examples/axum-kv/README.md Upserts a single item into the key-value store. ```APIDOC ## PUT /{key} ### Description Upserts an item. ### Method PUT ### Endpoint /`{key}` ### Parameters #### Path Parameters - **key** (string) - Required - The key of the item to upsert. ### Request Body - **item** (JSON) - Required - The JSON value to store for the given key. ### Request Example ```json { "item": SOME_JSON_VALUE } ``` ``` -------------------------------- ### Batch Upsert/Remove Operation Source: https://github.com/fjall-rs/fjall/blob/main/examples/actix-kv/README.md Use this JSON payload to atomically upsert and/or remove multiple items from the key-value store. ```json { "upsert": [ ["key", "value"] ], "remove": ["another_key"] } ``` -------------------------------- ### Single Item Upsert Operation Source: https://github.com/fjall-rs/fjall/blob/main/examples/actix-kv/README.md Use this JSON payload to upsert a single item into the key-value store. Replace SOME_JSON_VALUE with your actual JSON data. ```json { "item": SOME_JSON_VALUE } ``` -------------------------------- ### Upsert Item Source: https://github.com/fjall-rs/fjall/blob/main/examples/actix-kv/README.md Upserts a single item identified by its key. ```APIDOC ## PUT /{key} ### Description Upserts an item. ### Method PUT ### Endpoint /\{key\} ### Request Body - **item** (JSON value) - Required - The JSON value to store for the given key. ### Request Example ```json { "item": SOME_JSON_VALUE } ``` ``` -------------------------------- ### Batch Upsert/Remove Source: https://github.com/fjall-rs/fjall/blob/main/examples/actix-kv/README.md Upserts and/or removes items in an atomic batch. Accepts a JSON object with optional 'upsert' and 'remove' fields. ```APIDOC ## POST /batch ### Description Upserts and/or removes items in an atomic batch. ### Method POST ### Endpoint /batch ### Request Body - **upsert** (array of arrays) - Optional - An array of key-value pairs to upsert. - **remove** (array of strings) - Optional - An array of keys to remove. ### Request Example ```json { "upsert": [ ["key", "value"] ], "remove": ["another_key"] } ``` ``` -------------------------------- ### Delete Item Source: https://github.com/fjall-rs/fjall/blob/main/examples/axum-kv/README.md Deletes a single item from the key-value store by its key. ```APIDOC ## DELETE /{key} ### Description Deletes an item. ### Method DELETE ### Endpoint /`{key}` ### Parameters #### Path Parameters - **key** (string) - Required - The key of the item to delete. ``` -------------------------------- ### Delete Item Source: https://github.com/fjall-rs/fjall/blob/main/examples/actix-kv/README.md Deletes a single item by its key. ```APIDOC ## DELETE /{key} ### Description Deletes an item. ### Method DELETE ### Endpoint /\{key\} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.