Sigil documentation
ReferenceRust referencesigil-node

sigil-node · nft_durable

Source declarations, signatures and documentation for nft_durable.

Source: sigil/node/sigil-node/src/nft_durable.rs. SHA-256: 47bdcd44a82496345acb259a2987af4f4d3ec60f4f21cb2fd987292750993d22.

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.

nft_durable::DurableNftStore

Durable NFT state store backed by AkashaKV.

All public methods are synchronous — they bridge into the async AkashaKV API via a dedicated tokio runtime. block_on uses a spawn+channel so it works whether or not the caller is inside another tokio runtime.

pub struct DurableNftStore {

}

Source line: 209.

nft_durable::DurableNftStore::open

Open (or create) the NFT durable store at path.

The directory becomes the AkashaKV data root for all NFT records. Multiple DurableNftStore instances must NOT share the same path concurrently.

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

Source line: 220.

nft_durable::DurableNftStore::put_collection

Write (insert or replace) a collection record.

pub fn put_collection(&self, collection: &NftCollection) -> Result<(), NodeError>;

Source line: 300.

nft_durable::DurableNftStore::get_collection

Fetch a collection by id, or None if not found.

pub fn get_collection(
        &self,
        collection_id: &CollectionId,
    ) -> Result<Option<NftCollection>, NodeError>;

Source line: 307.

nft_durable::DurableNftStore::put_token

Write (insert or replace) a token record.

pub fn put_token(&self, token: &NftToken) -> Result<(), NodeError>;

Source line: 321.

nft_durable::DurableNftStore::get_token

Fetch a single token, or None if not found.

pub fn get_token(
        &self,
        collection_id: &CollectionId,
        token_id: TokenId,
    ) -> Result<Option<NftToken>, NodeError>;

Source line: 328.

nft_durable::DurableNftStore::delete_token

Delete a token record. No-op if the token does not exist.

pub fn delete_token(
        &self,
        collection_id: &CollectionId,
        token_id: TokenId,
    ) -> Result<(), NodeError>;

Source line: 341.

nft_durable::DurableNftStore::put_owner_index

Write (insert or replace) an owner-index entry.

pub fn put_owner_index(&self, entry: &OwnerIndexEntry) -> Result<(), NodeError>;

Source line: 353.

nft_durable::DurableNftStore::get_owner_index

Fetch the owner-index entry for (owner_did, collection_id), or None.

pub fn get_owner_index(
        &self,
        owner_did: &str,
        collection_id: &CollectionId,
    ) -> Result<Option<OwnerIndexEntry>, NodeError>;

Source line: 360.

nft_durable::DurableNftStore::delete_owner_index

Delete the owner-index entry for (owner_did, collection_id).

pub fn delete_owner_index(
        &self,
        owner_did: &str,
        collection_id: &CollectionId,
    ) -> Result<(), NodeError>;

Source line: 373.

nft_durable::DurableNftStore::list_owner_index

List all owner-index entries for owner_did, with optional pagination.

limit = 0 returns all entries. Results are key-sorted (lexicographic by collection_id) because AkashaKV returns keys in sorted order.

pub fn list_owner_index(
        &self,
        owner_did: &str,
        limit: usize,
        offset: usize,
    ) -> Result<Vec<OwnerIndexEntry>, NodeError>;

Source line: 386.

nft_durable::DurableNftStore::put_did_identity

Write (insert or replace) a DID-identity index record.

pub fn put_did_identity(&self, index: &DidIdentityIndex) -> Result<(), NodeError>;

Source line: 410.

nft_durable::DurableNftStore::get_did_identity

Fetch the DID-identity index for subject_did, or None.

pub fn get_did_identity(
        &self,
        subject_did: &str,
    ) -> Result<Option<DidIdentityIndex>, NodeError>;

Source line: 417.

nft_durable::DurableNftStore::delete_did_identity

Delete the DID-identity index for subject_did.

pub fn delete_did_identity(&self, subject_did: &str) -> Result<(), NodeError>;

Source line: 429.

nft_durable::DurableNftStore::append_event

Append an NFT lifecycle event. The key is derived from block_height, token_id, and tx_hash, so repeated appends for the same event are idempotent (last-write-wins on an identical key).

Returns the number of events already present before this write as a monotonic sequence number approximation.

pub fn append_event(&self, event: &NftEvent) -> Result<u64, NodeError>;

Source line: 442.

nft_durable::DurableNftStore::list_events

List events, optionally filtered by collection_id. Results are in block-height order because the key encodes block_height as BE.

pub fn list_events(
        &self,
        collection_id: Option<&CollectionId>,
    ) -> Result<Vec<NftEvent>, NodeError>;

Source line: 458.

nft_durable::DurableNftStore::flush

Force a flush of AkashaKV memtables to SSTables.

Useful in tests that drop and reopen the store at the same path to verify durability without waiting for the background flush interval.

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

Source line: 479.

nft_durable::DurableNftStore::close

Graceful shutdown — flushes memtables and stops background tasks.

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

Source line: 486.

nft_durable::DurableNftStore::commit_batch

Apply all operations in batch atomically via a single AkashaKV MVCC transaction.

Atomicity guarantee: if any individual operation fails (encoding error or storage error), the transaction is dropped (auto-aborted via Drop) before it can be committed, leaving zero partial state visible. Either every operation in the batch lands or none of them do.

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

Source line: 501.

nft_durable::DurableNftStore::get_account_nonce

Read the durable per-account nonce written by commit_batch. Returns None for accounts that have never executed an NFT transaction; the caller is expected to fall back to other nonce sources (e.g. the compute_durable mirror used by Transfer txs) or to 0 for fresh accounts. Round-6 P0-I1 read path.

pub fn get_account_nonce(&self, sender_did: &str) -> Result<Option<u64>, NodeError>;

Source line: 606.

nft_durable::ArcNftStore

Reference-counted handle to a [DurableNftStore].

pub type ArcNftStore = Arc<DurableNftStore>;

Source line: 628.

nft_durable::NftBatchOp

An individual operation inside a [NftWriteBatch].

Cloning is cheap because the inner domain types (NftCollection, NftToken, etc.) already derive Clone.

#[derive(Clone)]
pub enum NftBatchOp {
    PutCollection(NftCollection),
    PutToken(NftToken),
    DeleteToken(CollectionId, TokenId),
    PutOwnerIndex(OwnerIndexEntry),
    RemoveOwnerIndex {
        collection_id: CollectionId,
        owner_did: String,
        token_id: TokenId,
    },
    PutDidIdentity(DidIdentityIndex),
    RemoveDidIdentity {
        subject_did: String,
        collection_id: CollectionId,
        token_id: TokenId,
    },
    AppendEvent(NftEvent),
}

Source line: 639.

nft_durable::NftWriteBatch

A write batch that accumulates all mutations for a single NFT executor handler. Commit the batch via [ExecutionState::commit_nft_tx] at the end of the handler to apply all mutations atomically.

#[derive(Default)]
pub struct NftWriteBatch {

}

Source line: 663.

nft_durable::NftWriteBatch::new

Create an empty write batch.

pub fn new() -> Self;

Source line: 676.

nft_durable::NftWriteBatch::put_account_nonce

Fold an atomic nonce update into the batch. The given (sender_did, new_nonce) is committed inside the same AkashaKV transaction as the NFT ops, so on success both land together; on failure neither lands. Round-6 P0-I1: prevents the post-execution put_nonce race where state could commit while the nonce write was lost to a crash.

pub fn put_account_nonce(&mut self, sender_did: impl Into<String>, new_nonce: u64);

Source line: 688.

nft_durable::NftWriteBatch::put_collection

pub fn put_collection(&mut self, col: NftCollection);

Source line: 692.

nft_durable::NftWriteBatch::put_token

pub fn put_token(&mut self, tok: NftToken);

Source line: 696.

nft_durable::NftWriteBatch::delete_token

pub fn delete_token(&mut self, collection_id: CollectionId, token_id: TokenId);

Source line: 700.

nft_durable::NftWriteBatch::put_owner_index

pub fn put_owner_index(&mut self, entry: OwnerIndexEntry);

Source line: 705.

nft_durable::NftWriteBatch::remove_owner_index

pub fn remove_owner_index(
        &mut self,
        collection_id: CollectionId,
        owner_did: String,
        token_id: TokenId,
    );

Source line: 709.

nft_durable::NftWriteBatch::put_did_identity

pub fn put_did_identity(&mut self, idx: DidIdentityIndex);

Source line: 722.

nft_durable::NftWriteBatch::remove_did_identity

pub fn remove_did_identity(
        &mut self,
        subject_did: String,
        collection_id: CollectionId,
        token_id: TokenId,
    );

Source line: 726.

nft_durable::NftWriteBatch::append_event

pub fn append_event(&mut self, evt: NftEvent);

Source line: 739.

nft_durable::NftWriteBatch::len

Number of operations queued in this batch.

pub fn len(&self) -> usize;

Source line: 744.

nft_durable::NftWriteBatch::is_empty

Returns true if no operations have been queued.

pub fn is_empty(&self) -> bool;

Source line: 749.

nft_durable::NftWriteBatch::into_ops

Consume the batch and return the inner op list.

Used by the in-memory MemoryExecutionState::commit_nft_tx path to iterate over ops without an extra clone.

pub fn into_ops(self) -> Vec<NftBatchOp>;

Source line: 757.

On this page