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
impl ShardCacheDirectRouter
Sourcepub fn connect_shard(
&self,
shard_id: usize,
) -> Result<ShardCacheDirectShardClient>
pub fn connect_shard( &self, shard_id: usize, ) -> Result<ShardCacheDirectShardClient>
Connects directly to one shard-owned port.
Source§impl ShardCacheDirectRouter
impl ShardCacheDirectRouter
Sourcepub fn new(addr: impl ToSocketAddrs, shard_count: usize) -> Result<Self>
pub fn new(addr: impl ToSocketAddrs, shard_count: usize) -> Result<Self>
Creates a direct router for shard_count server shards.
Sourcepub fn with_route_mode(self, route_mode: ShardCacheRouteMode) -> Self
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.
Sourcepub fn shard_count(&self) -> usize
pub fn shard_count(&self) -> usize
Returns the number of direct shard ports.
Sourcepub fn route_key(&self, key: &[u8]) -> ShardCacheRoute
pub fn route_key(&self, key: &[u8]) -> ShardCacheRoute
Computes the routed SCNP metadata for key.
Sourcepub fn shard_addr(&self, shard_id: usize) -> Result<SocketAddr>
pub fn shard_addr(&self, shard_id: usize) -> Result<SocketAddr>
Returns the socket address for shard_id.
Trait Implementations§
Source§impl Clone for ShardCacheDirectRouter
impl Clone for ShardCacheDirectRouter
Source§fn clone(&self) -> ShardCacheDirectRouter
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ShardCacheDirectRouter
impl Debug for ShardCacheDirectRouter
impl Copy for ShardCacheDirectRouter
Auto Trait Implementations§
impl Freeze for ShardCacheDirectRouter
impl RefUnwindSafe for ShardCacheDirectRouter
impl Send for ShardCacheDirectRouter
impl Sync for ShardCacheDirectRouter
impl Unpin for ShardCacheDirectRouter
impl UnsafeUnpin for ShardCacheDirectRouter
impl UnwindSafe for ShardCacheDirectRouter
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