Skip to main content

Table

Struct Table 

Source
pub struct Table<'db> { /* private fields */ }
Expand description

A document handle borrowing a table’s owning database.

Methods from Deref<Target = Database>§

Source

pub fn open_table(&self, name: &str) -> Result<Table<'_>>

Opens a table-scoped document, schema, index, and enrichment handle. Close it before dropping the table. Closing the owner invalidates it.

Source

pub fn close(&self) -> Result<()>

Releases the embedded database handle, waiting for in-flight calls on other threads to finish first. Idempotent and safe to call concurrently with itself or from several threads at once (matching antfly_db_close’s contract), including through a shared Arc<Database> – calls made after (or racing) close return Error::InvalidArgument rather than touching a freed handle.

Takes &self, not self, specifically so it can be called on a Database shared across threads (e.g. Arc<Database>) without every other clone having to be dropped first; Drop still closes automatically once the last owner goes out of scope, for callers who never need to close early.

Source

pub fn status_json(&self) -> Result<Vec<u8>>

Source

pub fn capabilities_json(&self) -> Result<Vec<u8>>

Source

pub fn replay_generated_enrichments_json(&self) -> Result<Vec<u8>>

Source

pub fn backup(&self) -> Result<Vec<u8>>

Returns a portable Antfly backup archive (.afb) of this database, which restores or imports into either storage kind.

Source

pub fn backup_json(&self, options: impl AsRef<[u8]>) -> Result<Vec<u8>>

Export with optional {“tables”:[…]} scope; default is always included. Full backups fail closed if any table is unavailable.

Source

pub fn import_backup(&self, backup: impl AsRef<[u8]>) -> Result<()>

Imports a portable Antfly backup archive into this empty database. Error::OutcomeUnknown means the live handle adopted the imported generation, but crash durability could not be confirmed; inspect the handle and do not retry automatically.

Source

pub fn check_json(&self) -> Result<Vec<u8>>

Runs Lite integrity checks and returns the JSON result.

Source

pub fn vacuum_json(&self) -> Result<Vec<u8>>

Compacts free space and returns the JSON result.

Source

pub fn compact_json(&self) -> Result<Vec<u8>>

Drains maintenance, compacts indexes, vacuums free space, and returns the JSON result.

Source

pub fn copy_stable_snapshot_json( &self, dest_path: impl AsRef<Path>, replace: bool, ) -> Result<Vec<u8>>

Copies a stable Lite snapshot to dest_path, which must end in .aflite.

Source

pub fn batch(&self, writes: &[WriteIntent], timestamp_ns: u64) -> Result<()>

Applies write intents at timestamp_ns.

Source

pub fn batch_json(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Applies a public Antfly batch request and returns the JSON result. An OutcomeUnknown failure carries its outcome receipt (see Error::outcome_receipt).

Source

pub fn outcome_receipt_status( &self, receipt: &str, ) -> Result<OutcomeReceiptStatus>

Resolves an outcome receipt from an OutcomeUnknown batch or autocommit SQL write, on any handle for the same database. Returns Error::Stalled while the uncertain commit is not reconciled yet: retry on a Lite database; for a directory database, close the issuing handle and reopen first.

Source

pub fn forget_outcome_receipt(&self, receipt: &str) -> Result<()>

Removes a resolved receipt’s durable marker; afterwards the receipt can no longer be resolved.

Source

pub fn lookup_json(&self, key: impl AsRef<[u8]>) -> Result<Vec<u8>>

Returns the JSON lookup result for key.

Source

pub fn get_raw(&self, key: impl AsRef<[u8]>) -> Result<Vec<u8>>

Returns the raw stored bytes for key.

Source

pub fn schema_json(&self) -> Result<Vec<u8>>

Source

pub fn set_schema_json(&self, schema: impl AsRef<[u8]>) -> Result<()>

Source

pub fn run_until_idle(&self) -> Result<()>

Drains pending enrichment and index work.

Source

pub fn run_until_idle_json(&self) -> Result<Vec<u8>>

Drains pending enrichment and index work and returns the post-drain pending work stats JSON.

Source

pub fn pending_work_stats_json(&self) -> Result<Vec<u8>>

Source

pub fn indexes_json(&self) -> Result<Vec<u8>>

Source

pub fn render_resolver_key_json( &self, resolver: &str, mention: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Render the durable template and follow key aliases, without writes or ANN search.

Source

pub fn memory_json( &self, space: &str, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Resolve text or extraction mentions, including aliases and ANN, without writes. Execute native memory policy without an HTTP server or extension.

Source

pub fn resolve_query_json( &self, resolver: &str, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Source

pub fn merge_resolver_keys_json( &self, resolver: &str, request: impl AsRef<[u8]>, ) -> Result<()>

Persist a {“key”,“target”} redirect. Drain to re-key existing resolution edges.

Source

pub fn unmerge_resolver_key_json( &self, resolver: &str, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Undo a redirect, optionally pinning its former target distinct.

Source

pub fn suppress_resolver_keys_json( &self, resolver: &str, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Atomically add or remove runtime key and normalized-text suppressions.

Source

pub fn unsuppress_resolver_key_json( &self, resolver: &str, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Remove runtime suppression of a key; declarative rules remain effective.

Source

pub fn resolver_curation_json(&self, resolver: &str) -> Result<Vec<u8>>

Inspect one resolver’s durable curation, or all identities for an empty name.

Source

pub fn resolver_reviews_json( &self, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Page reviews or submit a decision bound to the displayed artifact.

Source

pub fn propose_curation_json( &self, table: &str, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Propose an entity correction; repeated action and keys retain the existing decision.

Source

pub fn list_curation_proposals_json( &self, table: &str, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

List the persistent entity review queue with bounded keyset pagination.

Source

pub fn get_curation_proposal_json( &self, table: &str, id: &str, ) -> Result<Vec<u8>>

Inspect a persistent proposal by its stable identifier.

Source

pub fn decide_curation_proposal_json( &self, table: &str, id: &str, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Accept or reject a proposal; retry incomplete fanout to resume durable receipts.

Source

pub fn curate_entity_json( &self, table: &str, key: &str, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Fan out a correction across resolver namespaces targeting this entity.

Source

pub fn resolver_identities_json(&self) -> Result<Vec<u8>>

List active and retired identities, including durable merges.

Source

pub fn drop_resolver_identity(&self, name: &str) -> Result<bool>

Discard retired identity metadata; artifacts and canonical rows remain. Delete source documents for artifact cleanup, then explicitly delete unused canonical rows. Busy is retryable.

Source

pub fn set_resolver_namespace_json( &self, resolver: &str, request: impl AsRef<[u8]>, ) -> Result<()>

Atomically reset or migrate resolver identities; drain afterward. Retry the identical request on Busy.

Source

pub fn add_index_json(&self, config: impl AsRef<[u8]>) -> Result<()>

Add or replace an index; retry the identical request on Busy. A graph replaces command registers a resumable background shadow. The old index serves until activation; absent old indexes behave like add. Optional wait:{timeout_ms:N} waits for activation. A deadline Busy leaves the accepted shadow running; pending work stats expose its progress.

Source

pub fn delete_index(&self, name: &str) -> Result<bool>

Deletes an index by name and reports whether it existed. Retire an index, returning whether it existed. Busy is retryable.

Source

pub fn cancel_replacement(&self, name: &str) -> Result<bool>

Cancel a running or failed shadow by its new name; idempotent.

Source

pub fn enrichments_json(&self) -> Result<Vec<u8>>

Source

pub fn add_enrichment_json(&self, config: impl AsRef<[u8]>) -> Result<()>

Source

pub fn delete_enrichment(&self, kind: &str, name: &str) -> Result<bool>

Deletes an enrichment by kind and name and reports whether it existed.

Source

pub fn scan_json(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Source

pub fn stats_json(&self) -> Result<Vec<u8>>

Source

pub fn search_json(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Source

pub fn dense_search_wire(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Executes a packed dense-vector wire search request.

Source

pub fn text_match_wire(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Executes a packed text-match wire search request.

Source

pub fn text_term_wire(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Executes a packed text-term wire search request.

Source

pub fn text_match_phrase_wire( &self, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Executes a packed text-match-phrase wire search request.

Source

pub fn aggregate_hits_json(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Aggregates hits from a JSON request.

Source

pub fn lookup_artifact_json(&self, artifact_id_base64: &str) -> Result<Vec<u8>>

Looks up an artifact by base64 artifact ID.

Source

pub fn extract_enrichments_json( &self, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Source

pub fn compute_enrichments_json( &self, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Source

pub fn edges_json( &self, index_name: &str, key: &str, edge_type: &str, direction: GraphDirection, ) -> Result<Vec<u8>>

Returns graph edges for key from a graph index. edge_type of "" matches every edge type.

Source

pub fn traverse_edges_json(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Source

pub fn execute_graph_queries_json( &self, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Source

pub fn neighbors_json( &self, index_name: &str, key: &str, edge_type: &str, direction: GraphDirection, ) -> Result<Vec<u8>>

Returns graph neighbors for key from a graph index. edge_type of "" matches every edge type.

Source

pub fn find_shortest_path_json( &self, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Source

pub fn find_k_shortest_paths_json( &self, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>>

Source

pub fn match_pattern_json(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Source

pub fn backup_to_file(&self, path: impl AsRef<Path>) -> Result<()>

Writes a portable Antfly backup archive for this database to path, which must end in .afb.

Source

pub fn begin_transaction( &self, txn_id: TxnId, timestamp_ns: u64, participants: &[&str], ) -> Result<()>

Starts a local transaction with an explicit transaction ID.

Source

pub fn write_transaction( &self, txn_id: TxnId, writes: &[WriteIntent], ) -> Result<()>

Appends write intents to an open local transaction.

Source

pub fn resolve_transaction( &self, txn_id: TxnId, status: TxnStatus, commit_version: u64, ) -> Result<()>

Resolves transaction intents as committed or aborted.

Source

pub fn transaction_status(&self, txn_id: TxnId) -> Result<TxnStatus>

Returns the current transaction lifecycle state.

Source

pub fn commit_version(&self, txn_id: TxnId) -> Result<u64>

Returns the commit version recorded for a committed transaction.

Source

pub fn check(&self) -> TypedResult<CheckReport>

Runs Lite integrity checks and returns the typed result.

Source

pub fn vacuum(&self) -> TypedResult<VacuumReport>

Compacts free space and returns the typed result.

Source

pub fn compact(&self) -> TypedResult<CompactReport>

Drains maintenance, compacts indexes, vacuums free space, and returns the typed result.

Source

pub fn copy_stable_snapshot( &self, dest_path: impl AsRef<Path>, replace: bool, ) -> TypedResult<StableSnapshotReport>

Copies a stable Lite snapshot to dest_path and returns the typed result.

Source

pub fn status(&self) -> TypedResult<Status>

Returns the typed Lite status document for the database.

Source

pub fn pending_work_stats(&self) -> TypedResult<PendingWorkStatus>

Returns the typed Lite pending-work readiness document.

Source

pub fn run_until_idle_status(&self) -> TypedResult<PendingWorkStatus>

Drains pending enrichment and index work and returns the typed post-drain readiness document.

Source

pub fn replay_generated_enrichments( &self, ) -> TypedResult<ReplayGeneratedEnrichmentsResult>

Recreates generated enrichment work from stored documents and returns the replay count.

Source

pub fn capabilities(&self) -> TypedResult<Capabilities>

Returns the typed Lite capability document for the database.

Source

pub fn graph_catalog_json( &self, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>, GraphError>

Source

pub fn cypher_json( &self, graph: impl AsRef<[u8]>, request: impl AsRef<[u8]>, ) -> Result<Vec<u8>, GraphError>

Source

pub fn graph_write_status_json( &self, transaction_id: impl AsRef<[u8]>, ) -> Result<Vec<u8>, GraphError>

Source

pub fn sql_json(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Source

pub fn sql_describe_json(&self, request: impl AsRef<[u8]>) -> Result<Vec<u8>>

Source

pub fn sql_session_open(&self) -> Result<u64>

Source

pub fn sql_session_close(&self, id: u64) -> Result<()>

Source

pub fn sql_cursor_open_json(&self, request: impl AsRef<[u8]>) -> Result<u64>

Source

pub fn sql_cursor_fetch_json(&self, id: u64, rows: u32) -> Result<Vec<u8>>

Source

pub fn sql_cursor_close(&self, id: u64) -> Result<()>

Source

pub fn create_table_json( &self, name: &str, schema: impl AsRef<[u8]>, ) -> Result<()>

Source

pub fn drop_table(&self, name: &str) -> Result<()>

Source

pub fn list_tables_json(&self) -> Result<Vec<u8>>

Trait Implementations§

Source§

impl Deref for Table<'_>

Source§

type Target = Database

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Database

Dereferences the value.

Auto Trait Implementations§

§

impl<'db> !Freeze for Table<'db>

§

impl<'db> Forget for Table<'db>

§

impl<'db> Move for Table<'db>

§

impl<'db> RefUnwindSafe for Table<'db>

§

impl<'db> Send for Table<'db>

§

impl<'db> Sync for Table<'db>

§

impl<'db> Unpin for Table<'db>

§

impl<'db> UnsafeUnpin for Table<'db>

§

impl<'db> UnwindSafe for Table<'db>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.