pub struct RemoteKvStoreClient { /* private fields */ }Expand description
Remote KV-store client. Holds a worker thread that owns the SHM ring endpoints; drop the client to stop the worker.
Implementations§
Source§impl RemoteKvStoreClient
impl RemoteKvStoreClient
Sourcepub fn connect(prefix: &str) -> Result<Self, RemoteError>
pub fn connect(prefix: &str) -> Result<Self, RemoteError>
Connect to a daemon running with the given prefix. Uses the
default ring depth (DEFAULT_RING_DEPTH) and call timeout
(DEFAULT_CALL_TIMEOUT).
Sourcepub fn connect_with_depth(
prefix: &str,
depth: usize,
) -> Result<Self, RemoteError>
pub fn connect_with_depth( prefix: &str, depth: usize, ) -> Result<Self, RemoteError>
Connect with an explicit ring depth (must match the daemon’s).
Equivalent to connect_with_options(prefix, ClientOptions { depth, ..Default::default() }).
Sourcepub fn connect_with_options(
prefix: &str,
opts: ClientOptions,
) -> Result<Self, RemoteError>
pub fn connect_with_options( prefix: &str, opts: ClientOptions, ) -> Result<Self, RemoteError>
Connect with custom options.
Sourcepub fn is_dead(&self) -> bool
pub fn is_dead(&self) -> bool
Returns true if the client has timed out and stopped serving
new requests. Engine code should drop the handle and reconnect.
Sourcepub fn put_kv(
&self,
namespace: &str,
key: &str,
payload: Bytes,
) -> Result<(), RemoteError>
pub fn put_kv( &self, namespace: &str, key: &str, payload: Bytes, ) -> Result<(), RemoteError>
PUT a single key/value blob. Idempotent on (namespace, key).
Sourcepub fn get_kv(
&self,
namespace: &str,
key: &str,
) -> Result<RemoteGetOutcome, RemoteError>
pub fn get_kv( &self, namespace: &str, key: &str, ) -> Result<RemoteGetOutcome, RemoteError>
GET a single key/value blob. Returns Miss only on absence;
transient daemon errors come back as Err.
Sourcepub fn get_many_kv_batch(
&self,
namespace: &str,
keys: &[String],
) -> Result<Option<Bytes>, RemoteError>
pub fn get_many_kv_batch( &self, namespace: &str, keys: &[String], ) -> Result<Option<Bytes>, RemoteError>
Batched GET for one engine transfer. Returns an encoded bytes batch
preserving keys order, or None when any key is missing.
Sourcepub fn exists(&self, namespace: &str, key: &str) -> Result<bool, RemoteError>
pub fn exists(&self, namespace: &str, key: &str) -> Result<bool, RemoteError>
EXISTS, same path as GET but the daemon does not transfer the payload bytes back over the wire.
Sourcepub fn list_keys_batch(&self, namespace: &str) -> Result<Bytes, RemoteError>
pub fn list_keys_batch(&self, namespace: &str) -> Result<Bytes, RemoteError>
List namespace-relative keys as an encoded key batch.
Sourcepub fn restore_from_s3(&self, namespace: &str) -> Result<usize, RemoteError>
pub fn restore_from_s3(&self, namespace: &str) -> Result<usize, RemoteError>
Hydrate the daemon’s foyer cache from S3 for the given namespace. Returns the number of keys restored.
Sourcepub fn clear_foyer(&self) -> Result<(), RemoteError>
pub fn clear_foyer(&self) -> Result<(), RemoteError>
Drop the daemon’s foyer state. Test/admin only.
Sourcepub fn ping(&self) -> Result<(), RemoteError>
pub fn ping(&self) -> Result<(), RemoteError>
Round-trip ping for liveness checks.
Sourcepub fn stats(&self) -> Result<String, RemoteError>
pub fn stats(&self) -> Result<String, RemoteError>
Daemon-side metrics snapshot, JSON lines.
Sourcepub fn lookup_block_prefix(
&self,
namespace: &str,
block_hashes_hex: &[String],
) -> Result<usize, RemoteError>
pub fn lookup_block_prefix( &self, namespace: &str, block_hashes_hex: &[String], ) -> Result<usize, RemoteError>
Block-shaped: count leading hashes present in the daemon’s
metadata index. Mirrors wmbt_kv_lookup_block_prefix semantics:
returns the number of hashes, counted from index 0 of
block_hashes_hex, that the daemon’s metadata index recognized
before the first miss. A leading miss returns 0.
Each entry of block_hashes_hex MUST be exactly 64 lower-hex
characters (32-byte blake3 hash); the daemon rejects malformed
input with RemoteError::DaemonStatus.
Sourcepub fn get_kv_blocks_batch(
&self,
namespace: &str,
block_hashes_hex: &[String],
) -> Result<Option<Vec<Bytes>>, RemoteError>
pub fn get_kv_blocks_batch( &self, namespace: &str, block_hashes_hex: &[String], ) -> Result<Option<Vec<Bytes>>, RemoteError>
Block-shaped: parallel batched GET for content-addressed blocks.
On full hit returns Some(per-block bytes in input order); on
any miss returns None (all-or-nothing, matches the cabi
wmbt_kv_get_kv_blocks_borrowed contract).
Sourcepub fn put_kv_blocks_batch(
&self,
namespace: &str,
block_hashes_hex: &[String],
payloads: &[&[u8]],
) -> Result<u64, RemoteError>
pub fn put_kv_blocks_batch( &self, namespace: &str, block_hashes_hex: &[String], payloads: &[&[u8]], ) -> Result<u64, RemoteError>
Block-shaped: parallel batched PUT for content-addressed blocks.
The daemon writes each block, then updates its in-process metadata
index so a subsequent Self::lookup_block_prefix sees the new
presence. Returns total bytes written across all blocks.
block_hashes_hex.len() MUST equal payloads.len(). The caller’s
payload slices are copied into the daemon transport (rkyv-encoded
inside the request frame).
Sourcepub fn ping_with_timeout(&self, timeout: Duration) -> Result<(), RemoteError>
pub fn ping_with_timeout(&self, timeout: Duration) -> Result<(), RemoteError>
Health-check ping with a custom (typically short) timeout.
Useful for liveness probes that want to fail faster than the
default call_timeout. Marks the client dead on timeout, same
as any other call.
Trait Implementations§
Source§impl Drop for RemoteKvStoreClient
impl Drop for RemoteKvStoreClient
Auto Trait Implementations§
impl Freeze for RemoteKvStoreClient
impl !RefUnwindSafe for RemoteKvStoreClient
impl Send for RemoteKvStoreClient
impl Sync for RemoteKvStoreClient
impl Unpin for RemoteKvStoreClient
impl UnsafeUnpin for RemoteKvStoreClient
impl !UnwindSafe for RemoteKvStoreClient
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<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> 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> 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.Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);