Skip to main content

ShardCacheDirectRouter

Struct ShardCacheDirectRouter 

Source
pub struct ShardCacheDirectRouter { /* private fields */ }
Expand description

Router for shard-owned SCNP direct ports.

The base address is the first shard-owned port. Shard n is expected at base_port + n; when the server also exposes a fanout port, this base is usually SHARDCACHE_DIRECT_SHARD_BASE_PORT or the fanout port + 1.

Implementations§

Source§

impl ShardCacheDirectRouter

Source

pub fn connect_shard( &self, shard_id: usize, ) -> Result<ShardCacheDirectShardClient>

Connects directly to one shard-owned port.

Source§

impl ShardCacheDirectRouter

Source

pub fn new(addr: impl ToSocketAddrs, shard_count: usize) -> Result<Self>

Creates a direct router for shard_count server shards.

Source

pub fn with_route_mode(self, route_mode: ShardCacheRouteMode) -> Self

Sets how direct shard routing chooses the owning shard.

FullKey is the normal point-key mode. SessionPrefix routes keys of the form s:<session>:c:<chunk> by s:<session> while preserving the full-key hash used for lookup within that shard.

Source

pub fn shard_count(&self) -> usize

Returns the number of direct shard ports.

Source

pub fn route_key(&self, key: &[u8]) -> ShardCacheRoute

Computes the routed SCNP metadata for key.

Source

pub fn shard_addr(&self, shard_id: usize) -> Result<SocketAddr>

Returns the socket address for shard_id.

Trait Implementations§

Source§

impl Clone for ShardCacheDirectRouter

Source§

fn clone(&self) -> ShardCacheDirectRouter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ShardCacheDirectRouter

Source§

impl Debug for ShardCacheDirectRouter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.