pub struct StateManager { /* private fields */ }Expand description
Manages license state across multiple storage locations
Implementations§
Source§impl StateManager
impl StateManager
Sourcepub fn new(license_id: &str, state_integrity_key: [u8; 32]) -> Self
pub fn new(license_id: &str, state_integrity_key: [u8; 32]) -> Self
Create a new state manager for a license (state_integrity_key must match save/load).
Sourcepub fn with_paths(
_license_id: &str,
paths: Vec<PathBuf>,
state_integrity_key: [u8; 32],
) -> Self
pub fn with_paths( _license_id: &str, paths: Vec<PathBuf>, state_integrity_key: [u8; 32], ) -> Self
Create with custom paths (for testing)
pub fn load(&self, license_id: &str) -> Result<Option<LicenseState>>
pub fn load_with_observations( &self, license_id: &str, ) -> Result<(Option<LicenseState>, StateObservations)>
Sourcepub fn repair(&self, state: &LicenseState, license_id: &str) -> usize
pub fn repair(&self, state: &LicenseState, license_id: &str) -> usize
Repair missing or unreadable state files using the canonical state.
license_id must match the id used when the state was created.
pub fn save(&self, state: &LicenseState) -> Result<()>
pub fn clear(&self) -> Result<()>
pub fn paths(&self) -> &[PathBuf]
Auto Trait Implementations§
impl Freeze for StateManager
impl RefUnwindSafe for StateManager
impl Send for StateManager
impl Sync for StateManager
impl Unpin for StateManager
impl UnsafeUnpin for StateManager
impl UnwindSafe for StateManager
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