pub struct SettingsStore { /* private fields */ }Expand description
A settings-specific Store that wraps DocStore and provides specialized methods for managing database settings and authentication configuration.
SettingsStore provides a clean abstraction over the _settings subtree, offering
type-safe methods for common settings operations while delegating to AuthSettings
for authentication-specific functionality.
Implementations§
Source§impl SettingsStore
impl SettingsStore
Sourcepub async fn get_name(&self) -> Result<String>
pub async fn get_name(&self) -> Result<String>
Get the database name from settings
§Returns
The database name as a string, or an error if not found or invalid
Sourcepub async fn get_all(&self) -> Result<Doc>
pub async fn get_all(&self) -> Result<Doc>
Get all settings as a Doc
Returns a complete snapshot of all settings in the _settings subtree.
§Returns
A Doc containing all current settings
Sourcepub async fn get_height_strategy(&self) -> Result<HeightStrategy>
pub async fn get_height_strategy(&self) -> Result<HeightStrategy>
Get the height strategy for this database.
Returns HeightStrategy::Incremental if no strategy is configured,
ensuring backwards compatibility with existing databases.
§Returns
The configured height strategy, or the default (Incremental)
Sourcepub async fn set_height_strategy(&self, strategy: HeightStrategy) -> Result<()>
pub async fn set_height_strategy(&self, strategy: HeightStrategy) -> Result<()>
Sourcepub async fn auth_snapshot(&self) -> Result<AuthSettings>
pub async fn auth_snapshot(&self) -> Result<AuthSettings>
Get a snapshot of the current authentication settings
Returns a cloned AuthSettings built from the merged CRDT state.
Mutations to the returned value do not propagate back to the store;
use the dedicated methods (e.g. set_auth_key, rename_auth_key,
revoke_auth_key) to persist changes.
§Returns
An AuthSettings snapshot of the current auth configuration
Sourcepub async fn set_auth_key(&self, pubkey: &PublicKey, key: AuthKey) -> Result<()>
pub async fn set_auth_key(&self, pubkey: &PublicKey, key: AuthKey) -> Result<()>
Set an authentication key in the settings
This method provides upsert behavior for authentication keys:
- If the pubkey doesn’t exist: creates the key entry
- If the pubkey exists: updates the key with new permissions/status/name
Keys are stored by pubkey (the cryptographic public key string). The AuthKey contains optional name metadata and permission information.
Writes are incremental: only the specific key path is written to the entry, not the full auth state. The CRDT merge produces the correct merged view when reading.
§Arguments
pubkey- The public keykey- The AuthKey containing name, permissions, and status
§Returns
Result indicating success or failure
Sourcepub async fn set_global_auth_key(&self, key: AuthKey) -> Result<()>
pub async fn set_global_auth_key(&self, key: AuthKey) -> Result<()>
Sourcepub async fn get_global_auth_key(&self) -> Result<AuthKey>
pub async fn get_global_auth_key(&self) -> Result<AuthKey>
Get the global authentication permission
Reads from the auth.global path via an auth snapshot.
§Returns
AuthKey if the global permission is configured, or error if not present
Sourcepub async fn get_auth_key(&self, pubkey: &PublicKey) -> Result<AuthKey>
pub async fn get_auth_key(&self, pubkey: &PublicKey) -> Result<AuthKey>
Sourcepub async fn revoke_auth_key(&self, pubkey: &PublicKey) -> Result<()>
pub async fn revoke_auth_key(&self, pubkey: &PublicKey) -> Result<()>
Sourcepub async fn add_delegated_tree(&self, tree_ref: DelegatedTreeRef) -> Result<()>
pub async fn add_delegated_tree(&self, tree_ref: DelegatedTreeRef) -> Result<()>
Sourcepub async fn get_auth_doc_for_validation(&self) -> Result<Doc>
pub async fn get_auth_doc_for_validation(&self) -> Result<Doc>
Get the auth document for validation purposes
This returns the raw Doc containing auth configuration, suitable for use with AuthValidator and other validation components that expect the raw CRDT state.
§Returns
A Doc containing the auth configuration
Sourcepub fn as_doc_store(&self) -> &DocStore
pub fn as_doc_store(&self) -> &DocStore
Get access to the underlying DocStore for advanced operations
This provides direct access to the DocStore for cases where the SettingsStore abstraction is insufficient.
§Returns
A reference to the underlying DocStore
Auto Trait Implementations§
impl Freeze for SettingsStore
impl !RefUnwindSafe for SettingsStore
impl Send for SettingsStore
impl Sync for SettingsStore
impl Unpin for SettingsStore
impl !UnwindSafe for SettingsStore
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more