pub struct KeySession<T: KeyMaterial> { /* private fields */ }Expand description
Held keys and the capability that saves them, released together on close. Consumers read memory; only opening calls the configured custody’s unlock. Share this owner across every worker using the same custody.
Implementations§
Source§impl<T: KeyMaterial> KeySession<T>
impl<T: KeyMaterial> KeySession<T>
Sourcepub fn open(custody: Arc<dyn Custody<T>>) -> Result<Self, KeyError>
pub fn open(custody: Arc<dyn Custody<T>>) -> Result<Self, KeyError>
Unlock custody once at the opening composition root.
Sourcepub fn read(&self) -> Result<Option<T>, KeyError>
pub fn read(&self) -> Result<Option<T>, KeyError>
Read an independent copy of the held material without custody IO.
Sourcepub fn persist(&self, keys: &T) -> Result<(), KeyError>
pub fn persist(&self, keys: &T) -> Result<(), KeyError>
Save changed keys before installing them in the shared session. A failed save leaves the held material unchanged and reaches the caller.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for KeySession<T>
impl<T> RefUnwindSafe for KeySession<T>
impl<T> Send for KeySession<T>
impl<T> Sync for KeySession<T>
impl<T> Unpin for KeySession<T>where
T: Unpin,
impl<T> UnsafeUnpin for KeySession<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for KeySession<T>
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