pub trait LockStore: Send + Sync {
// Required methods
fn save(
&self,
resource: &str,
token: &str,
ttl: Option<Duration>,
) -> Result<(), LockError>;
fn delete(&self, resource: &str, token: &str) -> Result<(), LockError>;
fn exists(&self, resource: &str, token: &str) -> Result<bool, LockError>;
fn put_off_expiration(
&self,
resource: &str,
token: &str,
ttl: Option<Duration>,
) -> Result<(), LockError>;
}Expand description
Low-level lock persistence (Symfony PersistingStoreInterface analogue).
Required Methods§
Sourcefn save(
&self,
resource: &str,
token: &str,
ttl: Option<Duration>,
) -> Result<(), LockError>
fn save( &self, resource: &str, token: &str, ttl: Option<Duration>, ) -> Result<(), LockError>
Persists ownership for resource under token.
When ttl is Some, ownership expires after that duration. None means no expiry.
Same-token re-save refreshes ownership. Another token yields LockError::Conflict.
§Errors
Returns LockError on invalid resource, conflict, or store failure.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".