pub trait StorageAdapter: Send + Sync {
// Required methods
fn load<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = BindingResult<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn prepare_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn save<'life0, 'async_trait>(
&'life0 self,
profile: String,
token: String,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn acquire_lock<'life0, 'async_trait>(
&'life0 self,
profile: String,
timeout_millis: u64,
) -> Pin<Box<dyn Future<Output = BindingResult<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn release_lock<'life0, 'async_trait>(
&'life0 self,
lease: String,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn name(&self) -> String;
}Expand description
Foreign-language persistence contract; implement every method in Node or Python.
UniFFI callback interfaces do not inherit Rust default method bodies. A store
must explicitly implement locking and may implement prepare_write as a no-op
when writes need no preflight. Credential JSON can contain refresh tokens.
Required Methods§
Sourcefn load<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = BindingResult<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = BindingResult<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Load credential JSON, returning None when the key does not exist.
Sourcefn prepare_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prepare_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check write readiness before a provider rotates a refresh token.
Sourcefn save<'life0, 'async_trait>(
&'life0 self,
profile: String,
token: String,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn save<'life0, 'async_trait>(
&'life0 self,
profile: String,
token: String,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Persist credential JSON without discarding unrelated keys.
Sourcefn remove<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete only the specified credential.
Sourcefn acquire_lock<'life0, 'async_trait>(
&'life0 self,
profile: String,
timeout_millis: u64,
) -> Pin<Box<dyn Future<Output = BindingResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn acquire_lock<'life0, 'async_trait>(
&'life0 self,
profile: String,
timeout_millis: u64,
) -> Pin<Box<dyn Future<Output = BindingResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Acquire an exclusive refresh lease or fail within the timeout.
Sourcefn release_lock<'life0, 'async_trait>(
&'life0 self,
lease: String,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn release_lock<'life0, 'async_trait>(
&'life0 self,
lease: String,
) -> Pin<Box<dyn Future<Output = BindingResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Release the lease returned by acquire_lock.
Trait Implementations§
Source§impl<T> FfiConverterArc<T> for dyn StorageAdapter
impl<T> FfiConverterArc<T> for dyn StorageAdapter
Source§impl<T> LiftRef<T> for dyn StorageAdapter
impl<T> LiftRef<T> for dyn StorageAdapter
type LiftType = Arc<dyn StorageAdapter>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".