Sigil documentation
ReferenceRust referencesigil-node

sigil-node · username_durable

Source declarations, signatures and documentation for username_durable.

Source: sigil/node/sigil-node/src/username_durable.rs. SHA-256: 5e5694245d3926a18b0218daae8f43c4b02989d27c932af6936ceab4a2d5a41e.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

username_durable::UsernameEvent

Lightweight audit event appended on every username state transition.

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct UsernameEvent {
pub block_height: u64,
pub seq: u64,
pub kind: String,
pub name: String,
pub actor_did: String,
pub payload: serde_json::Value
}

Source line: 174.

username_durable::DurableUsernameStore

Durable on-chain username registry.

All multi-write operations must use [UsernameWriteBatch] + commit_batch. A crash before commit returns leaves zero partial state.

pub struct DurableUsernameStore {

}

Source line: 219.

username_durable::DurableUsernameStore::open

Open (or create) the store at path. The directory becomes the AkashaKV data root for the username subsystem.

pub fn open(path: &Path) -> Result<Self, NodeError>;

Source line: 227.

username_durable::DurableUsernameStore::get

Fetch a username record by canonical name. Returns None if not found.

pub fn get(&self, canonical_name: &str) -> Result<Option<UsernameRecord>, NodeError>;

Source line: 305.

username_durable::DurableUsernameStore::lookup_reverse

Look up the primary username for a DID. Returns None if no primary is set.

pub fn lookup_reverse(&self, owner_did: &str) -> Result<Option<String>, NodeError>;

Source line: 314.

username_durable::DurableUsernameStore::get_reverse_record

Fetch the full reverse-lookup record (DID + primary). Convenience for callers that need the typed shape.

pub fn get_reverse_record(
        &self,
        owner_did: &str,
    ) -> Result<Option<ReverseUsernameRecord>, NodeError>;

Source line: 325.

username_durable::DurableUsernameStore::list_for_owner

Return all username records owned by did.

pub fn list_for_owner(&self, owner_did: &str) -> Result<Vec<UsernameRecord>, NodeError>;

Source line: 337.

username_durable::DurableUsernameStore::list_all

Return every username record in the store. O(n); for explorer use.

pub fn list_all(&self) -> Result<Vec<UsernameRecord>, NodeError>;

Source line: 370.

username_durable::DurableUsernameStore::get_auction

Fetch an auction by canonical name. Returns None if no auction exists for that name.

pub fn get_auction(&self, canonical_name: &str) -> Result<Option<UsernameAuction>, NodeError>;

Source line: 382.

username_durable::DurableUsernameStore::list_all_auctions

Return every auction in the store. O(n); for explorer use.

pub fn list_all_auctions(&self) -> Result<Vec<UsernameAuction>, NodeError>;

Source line: 390.

username_durable::DurableUsernameStore::get_dispute

pub fn get_dispute(&self, dispute_id: &str) -> Result<Option<UsernameDispute>, NodeError>;

Source line: 400.

username_durable::DurableUsernameStore::list_all_disputes

pub fn list_all_disputes(&self) -> Result<Vec<UsernameDispute>, NodeError>;

Source line: 407.

username_durable::DurableUsernameStore::commit_batch

Apply all operations in batch atomically inside one AkashaKV MVCC transaction.

pub fn commit_batch(&self, batch: &UsernameWriteBatch) -> Result<(), NodeError>;

Source line: 419.

username_durable::DurableUsernameStore::put_record

Convenience: register a username via a one-op batch. Used by tests and simple scripts; production executor uses commit_batch directly.

pub fn put_record(&self, record: &UsernameRecord) -> Result<(), NodeError>;

Source line: 485.

username_durable::DurableUsernameStore::delete_record

Convenience for tests: drop a record + owner-index outside of a batch.

pub fn delete_record(&self, canonical_name: &str, owner_did: &str) -> Result<(), NodeError>;

Source line: 495.

username_durable::DurableUsernameStore::namespace_prefix

Test helper: return the root namespace prefix.

pub fn namespace_prefix() -> &'static [u8];

Source line: 502.

username_durable::DurableUsernameStore::close

Close the underlying KV. Test helper only — the production lifecycle drops the store with the runtime.

pub fn close(&self) -> Result<(), NodeError>;

Source line: 508.

username_durable::ArcUsernameStore

Convenience type alias for a shared durable username store.

pub type ArcUsernameStore = Arc<DurableUsernameStore>;

Source line: 516.

username_durable::UsernameBatchOp

One operation inside a [UsernameWriteBatch].

#[derive(Clone)]
pub enum UsernameBatchOp {
    /// Insert or replace a username record.
    PutRecord(Box<UsernameRecord>),
    /// Add an owner-index entry (presence marker).
    IndexOwner { owner_did: String, name: String },
    /// Remove an owner-index entry.
    DeindexOwner { owner_did: String, name: String },
    /// Delete the record (release / forfeit / expiry-reclaim).
    DeleteRecord { name: String },
    /// Set the reverse-lookup primary for a DID.
    SetReverse { owner_did: String, primary: String },
    /// Clear the reverse-lookup primary for a DID.
    ClearReverse { owner_did: String },
    /// Append an immutable audit event.
    AppendEvent(UsernameEvent),
    /// Insert or replace an auction record.
    PutAuction(Box<UsernameAuction>),
    /// Delete an auction record (after settlement).
    DeleteAuction { name: String },
    /// Insert or replace a dispute record.
    PutDispute(Box<UsernameDispute>),
    /// Delete a dispute record (after resolution + grace).
    DeleteDispute { dispute_id: String },
}

Source line: 524.

username_durable::UsernameWriteBatch

Mutation accumulator for one username transaction.

#[derive(Default)]
pub struct UsernameWriteBatch {

}

Source line: 551.

username_durable::UsernameWriteBatch::new

pub fn new() -> Self;

Source line: 556.

username_durable::UsernameWriteBatch::put_record

pub fn put_record(&mut self, record: UsernameRecord);

Source line: 560.

username_durable::UsernameWriteBatch::index_owner

pub fn index_owner(&mut self, owner_did: impl Into<String>, name: impl Into<String>);

Source line: 564.

username_durable::UsernameWriteBatch::deindex_owner

pub fn deindex_owner(&mut self, owner_did: impl Into<String>, name: impl Into<String>);

Source line: 571.

username_durable::UsernameWriteBatch::delete_record

pub fn delete_record(&mut self, name: impl Into<String>);

Source line: 578.

username_durable::UsernameWriteBatch::set_reverse

pub fn set_reverse(&mut self, owner_did: impl Into<String>, primary: impl Into<String>);

Source line: 583.

username_durable::UsernameWriteBatch::clear_reverse

pub fn clear_reverse(&mut self, owner_did: impl Into<String>);

Source line: 590.

username_durable::UsernameWriteBatch::append_event

pub fn append_event(&mut self, event: UsernameEvent);

Source line: 596.

username_durable::UsernameWriteBatch::put_auction

pub fn put_auction(&mut self, auction: UsernameAuction);

Source line: 600.

username_durable::UsernameWriteBatch::delete_auction

pub fn delete_auction(&mut self, name: impl Into<String>);

Source line: 605.

username_durable::UsernameWriteBatch::put_dispute

pub fn put_dispute(&mut self, dispute: UsernameDispute);

Source line: 610.

username_durable::UsernameWriteBatch::delete_dispute

pub fn delete_dispute(&mut self, dispute_id: impl Into<String>);

Source line: 615.

username_durable::UsernameWriteBatch::len

pub fn len(&self) -> usize;

Source line: 621.

username_durable::UsernameWriteBatch::is_empty

pub fn is_empty(&self) -> bool;

Source line: 625.

On this page

username_durable::UsernameEventusername_durable::DurableUsernameStoreusername_durable::DurableUsernameStore::openusername_durable::DurableUsernameStore::getusername_durable::DurableUsernameStore::lookup_reverseusername_durable::DurableUsernameStore::get_reverse_recordusername_durable::DurableUsernameStore::list_for_ownerusername_durable::DurableUsernameStore::list_allusername_durable::DurableUsernameStore::get_auctionusername_durable::DurableUsernameStore::list_all_auctionsusername_durable::DurableUsernameStore::get_disputeusername_durable::DurableUsernameStore::list_all_disputesusername_durable::DurableUsernameStore::commit_batchusername_durable::DurableUsernameStore::put_recordusername_durable::DurableUsernameStore::delete_recordusername_durable::DurableUsernameStore::namespace_prefixusername_durable::DurableUsernameStore::closeusername_durable::ArcUsernameStoreusername_durable::UsernameBatchOpusername_durable::UsernameWriteBatchusername_durable::UsernameWriteBatch::newusername_durable::UsernameWriteBatch::put_recordusername_durable::UsernameWriteBatch::index_ownerusername_durable::UsernameWriteBatch::deindex_ownerusername_durable::UsernameWriteBatch::delete_recordusername_durable::UsernameWriteBatch::set_reverseusername_durable::UsernameWriteBatch::clear_reverseusername_durable::UsernameWriteBatch::append_eventusername_durable::UsernameWriteBatch::put_auctionusername_durable::UsernameWriteBatch::delete_auctionusername_durable::UsernameWriteBatch::put_disputeusername_durable::UsernameWriteBatch::delete_disputeusername_durable::UsernameWriteBatch::lenusername_durable::UsernameWriteBatch::is_empty