Struct cipherstash_client::stash::Stash
source · pub struct Stash<Client, Data> { /* private fields */ }Expand description
The interface between the client and the data service.
This struct manages encrypting and decrypting records and metadata, encrypting queries and inserting and retrieving records.
It communicates with the data service through a gRPC client.
Implementations§
source§impl Stash<Channel, NativeClientData>
impl Stash<Channel, NativeClientData>
sourcepub fn try_from_config(config: &Config) -> Result<Self, CreateClientError>
pub fn try_from_config(config: &Config) -> Result<Self, CreateClientError>
Try and create a native client from a resolved Config
source§impl<Client, Data> Stash<Client, Data>where
Client: GrpcService<BoxBody>,
Client::ResponseBody: Body + Send + 'static,
Client::Error: Into<StdError>,
<Client::ResponseBody as Body>::Error: Into<StdError> + Send,
Data: GetAccessToken + GetCipherEngine,
impl<Client, Data> Stash<Client, Data>where
Client: GrpcService<BoxBody>,
Client::ResponseBody: Body + Send + 'static,
Client::Error: Into<StdError>,
<Client::ResponseBody as Body>::Error: Into<StdError> + Send,
Data: GetAccessToken + GetCipherEngine,
sourcepub fn new(client: Client, data: Data) -> Self
pub fn new(client: Client, data: Data) -> Self
Create a new Stash instance from a gRPC client, encryption key provider and access token provider.
pub async fn delete_collection(
&mut self,
collection_ref: &[u8]
) -> Result<(), DeleteCollectionError>
pub async fn list_collections(
&mut self
) -> Result<ListCollectionsResponse, ListCollectionsError>
pub async fn get_all(
&mut self,
collection: &Collection,
ids: Vec<Uuid>
) -> Result<Vec<Record>, GetAllError>
pub async fn delete_record(
&mut self,
collection: &Collection,
id: Uuid
) -> Result<(), DeleteRecordError>
pub async fn put_record(
&mut self,
collection: &mut Collection,
record: &Record
) -> Result<(), PutRecordError>
pub async fn put_all(
&mut self,
collection: &mut Collection,
records: impl IntoIterator<Item = Record> + 'static
) -> Result<usize, PutStreamError>
pub async fn put_stream(
&mut self,
collection: &mut Collection,
record_stream: impl Stream<Item = Record> + 'static
) -> Result<usize, PutStreamError>
pub async fn get_record(
&mut self,
collection: &Collection,
id: Uuid
) -> Result<Option<Record>, GetRecordError>
pub async fn query(
&mut self,
collection: &mut Collection,
query: QueryInput
) -> Result<QueryResponse, QueryError>
source§impl<Client, Data> Stash<Client, Data>where
Client: GrpcService<BoxBody>,
Client::ResponseBody: Body + Send + 'static,
Client::Error: Into<StdError>,
<Client::ResponseBody as Body>::Error: Into<StdError> + Send,
Data: GetAccessToken + GetCipherEngine + GetNamingKey,
impl<Client, Data> Stash<Client, Data>where
Client: GrpcService<BoxBody>,
Client::ResponseBody: Body + Send + 'static,
Client::Error: Into<StdError>,
<Client::ResponseBody as Body>::Error: Into<StdError> + Send,
Data: GetAccessToken + GetCipherEngine + GetNamingKey,
pub async fn collection_info(
&mut self,
name: String
) -> Result<CollectionDecryptResult, CollectionInfoError>
pub async fn create_collection(
&mut self,
name: String,
schema: RecordSchema,
indexes: impl IntoIterator<Item = (String, Mapping)>
) -> Result<Collection, CreateCollectionError>
Auto Trait Implementations§
impl<Client, Data> RefUnwindSafe for Stash<Client, Data>where
Client: RefUnwindSafe,
Data: RefUnwindSafe,
impl<Client, Data> Send for Stash<Client, Data>where
Client: Send,
Data: Send,
impl<Client, Data> Sync for Stash<Client, Data>where
Client: Sync,
Data: Sync,
impl<Client, Data> Unpin for Stash<Client, Data>where
Client: Unpin,
Data: Unpin,
impl<Client, Data> UnwindSafe for Stash<Client, Data>where
Client: UnwindSafe,
Data: UnwindSafe,
Blanket Implementations§
source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
source§fn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
fn approx(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
Approximate the subject with the default scheme.
source§fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject with a specific scheme.
source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, DefaultApprox>,
Approximate the subject to a given type with the default scheme.
source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
source§fn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
fn into_as<Dst>(self) -> Dstwhere
Self: Sized + Into<Dst>,
Convert the subject to a given type.
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request