pub struct RegionMapping {
pub region: String,
pub ns: Namespace,
pub kind: HibernateRegionKind,
pub mode: L2AccessMode,
}Expand description
A Hibernate region mapped to a HydraCache namespace.
Fields§
§region: StringHibernate region name as configured by the app.
ns: NamespaceHydraCache namespace used on the W1 protocol.
kind: HibernateRegionKindHibernate region kind.
mode: L2AccessModeAccess mode and consistency contract.
Implementations§
Source§impl RegionMapping
impl RegionMapping
Sourcepub fn new(
region: impl Into<String>,
ns: Namespace,
kind: HibernateRegionKind,
mode: L2AccessMode,
) -> Result<Self, ClientProtocolError>
pub fn new( region: impl Into<String>, ns: Namespace, kind: HibernateRegionKind, mode: L2AccessMode, ) -> Result<Self, ClientProtocolError>
Build an explicit region mapping.
Sourcepub fn from_region(
region: impl Into<String>,
kind: HibernateRegionKind,
mode: L2AccessMode,
) -> Result<Self, ClientProtocolError>
pub fn from_region( region: impl Into<String>, kind: HibernateRegionKind, mode: L2AccessMode, ) -> Result<Self, ClientProtocolError>
Build the default namespace mapping for a Hibernate region.
Sourcepub const fn consistency_mapping(&self) -> L2ConsistencyMapping
pub const fn consistency_mapping(&self) -> L2ConsistencyMapping
Return the consistency mapping for this region.
Sourcepub fn client_context(&self) -> ClientContext
pub fn client_context(&self) -> ClientContext
Return a W1 request context for this region.
Sourcepub fn key<I, S>(
&self,
segments: I,
) -> Result<StructuredKey, ClientProtocolError>
pub fn key<I, S>( &self, segments: I, ) -> Result<StructuredKey, ClientProtocolError>
Build a namespaced structured key for this Hibernate region.
Sourcepub fn get(&self, key: StructuredKey) -> ClientRequest
pub fn get(&self, key: StructuredKey) -> ClientRequest
Build a W1 get request for this region.
Sourcepub fn put(
&self,
key: StructuredKey,
value: Vec<u8>,
ttl_ms: Option<u64>,
) -> ClientRequest
pub fn put( &self, key: StructuredKey, value: Vec<u8>, ttl_ms: Option<u64>, ) -> ClientRequest
Build a W1 put request for this region.
Sourcepub fn invalidate(&self, key: StructuredKey) -> ClientRequest
pub fn invalidate(&self, key: StructuredKey) -> ClientRequest
Build a W1 invalidation request for this region.
Sourcepub fn evict_region(&self) -> ClientRequest
pub fn evict_region(&self) -> ClientRequest
Build a W1 region eviction request for this region’s namespace.
Trait Implementations§
Source§impl Clone for RegionMapping
impl Clone for RegionMapping
Source§fn clone(&self) -> RegionMapping
fn clone(&self) -> RegionMapping
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 RegionMapping
impl Debug for RegionMapping
Source§impl<'de> Deserialize<'de> for RegionMapping
impl<'de> Deserialize<'de> for RegionMapping
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RegionMapping
Source§impl PartialEq for RegionMapping
impl PartialEq for RegionMapping
Source§fn eq(&self, other: &RegionMapping) -> bool
fn eq(&self, other: &RegionMapping) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RegionMapping
impl Serialize for RegionMapping
impl StructuralPartialEq for RegionMapping
Auto Trait Implementations§
impl Freeze for RegionMapping
impl RefUnwindSafe for RegionMapping
impl Send for RegionMapping
impl Sync for RegionMapping
impl Unpin for RegionMapping
impl UnsafeUnpin for RegionMapping
impl UnwindSafe for RegionMapping
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