pub struct Identity {
pub namespace: String,
pub key_type: String,
pub id: String,
pub use_case: String,
pub tracked: bool,
pub args: Vec<(String, String)>,
}Expand description
A normalized logical identity. Ordered arguments retain caller order;
use normalize_args to build them from a host-language record.
Fields§
§namespace: StringThe instance namespace; empty means the cache fills in its own at execution.
key_type: StringThe entity type; serialized as keyType.
id: StringThe entity identifier.
use_case: StringThe operation name; serialized as useCase.
tracked: boolWhether the identity is fenced by its entity’s invalidation watermark;
serialized as trackForInvalidation. Defaults to false.
args: Vec<(String, String)>Secondary dimensions as (name, spelled value) pairs, already
normalized and in key order.
Implementations§
Source§impl Identity
impl Identity
Sourcepub fn new(
key_type: impl Into<String>,
id: impl IntoKeyId,
use_case: impl Into<String>,
) -> Self
pub fn new( key_type: impl Into<String>, id: impl IntoKeyId, use_case: impl Into<String>, ) -> Self
An untracked identity with an empty namespace and no arguments.
IDs use the same IntoKeyId conversion as crate::KeySpec::new
and crate::DialCache::invalidate.
Sourcepub fn tracked(self, tracked: bool) -> Self
pub fn tracked(self, tracked: bool) -> Self
Set whether the identity shares its entity’s invalidation watermark.
Sourcepub fn namespace(self, namespace: impl Into<String>) -> Self
pub fn namespace(self, namespace: impl Into<String>) -> Self
Set the namespace explicitly instead of inheriting the instance’s.
Sourcepub fn args(self, args: Vec<(String, String)>) -> Self
pub fn args(self, args: Vec<(String, String)>) -> Self
Replace the ordered argument pairs; build them with normalize_args.
Sourcepub fn keys(&self) -> Result<Keys, IdentityError>
pub fn keys(&self) -> Result<Keys, IdentityError>
The logical key, the stored value key and, for tracked identities, the watermark key.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Identity
impl<'de> Deserialize<'de> for Identity
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>,
impl Eq for Identity
impl StructuralPartialEq for Identity
Auto Trait Implementations§
impl Freeze for Identity
impl RefUnwindSafe for Identity
impl Send for Identity
impl Sync for Identity
impl Unpin for Identity
impl UnsafeUnpin for Identity
impl UnwindSafe for Identity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.