Get Store
Retrieves detailed information about a specific store by name. Returns metadata including dimensions, size, and configured indices.
Source Code Exampleβ
Click to expand
use ahnlich_client_rs::db::DbClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let db_client = DbClient::new("127.0.0.1:1369".to_string()).await?;
let tracing_id: Option<String> = None;
let store_info = db_client
.get_store("my_store".to_string(), tracing_id)
.await?;
println!("Store name: {}", store_info.name);
println!("Number of entries: {}", store_info.len);
println!("Size in bytes: {}", store_info.size_in_bytes);
println!("Dimension: {}", store_info.dimension);
println!("Predicate indices: {:?}", store_info.predicate_indices);
println!("Non-linear indices: {:?}", store_info.non_linear_indices);
Ok(())
}
Parametersβ
-
store: Stringβ The name of the store to retrieve. -
tracing_id: Option<String>β Optional trace context for observability.
Returnsβ
-
StoreInfoβ Detailed information about the store. -
AhnlichErrorβ If the store does not exist or the request fails.
StoreInfo Fieldsβ
| Field | Type | Description |
|---|---|---|
name | String | Store name |
len | u64 | Number of entries in the store |
size_in_bytes | u64 | Total size of the store in bytes |
dimension | u32 | Vector dimension |
predicate_indices | Vec<String> | List of indexed predicate keys |
non_linear_indices | Vec<NonLinearIndex> | List of non-linear algorithm indices |
Behaviorβ
-
Sends a request to retrieve store metadata by name.
-
Returns an error if the store does not exist.
-
Useful for inspecting store configuration before operations.
Notesβ
- Use
list_storesto get information about all stores - The
size_in_bytesfield is useful for monitoring memory usage