pub struct AmateRSClient { /* private fields */ }Expand description
AmateRS client for interacting with the database
The client manages connections, handles retries, and provides high-level operations for working with encrypted data.
Implementations§
Source§impl AmateRSClient
impl AmateRSClient
Sourcepub async fn connect(addr: impl Into<String>) -> Result<Self>
pub async fn connect(addr: impl Into<String>) -> Result<Self>
Connect to an AmateRS server
§Example
use amaters_sdk_rust::AmateRSClient;
let client = AmateRSClient::connect("http://localhost:50051").await?;Sourcepub async fn connect_with_config(config: ClientConfig) -> Result<Self>
pub async fn connect_with_config(config: ClientConfig) -> Result<Self>
Connect with a custom configuration
§Example
use amaters_sdk_rust::{AmateRSClient, ClientConfig};
use std::time::Duration;
let config = ClientConfig::new("http://localhost:50051")
.with_connect_timeout(Duration::from_secs(5))
.with_max_connections(20);
let client = AmateRSClient::connect_with_config(config).await?;Sourcepub fn with_encryptor(self, encryptor: FheEncryptor) -> Self
pub fn with_encryptor(self, encryptor: FheEncryptor) -> Self
Set the FHE encryptor for client-side encryption
Sourcepub fn encryptor(&self) -> Option<&Arc<FheEncryptor>>
pub fn encryptor(&self) -> Option<&Arc<FheEncryptor>>
Get the encryptor (if set)
Sourcepub async fn set(
&self,
collection: &str,
key: &Key,
value: &CipherBlob,
) -> Result<()>
pub async fn set( &self, collection: &str, key: &Key, value: &CipherBlob, ) -> Result<()>
Set a key-value pair
§Example
use amaters_sdk_rust::AmateRSClient;
use amaters_core::{Key, CipherBlob};
let key = Key::from_str("user:123");
let value = CipherBlob::new(vec![1, 2, 3, 4]);
client.set("users", &key, &value).await?;Sourcepub async fn get(
&self,
collection: &str,
key: &Key,
) -> Result<Option<CipherBlob>>
pub async fn get( &self, collection: &str, key: &Key, ) -> Result<Option<CipherBlob>>
Get a value by key
Returns None if the key doesn’t exist.
§Example
use amaters_sdk_rust::AmateRSClient;
use amaters_core::Key;
let key = Key::from_str("user:123");
if let Some(value) = client.get("users", &key).await? {
println!("Found value: {} bytes", value.len());
}Sourcepub async fn delete(&self, collection: &str, key: &Key) -> Result<()>
pub async fn delete(&self, collection: &str, key: &Key) -> Result<()>
Delete a key
§Example
use amaters_sdk_rust::AmateRSClient;
use amaters_core::Key;
let key = Key::from_str("user:123");
client.delete("users", &key).await?;Sourcepub async fn contains(&self, collection: &str, key: &Key) -> Result<bool>
pub async fn contains(&self, collection: &str, key: &Key) -> Result<bool>
Check if a key exists
§Example
use amaters_sdk_rust::AmateRSClient;
use amaters_core::Key;
let key = Key::from_str("user:123");
if client.contains("users", &key).await? {
println!("Key exists");
}Sourcepub async fn execute_query(&self, query: &Query) -> Result<QueryResult>
pub async fn execute_query(&self, query: &Query) -> Result<QueryResult>
Execute a query
This is a lower-level method that executes arbitrary queries.
§Example
use amaters_sdk_rust::AmateRSClient;
use amaters_core::{Query, Key};
let query = Query::Get {
collection: "users".to_string(),
key: Key::from_str("user:123"),
};
client.execute_query(&query).await?;Sourcepub async fn execute_batch(
&self,
queries: Vec<Query>,
) -> Result<Vec<QueryResult>>
pub async fn execute_batch( &self, queries: Vec<Query>, ) -> Result<Vec<QueryResult>>
Execute a batch of queries
All queries are executed atomically (all succeed or all fail).
Sourcepub fn pool_stats(&self) -> PoolStats
pub fn pool_stats(&self) -> PoolStats
Get connection pool statistics
Sourcepub async fn health_check(&self) -> Result<()>
pub async fn health_check(&self) -> Result<()>
Health check
Returns Ok(()) if the server is healthy.
Sourcepub async fn server_info(&self) -> Result<ServerInfo>
pub async fn server_info(&self) -> Result<ServerInfo>
Get server information
Returns information about the server including version, capabilities, and uptime.
Sourcepub async fn range(
&self,
collection: &str,
start: &Key,
end: &Key,
) -> Result<Vec<(Key, CipherBlob)>>
pub async fn range( &self, collection: &str, start: &Key, end: &Key, ) -> Result<Vec<(Key, CipherBlob)>>
Range query - retrieve keys in a range
§Example
use amaters_sdk_rust::AmateRSClient;
use amaters_core::Key;
let start = Key::from_str("user:000");
let end = Key::from_str("user:999");
let results = client.range("users", &start, &end).await?;
println!("Found {} keys in range", results.len());Trait Implementations§
Source§impl Clone for AmateRSClient
impl Clone for AmateRSClient
Source§fn clone(&self) -> AmateRSClient
fn clone(&self) -> AmateRSClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AmateRSClient
impl !RefUnwindSafe for AmateRSClient
impl Send for AmateRSClient
impl Sync for AmateRSClient
impl Unpin for AmateRSClient
impl !UnwindSafe for AmateRSClient
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.