pub trait StorageAdapter: Send + Sync {
// Required methods
fn load<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn prepare_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn save<'life0, 'async_trait>(
&'life0 self,
profile: String,
token: String,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn remove<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn acquire_lock<'life0, 'async_trait>(
&'life0 self,
profile: String,
timeout_millis: u64,
) -> Pin<Box<dyn Future<Output = Result<String, AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn release_lock<'life0, 'async_trait>(
&'life0 self,
lease: String,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: '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 = Result<Option<String>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn load<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: '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 = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn prepare_write<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: '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 = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn save<'life0, 'async_trait>(
&'life0 self,
profile: String,
token: String,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Persist credential JSON without discarding unrelated keys.
Sourcefn remove<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn remove<'life0, 'async_trait>(
&'life0 self,
profile: String,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: '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 = Result<String, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn acquire_lock<'life0, 'async_trait>(
&'life0 self,
profile: String,
timeout_millis: u64,
) -> Pin<Box<dyn Future<Output = Result<String, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Acquire an exclusive refresh lease or fail within the timeout.
Trait Implementations§
Source§impl<T> FfiConverterArc<T> for dyn StorageAdapter
impl<T> FfiConverterArc<T> for dyn StorageAdapter
const TYPE_ID_META: MetadataBuffer
type FfiType = Handle
fn lower( obj: Arc<dyn StorageAdapter>, ) -> <dyn StorageAdapter as FfiConverterArc<T>>::FfiType
fn try_lift( handle: <dyn StorageAdapter as FfiConverterArc<T>>::FfiType, ) -> Result<Arc<dyn StorageAdapter>, Error>
fn write(obj: Arc<dyn StorageAdapter>, buf: &mut Vec<u8>)
fn try_read(buf: &mut &[u8]) -> Result<Arc<dyn StorageAdapter>, Error>
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".