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.
Sourcepub fn connect_shard_with_timeouts(
&self,
shard_id: usize,
connect_timeout: Duration,
operation_timeout: Duration,
) -> Result<ShardCacheDirectShardClient>
pub fn connect_shard_with_timeouts( &self, shard_id: usize, connect_timeout: Duration, operation_timeout: Duration, ) -> Result<ShardCacheDirectShardClient>
Connects directly to one shard-owned port with explicit deadlines.
Sourcepub fn connect_shard_with_timeouts_and_auth(
&self,
shard_id: usize,
connect_timeout: Duration,
operation_timeout: Duration,
auth_token: Option<&[u8]>,
) -> Result<ShardCacheDirectShardClient>
pub fn connect_shard_with_timeouts_and_auth( &self, shard_id: usize, connect_timeout: Duration, operation_timeout: Duration, auth_token: Option<&[u8]>, ) -> Result<ShardCacheDirectShardClient>
Connects to one shard-owned port with deadlines and SCNP authentication.
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more