pub struct GrpcKv { /* private fields */ }Expand description
gRPC-based KV implementation that forwards calls to a remote KV service
Implementations§
Source§impl GrpcKv
impl GrpcKv
Sourcepub async fn new(
binding_name: String,
grpc_endpoint: String,
) -> Result<GrpcKv, AlienError<ErrorData>>
pub async fn new( binding_name: String, grpc_endpoint: String, ) -> Result<GrpcKv, AlienError<ErrorData>>
Create a new gRPC KV client
Sourcepub async fn new_from_channel(
channel: Channel,
binding_name: String,
) -> Result<GrpcKv, AlienError<ErrorData>>
pub async fn new_from_channel( channel: Channel, binding_name: String, ) -> Result<GrpcKv, AlienError<ErrorData>>
Create a new gRPC KV client from an existing channel
Trait Implementations§
impl Binding for GrpcKv
Source§impl Kv for GrpcKv
impl Kv for GrpcKv
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GrpcKv: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GrpcKv: 'async_trait,
Get a value by key. Returns None if key doesn’t exist or has expired. Read more
Source§fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: Vec<u8>,
options: Option<PutOptions>,
) -> Pin<Box<dyn Future<Output = Result<bool, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GrpcKv: 'async_trait,
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
value: Vec<u8>,
options: Option<PutOptions>,
) -> Pin<Box<dyn Future<Output = Result<bool, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GrpcKv: 'async_trait,
Put a value with optional options. When options.if_not_exists is true, returns true if created,
false if already exists. When options.if_not_exists is false or options is None, always returns true. Read more
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GrpcKv: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GrpcKv: 'async_trait,
Delete a key. No error if key doesn’t exist. Read more
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GrpcKv: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GrpcKv: 'async_trait,
Check if a key exists without retrieving the value. Read more
Source§fn scan_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
limit: Option<usize>,
cursor: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<ScanResult, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GrpcKv: 'async_trait,
fn scan_prefix<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
limit: Option<usize>,
cursor: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<ScanResult, AlienError<ErrorData>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
GrpcKv: 'async_trait,
Scan keys with a prefix, with pagination support. Read more
Auto Trait Implementations§
impl !Freeze for GrpcKv
impl !RefUnwindSafe for GrpcKv
impl !UnwindSafe for GrpcKv
impl Send for GrpcKv
impl Sync for GrpcKv
impl Unpin for GrpcKv
impl UnsafeUnpin for GrpcKv
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.