Skip to main content

Store

Trait Store 

Source
pub trait Store: Resolver + Sealed {
Show 112 methods // Required methods fn put_descriptor(&self, bytes: &[u8]) -> Result<String>; fn put_receipt(&self, bytes: &[u8]) -> Result<String>; fn put_blob(&self, bytes: &[u8]) -> Result<String>; fn blob(&self, sha256: &str) -> Result<Option<Cow<'_, [u8]>>>; fn put_version( &self, cell_id: &str, tx: &str, receipt_hash: &str, ) -> Result<()>; fn version_asof(&self, cell_id: &str, asof: &str) -> Result<Option<Version>>; fn versions( &self, cell_id: &str, from: &str, to: &str, ) -> Result<Vec<Version>>; fn latest(&self, cell_id: &str) -> Result<Option<Version>>; fn dependents(&self, receipt_hash: &str) -> Result<Vec<String>>; fn inputs(&self, receipt_hash: &str) -> Result<Vec<String>>; fn put_namespace( &self, host: &str, keydoc_bytes: &[u8], validated_at: &str, ) -> Result<()>; fn namespace(&self, host: &str) -> Result<Option<Namespace>>; fn namespaces(&self) -> Result<Vec<Namespace>>; fn record_namespace_failure( &self, host: &str, checked_at: &str, threshold: u32, ) -> Result<Option<Namespace>>; fn record_namespace_success( &self, host: &str, checked_at: &str, ) -> Result<Option<Namespace>>; fn bind_name(&self, fn_name: &str, fn_hash: &str, tx: &str) -> Result<()>; fn resolve_name(&self, fn_name: &str, asof: &str) -> Result<Option<String>>; fn resolve_binding( &self, fn_name: &str, asof: &str, ) -> Result<Option<Binding>>; fn put_class(&self, bytes: &[u8]) -> Result<String>; fn class(&self, class_hash: &str) -> Result<Option<Vec<u8>>>; fn bind_class( &self, class_name: &str, class_hash: &str, tx: &str, ) -> Result<()>; fn resolve_class( &self, class_name: &str, asof: &str, ) -> Result<Option<String>>; fn resolve_class_binding( &self, class_name: &str, asof: &str, ) -> Result<Option<ClassBinding>>; fn put_computed( &self, cell_id: &str, tx: &str, receipt_hash: &str, ) -> Result<()>; fn computed_asof( &self, cell_id: &str, asof: &str, ) -> Result<Option<Version>>; fn stored_asof(&self, cell_id: &str, asof: &str) -> Result<Option<Version>>; fn cell_dependents(&self, cell_id: &str) -> Result<Vec<String>>; fn put_manifest(&self, bytes: &[u8]) -> Result<String>; fn member_manifests(&self, receipt_hash: &str) -> Result<Vec<String>>; fn slice_entries(&self, receipt_hash: &str) -> Result<Vec<String>>; fn slice_dependents(&self, entry: &str) -> Result<Vec<String>>; fn slice_members( &self, slice: &Slice, asof: &str, ) -> Result<Vec<SliceMember>>; fn versions_between( &self, cell_id: &str, from: &str, to: &str, asof: &str, ) -> Result<Vec<SliceMember>>; fn slice_values(&self, slice: &Slice, asof: &str) -> Result<Vec<SliceValue>>; fn slice_changed_after(&self, slice: &Slice, asof: &str) -> Result<bool>; fn computed_cells( &self, slice: &Slice, asof: &str, limit: usize, ) -> Result<Vec<Cell>>; fn has_bindings_under(&self, namespace: &str) -> Result<bool>; fn upsert_catalog(&self, entries: &[CatalogEntry]) -> Result<Vec<i64>>; fn upsert_key_values( &self, owner: &str, key: &str, values: &[KeyValue], ) -> Result<Vec<i64>>; fn refresh_value_counts(&self) -> Result<u64>; fn text_find(&self, query: &str, limit: usize) -> Result<Vec<Hit>>; fn vector_find( &self, model: &str, vec: &[f32], limit: usize, ) -> Result<Vec<Hit>>; fn put_embeddings(&self, model: &str, items: &[Embedding]) -> Result<()>; fn pending_embeddings( &self, model: &str, limit: usize, ) -> Result<Vec<PendingEmbedding>>; fn vector_available(&self) -> bool; fn log_miss(&self, query: &str) -> Result<()>; fn catalog_summary(&self) -> Result<Summary>; fn put_function_test(&self, test: &FunctionTest) -> Result<bool>; fn function_tests(&self, fn_hash: &str) -> Result<Vec<FunctionTest>>; fn record_function_test( &self, fn_hash: &str, case: &str, run_at: &str, result: &str, detail: &str, ) -> Result<bool>; fn set_function_branches( &self, fn_hash: &str, total: u32, covered: u32, ) -> Result<()>; fn function_readers(&self, name: &str) -> Result<Vec<String>>; fn bound_names(&self, fn_hash: &str) -> Result<Vec<String>>; // Provided methods fn put_member_set(&self, set: &MemberSet) -> Result<bool> { ... } fn slice_seq(&self, slice: &Slice) -> Result<i64> { ... } fn recording_time(&self, signed_tx: &str) -> String { ... } fn barrier(&self) -> Result<()> { ... } fn slice_member_hashes( &self, slice: &Slice, asof: &str, limit: usize, ) -> Result<Vec<String>> { ... } fn later_bound( &self, cell_id: &str, recorded: &str, ) -> Result<Option<String>> { ... } fn slice_member_hashes_within( &self, slice: &Slice, asof: &str, limit: usize, timeout: Duration, ) -> Result<Vec<String>> { ... } fn next_version_after( &self, cell_id: &str, recorded: &str, ) -> Result<Option<Version>> { ... } fn fn_seq(&self, fn_hash: &str) -> Result<i64> { ... } fn member_set(&self, entry: &str) -> Result<Option<MemberSet>> { ... } fn put_slice_definition(&self, slice: &Slice) -> Result<bool> { ... } fn slice_definition(&self, slice_id: &str) -> Result<Option<Slice>> { ... } fn latest_many(&self, cell_ids: &[&str]) -> Result<Vec<Option<Version>>> { ... } fn receipts_many(&self, hashes: &[&str]) -> Result<Vec<Option<Vec<u8>>>> { ... } fn put_cells(&self, items: &[CellWrite<'_>]) -> Result<Vec<String>> { ... } fn close_binding(&self, name: &str, at: &str) -> Result<()> { ... } fn class_names_bound_to( &self, class_hash: &str, at: &str, ) -> Result<Vec<String>> { ... } fn slice_withdrawn_latest( &self, slice: &Slice, asof: &str, ) -> Result<Option<(String, String)>> { ... } fn name_function_tests( &self, fn_hash: &str, names: &[(String, String)], ) -> Result<u64> { ... } fn unnamed_function_tests(&self, limit: usize) -> Result<Vec<FunctionTest>> { ... } fn function_test_summary( &self, fn_hash: &str, fn_name: Option<&str>, ) -> Result<TestSummary> { ... } fn function_tests_page( &self, fn_hash: &str, fn_name: Option<&str>, after_case: Option<&str>, limit: usize, ) -> Result<Vec<FunctionTest>> { ... } fn stored_receipts_of( &self, ns: &str, fn_name: &str, fn_hash: &str, limit: usize, ) -> Result<Vec<Vec<u8>>> { ... } fn slice_values_limit( &self, slice: &Slice, asof: &str, limit: usize, ) -> Result<Vec<SliceValue>> { ... } fn versions_limit( &self, cell_id: &str, from: &str, to: &str, limit: usize, ) -> Result<Vec<Version>> { ... } fn stored_cell_count( &self, ns: &str, fn_name: &str, fn_hash: &str, ) -> Result<u64> { ... } fn has_key_value(&self, owner: &str, key: &str, value: &str) -> Result<bool> { ... } fn key_value_count(&self, owner: &str, key: &str) -> Result<u64> { ... } fn mark_key_open(&self, owner: &str, key: &str) -> Result<()> { ... } fn key_is_open(&self, owner: &str, key: &str) -> Result<bool> { ... } fn open_key_count(&self) -> Result<u64> { ... } fn catalog_entry(&self, name: &str) -> Result<Option<CatalogEntry>> { ... } fn upsert_catalog_ext( &self, entries: &[CatalogEntryExt], ) -> Result<Vec<i64>> { ... } fn catalog_entry_ext( &self, kind: CatalogKind, name: &str, ) -> Result<Option<CatalogEntryExt>> { ... } fn catalog_entries_with_facets(&self) -> Result<Vec<FacetedEntry>> { ... } fn extensions_of(&self, class: &str) -> Result<Vec<CatalogEntryExt>> { ... } fn extensions_of_limit( &self, class: &str, limit: usize, ) -> Result<Vec<CatalogEntryExt>> { ... } fn cell_count(&self, ns: &str, fn_name: &str, fn_hash: &str) -> Result<u64> { ... } fn function_test( &self, fn_hash: &str, case: &str, ) -> Result<Option<FunctionTest>> { ... } fn function_tests_failing( &self, fn_hash: &str, fn_name: Option<&str>, limit: usize, ) -> Result<Vec<FunctionTest>> { ... } fn false_test_cells( &self, fn_hash: &str, limit: usize, ) -> Result<Vec<(String, Vec<u8>)>> { ... } fn dependants_of( &self, name: &str, at: &str, limit: usize, ) -> Result<Vec<(String, String)>> { ... } fn slice_page( &self, slice: &Slice, asof: &str, after: Option<&[u8]>, limit: usize, ) -> Result<Vec<SliceValue>> { ... } fn slice_values_page( &self, slice: &Slice, asof: &str, after_cell_id: Option<&str>, limit: usize, ) -> Result<Vec<SliceValue>> { ... } fn catalog_entries_all( &self, limit: usize, ) -> Result<Vec<(CatalogKind, String, String, String)>> { ... } fn dictionary_values_ordered( &self, owner: &str, key: &str, limit: usize, ) -> Result<Vec<String>> { ... } fn computed_asof_with_receipt( &self, cell_id: &str, asof: &str, ) -> Result<Option<(Version, Cow<'_, [u8]>)>> { ... } fn stored_asof_with_receipt( &self, cell_id: &str, asof: &str, ) -> Result<Option<(Version, Cow<'_, [u8]>)>> { ... } fn put_listing(&self, l: &Listing) -> Result<ListingWrite> { ... } fn listing(&self, name: &str) -> Result<Option<Listing>> { ... } fn listings_of(&self, host: &str) -> Result<Vec<Listing>> { ... } fn listing_count(&self) -> Result<u64> { ... } fn delete_listing(&self, name: &str) -> Result<bool> { ... } fn put_listed_host(&self, h: &ListedHost) -> Result<bool> { ... } fn listed_host(&self, host: &str) -> Result<Option<ListedHost>> { ... } fn listed_hosts(&self) -> Result<Vec<ListedHost>> { ... } fn delete_listed_host(&self, host: &str) -> Result<bool> { ... } fn set_listing_unreached( &self, name: &str, since: Option<&str>, ) -> Result<bool> { ... } fn listing_unreached(&self, name: &str) -> Result<Option<String>> { ... }
}
Expand description

A Datumesh store: a Resolver that can also be written to.

Instants are SPEC 3.3 instants (YYYY-MM-DDTHH:MM:SS.ffffffZ), hashes and cell ids 64 lowercase hex digits, hosts DNS names and function names fully qualified. Every method, read or write, refuses anything else with the core’s error code (Error::Invalid), and reports a database failure as Error::Database (or Error::PoolTimeout): a read answers Ok(None) / Ok(vec![]) only when the store really holds nothing.

The Resolver methods keep the core’s Option signatures: there a malformed argument or a database failure is None (logged with tracing when it is a failure), which verify reports as unavailable.

Only this crate implements Store (it is sealed, since 0.3.0; PgStore and, since 0.4.0, SqliteStore): the store is the trust boundary, where every receipt is verified against its host’s key document before it is kept, and what a store answers is relied on as checked. An implementation elsewhere could answer anything. Store stays object-safe (Arc<dyn Store + Send + Sync>). Even a complete implementation that delegates every method to a PgStore is refused (E0277: the private supertrait is not implemented; tests/sealed.rs checks that this is the only error):

ⓘ
use std::borrow::Cow;
use datumesh_core::{Cell, Scalar};
use datumesh_core::Slice;
use datumesh_store::{Binding, CatalogEntry, ClassBinding, Embedding, FunctionTest, Hit, KeyValue, Namespace, PendingEmbedding, PgStore, Resolver, Result, SliceMember, SliceValue, Store, Summary, Version};

struct Wrapper(PgStore);
impl Resolver for Wrapper {
    fn descriptor(&self, h: &str) -> Option<Cow<'_, [u8]>> { self.0.descriptor(h) }
    fn receipt(&self, h: &str) -> Option<Cow<'_, [u8]>> { self.0.receipt(h) }
    fn evaluate(&self, c: &Cell, a: &str) -> Option<Scalar> { self.0.evaluate(c, a) }
    fn manifest(&self, e: &str) -> Option<Cow<'_, [u8]>> { self.0.manifest(e) }
}
impl Store for Wrapper {
    fn put_descriptor(&self, b: &[u8]) -> Result<String> { self.0.put_descriptor(b) }
    fn put_receipt(&self, b: &[u8]) -> Result<String> { self.0.put_receipt(b) }
    fn put_blob(&self, b: &[u8]) -> Result<String> { self.0.put_blob(b) }
    fn blob(&self, s: &str) -> Result<Option<Cow<'_, [u8]>>> { self.0.blob(s) }
    fn put_version(&self, c: &str, t: &str, r: &str) -> Result<()> { self.0.put_version(c, t, r) }
    fn version_asof(&self, c: &str, a: &str) -> Result<Option<Version>> { self.0.version_asof(c, a) }
    fn versions(&self, c: &str, f: &str, t: &str) -> Result<Vec<Version>> { self.0.versions(c, f, t) }
    fn latest(&self, c: &str) -> Result<Option<Version>> { self.0.latest(c) }
    fn dependents(&self, r: &str) -> Result<Vec<String>> { self.0.dependents(r) }
    fn inputs(&self, r: &str) -> Result<Vec<String>> { self.0.inputs(r) }
    fn put_namespace(&self, h: &str, k: &[u8], v: &str) -> Result<()> { self.0.put_namespace(h, k, v) }
    fn namespace(&self, h: &str) -> Result<Option<Namespace>> { self.0.namespace(h) }
    fn namespaces(&self) -> Result<Vec<Namespace>> { self.0.namespaces() }
    fn record_namespace_failure(&self, h: &str, a: &str, n: u32) -> Result<Option<Namespace>> { self.0.record_namespace_failure(h, a, n) }
    fn record_namespace_success(&self, h: &str, a: &str) -> Result<Option<Namespace>> { self.0.record_namespace_success(h, a) }
    fn bind_name(&self, n: &str, f: &str, t: &str) -> Result<()> { self.0.bind_name(n, f, t) }
    fn resolve_name(&self, n: &str, a: &str) -> Result<Option<String>> { self.0.resolve_name(n, a) }
    fn resolve_binding(&self, n: &str, a: &str) -> Result<Option<Binding>> { self.0.resolve_binding(n, a) }
    fn put_class(&self, b: &[u8]) -> Result<String> { self.0.put_class(b) }
    fn class(&self, h: &str) -> Result<Option<Vec<u8>>> { self.0.class(h) }
    fn bind_class(&self, n: &str, h: &str, t: &str) -> Result<()> { self.0.bind_class(n, h, t) }
    fn resolve_class(&self, n: &str, a: &str) -> Result<Option<String>> { self.0.resolve_class(n, a) }
    fn resolve_class_binding(&self, n: &str, a: &str) -> Result<Option<ClassBinding>> { self.0.resolve_class_binding(n, a) }
    fn put_computed(&self, c: &str, t: &str, r: &str) -> Result<()> { self.0.put_computed(c, t, r) }
    fn computed_asof(&self, c: &str, a: &str) -> Result<Option<Version>> { self.0.computed_asof(c, a) }
    fn stored_asof(&self, c: &str, a: &str) -> Result<Option<Version>> { self.0.stored_asof(c, a) }
    fn cell_dependents(&self, c: &str) -> Result<Vec<String>> { self.0.cell_dependents(c) }
    fn put_manifest(&self, b: &[u8]) -> Result<String> { self.0.put_manifest(b) }
    fn member_manifests(&self, r: &str) -> Result<Vec<String>> { self.0.member_manifests(r) }
    fn slice_entries(&self, r: &str) -> Result<Vec<String>> { self.0.slice_entries(r) }
    fn slice_dependents(&self, e: &str) -> Result<Vec<String>> { self.0.slice_dependents(e) }
    fn slice_members(&self, s: &Slice, a: &str) -> Result<Vec<SliceMember>> { self.0.slice_members(s, a) }
    fn versions_between(&self, c: &str, f: &str, t: &str, a: &str) -> Result<Vec<SliceMember>> { self.0.versions_between(c, f, t, a) }
    fn slice_values(&self, s: &Slice, a: &str) -> Result<Vec<SliceValue>> { self.0.slice_values(s, a) }
    fn slice_changed_after(&self, s: &Slice, a: &str) -> Result<bool> { self.0.slice_changed_after(s, a) }
    fn computed_cells(&self, s: &Slice, a: &str, n: usize) -> Result<Vec<Cell>> { self.0.computed_cells(s, a, n) }
    fn has_bindings_under(&self, n: &str) -> Result<bool> { self.0.has_bindings_under(n) }
    fn upsert_catalog(&self, e: &[CatalogEntry]) -> Result<Vec<i64>> { self.0.upsert_catalog(e) }
    fn upsert_key_values(&self, o: &str, k: &str, v: &[KeyValue]) -> Result<Vec<i64>> { self.0.upsert_key_values(o, k, v) }
    fn refresh_value_counts(&self) -> Result<u64> { self.0.refresh_value_counts() }
    fn text_find(&self, q: &str, l: usize) -> Result<Vec<Hit>> { self.0.text_find(q, l) }
    fn vector_find(&self, m: &str, v: &[f32], l: usize) -> Result<Vec<Hit>> { self.0.vector_find(m, v, l) }
    fn put_embeddings(&self, m: &str, i: &[Embedding]) -> Result<()> { self.0.put_embeddings(m, i) }
    fn pending_embeddings(&self, m: &str, l: usize) -> Result<Vec<PendingEmbedding>> { self.0.pending_embeddings(m, l) }
    fn vector_available(&self) -> bool { self.0.vector_available() }
    fn log_miss(&self, q: &str) -> Result<()> { self.0.log_miss(q) }
    fn catalog_summary(&self) -> Result<Summary> { self.0.catalog_summary() }
    fn put_function_test(&self, t: &FunctionTest) -> Result<bool> { self.0.put_function_test(t) }
    fn function_tests(&self, f: &str) -> Result<Vec<FunctionTest>> { self.0.function_tests(f) }
    fn record_function_test(&self, f: &str, c: &str, r: &str, res: &str, d: &str) -> Result<bool> { self.0.record_function_test(f, c, r, res, d) }
    fn set_function_branches(&self, f: &str, t: u32, c: u32) -> Result<()> { self.0.set_function_branches(f, t, c) }
    fn function_readers(&self, n: &str) -> Result<Vec<String>> { self.0.function_readers(n) }
    fn bound_names(&self, f: &str) -> Result<Vec<String>> { self.0.bound_names(f) }
}

Required Methods§

Source

fn put_descriptor(&self, bytes: &[u8]) -> Result<String>

Stores a descriptor (checked and canonicalised by the core); returns its function hash. Idempotent.

Source

fn put_receipt(&self, bytes: &[u8]) -> Result<String>

Stores a receipt that verifies (SPEC 10.1 steps 1-6) against the key document stored for its signer host with put_namespace, in canonical form, with an edge to each of its inputs; returns its hash. An input that is a slice entry (slice:<slice id>:<members hash>, since 0.3.1) is recorded as such (slice_entries); its manifest need not be stored, before or after (it is needed only to recompute, SPEC 10.1 step 7.5). The receipt’s cell is indexed by its typed arguments (slice_members). A receipt that does not verify is refused with verify’s code (no key document for the host: E_KEY_UNAVAILABLE). Idempotent: bytes whose canonical form is the stored copy return its hash without checking the signature again (it verified when stored), even if the key has since been revoked. Other bytes with a stored hash are verified first, then refused as Error::Conflict.

Source

fn put_blob(&self, bytes: &[u8]) -> Result<String>

Stores blob content; returns its SHA-256 (lowercase hex). Idempotent.

Source

fn blob(&self, sha256: &str) -> Result<Option<Cow<'_, [u8]>>>

Blob content by SHA-256.

Source

fn put_version(&self, cell_id: &str, tx: &str, receipt_hash: &str) -> Result<()>

Appends a version: from tx on, cell_id has the value of receipt receipt_hash, which must be stored, of that cell and at that tx. tx must be later than the cell’s latest version (Error::NotLater).

Source

fn version_asof(&self, cell_id: &str, asof: &str) -> Result<Option<Version>>

The cell’s latest version with tx <= asof.

Source

fn versions(&self, cell_id: &str, from: &str, to: &str) -> Result<Vec<Version>>

The cell’s versions with from <= tx <= to, in tx order.

Source

fn latest(&self, cell_id: &str) -> Result<Option<Version>>

The cell’s latest version.

Source

fn dependents(&self, receipt_hash: &str) -> Result<Vec<String>>

The stored receipts that list receipt_hash among their inputs, by hash. Only as an input of its own: a receipt read as a member of a slice is found through its manifests (member_manifests, then slice_dependents).

Source

fn inputs(&self, receipt_hash: &str) -> Result<Vec<String>>

The inputs of a stored receipt that are receipt hashes (whether or not they are stored). Its slice entries are slice_entries.

Source

fn put_namespace( &self, host: &str, keydoc_bytes: &[u8], validated_at: &str, ) -> Result<()>

Records a host’s key document, checked as a 200 response for that host would be (SPEC 9.2, 9.3), validated at validated_at. Re-validation replaces the document; a validated_at earlier than the recorded one is Error::NotLater. Receipts already stored are not re-checked: they verified when they were stored (and putting one again stays idempotent).

Source

fn namespace(&self, host: &str) -> Result<Option<Namespace>>

A host’s recorded key document.

Source

fn namespaces(&self) -> Result<Vec<Namespace>>

Every recorded namespace, by host. Since the namespace checks (since 0.4.1).

Source

fn record_namespace_failure( &self, host: &str, checked_at: &str, threshold: u32, ) -> Result<Option<Namespace>>

Records a failed check of host’s key document at checked_at (domain validation): the consecutive failures grow by one, and when they reach threshold (zero counts as one) the namespace is suspended at checked_at, unless it already is (the first suspension’s time is kept). While it is suspended the store refuses new writes under the host: put_receipt of a receipt signed by it, put_version of such a receipt and bind_name of a name under it (Error::NamespaceSuspended); reads, verification and the stored key document are not affected, and neither is putting a receipt that is already stored. Returns the namespace as recorded, or None for a host with no namespace (there is nothing to suspend). A checked_at earlier than the latest check is Error::NotLater. Since the namespace checks (since 0.4.1).

Source

fn record_namespace_success( &self, host: &str, checked_at: &str, ) -> Result<Option<Namespace>>

Records a successful check of host’s key document at checked_at: the consecutive failures are reset to zero and a suspension is lifted (the namespace is reinstated). The document itself is recorded with put_namespace (which neither suspends nor reinstates). Returns the namespace as recorded, or None for a host with no namespace. A checked_at earlier than the latest check is Error::NotLater. Since the namespace checks (since 0.4.1).

Source

fn bind_name(&self, fn_name: &str, fn_hash: &str, tx: &str) -> Result<()>

Appends a binding: from tx on, the fully qualified function name fn_name means fn_hash, whose descriptor must be stored. tx must be later than the name’s latest binding (Error::NotLater).

Source

fn resolve_name(&self, fn_name: &str, asof: &str) -> Result<Option<String>>

The function hash fn_name meant as of asof: the hash of resolve_binding’s binding.

Source

fn resolve_binding(&self, fn_name: &str, asof: &str) -> Result<Option<Binding>>

The binding of fn_name that answers as of asof: the one with the latest tx <= asof, with its function hash and its tx, when it began; None before the first. A name bound again to a hash it meant before (even the hash of the binding before it) begins again: the later binding’s tx. Since 0.3.0.

Source

fn put_class(&self, bytes: &[u8]) -> Result<String>

Stores a class descriptor (SPEC 16.1, 16.2) under its class hash and returns the hash. Since 0.4.1.

bytes must be a flattened descriptor in canonical form (the bytes ClassDescriptor::canonical gives, 6.2: what the class hash hashes). The core checks it (ClassDescriptor::from_json: strict JSON, then 16.1 in its check order; a flattened descriptor passes). Bytes that are a valid descriptor but not the canonical form of it (white space, members out of order) are refused with Error::Invalid, code E_SCHEMA, and nothing is stored: unlike put_descriptor, which canonicalises, the bytes put are the bytes stored, so the class hash is the SHA-256 of what class returns. Idempotent for the same bytes.

The store does not flatten (that is define’s, with the parent in hand), and does not need the parent, the method functions or the interfaces to be stored (bind_class needs the methods’ descriptors). It does not check the owner either (16.2 step 1 is the definer’s check: the store records, http and the engine enforce). It is a write under the class’s steward namespace (steward.namespace): refused with Error::NamespaceSuspended while that namespace is suspended, even for a class already stored.

Source

fn class(&self, class_hash: &str) -> Result<Option<Vec<u8>>>

The canonical bytes of the class descriptor with this class hash, as stored (put_class); None when no such class is stored. A malformed hash is E_CANON_HEX. Never refused under a suspended namespace. Since 0.4.1.

Source

fn bind_class(&self, class_name: &str, class_hash: &str, tx: &str) -> Result<()>

Binds the class name class_name (a full name, 2.3) to the stored class class_hash from tx on and, in the same transaction, binds each method <class_name>/<m> of the stored (flattened, so inherited methods included) descriptor to the method’s function hash from the same tx (SPEC 16.3, 9.7). All of it or nothing:

  • the class must be stored (Error::NotFound, what "class"), and so must every method’s function descriptor (Error::NotFound, what "descriptor", the missing function hash; the first in JCS order of method names);
  • class names and function names share one namespace of names: class_name, or a method name, whose latest binding is of the other kind (a function for class_name, a class for a method name) is refused with Error::NameTaken. A method name bound as a function, to whatever hash, is simply bound again;
  • tx must be later than the latest binding of class_name and of each method name (Error::NotLater, what "name", the name that is not);
  • while the namespace of class_name’s host is suspended: Error::NamespaceSuspended.

The store does not check that the class name is under the steward’s namespace, nor who binds it (the definer’s check, 16.2 step 1). Since 0.4.1.

Since 0.5.4 (K5), only the methods the class adds or overrides are bound under its name: those whose function hash its parent’s flattened descriptor does not give (or that the parent does not have). An inherited method’s name is not bound, so S/m of an inherited m answers None. Under 0.5.3 every flattened method was bound.

Source

fn resolve_class(&self, class_name: &str, asof: &str) -> Result<Option<String>>

The class hash class_name meant as of asof: the hash of resolve_class_binding’s binding. None before the first binding, and for a name whose binding as of asof is a function’s. Since 0.4.1.

Source

fn resolve_class_binding( &self, class_name: &str, asof: &str, ) -> Result<Option<ClassBinding>>

The class binding of class_name that answers as of asof: the latest with tx <= asof, with its class hash and its tx (when it began; binding the same hash again begins again), as resolve_binding does for functions. None before the first, and for a function name. The function accessors (resolve_name, resolve_binding) answer None for a class name: a bindings answer (9.7) has fn_hash or class_hash, never both. Since 0.4.1.

Source

fn put_computed( &self, cell_id: &str, tx: &str, receipt_hash: &str, ) -> Result<()>

Records that receipt_hash (stored, a receipt of cell_id at tx) is a computed version of the cell. Insert-only, in any order (an older version may be added after a newer one): tx need not be later than anything. The version’s asof is the receipt’s. Idempotent for the same (cell_id, tx, asof, receipt_hash); another receipt for an existing (cell_id, tx, asof) is Error::Conflict (its hash is the receipt refused) and the stored one is kept. The receipt is checked as for put_version: Error::NotFound when it is not stored, Error::Mismatch when it is of another cell or at another tx. Since 0.2.0.

Source

fn computed_asof(&self, cell_id: &str, asof: &str) -> Result<Option<Version>>

The computed version that answers as of asof: the one with the greatest asof <= asof (between equal asof, the greatest tx), or None. Since 0.2.0.

Source

fn stored_asof(&self, cell_id: &str, asof: &str) -> Result<Option<Version>>

The stored version that answers as of asof: the latest version (by tx) with tx <= asof whose receipt’s asof is also <= asof, or None. A version whose receipt is late-signed (asof later than tx) answers only from its asof on; until then the version before it answers. (version_asof keeps its tx-only meaning.) Since 0.2.0.

Source

fn cell_dependents(&self, cell_id: &str) -> Result<Vec<String>>

The cells that read cell_id: the cell ids of the stored receipts that list, among their inputs, any stored receipt of cell_id (lineage: edges joined to receipts), or (since 0.3.1) a slice entry whose stored manifest lists one as a member. Ascending, each once. Since 0.2.0.

Source

fn put_manifest(&self, bytes: &[u8]) -> Result<String>

Stores a manifest (SPEC 15.13), {"members": [...], "slice": {...}}: parsed strictly and checked by the core (Manifest::from_json: structure, members, their order and limit, the slice object), kept in canonical form under its entry slice:<slice id>:<members hash>, which it returns, and recorded for each member (member_manifests). The members need not be stored. Idempotent; insert-only (the entry is a hash of the content, so a stored entry always has these bytes). Served by manifest. Since 0.3.1.

Source

fn member_manifests(&self, receipt_hash: &str) -> Result<Vec<String>>

The entries of the stored manifests that list receipt_hash among their members, ascending: from a member, the slices it was read in (then slice_dependents). Since 0.3.1.

Source

fn slice_entries(&self, receipt_hash: &str) -> Result<Vec<String>>

The slice entries among the inputs of a stored receipt, ascending. Since 0.3.1.

Source

fn slice_dependents(&self, entry: &str) -> Result<Vec<String>>

The stored receipts whose inputs list the slice entry entry, by hash, ascending. An entry is slice: and two 64-digit hashes (E_CANON_HEX otherwise). Since 0.3.1.

Source

fn slice_members(&self, slice: &Slice, asof: &str) -> Result<Vec<SliceMember>>

The members of slice as of asof (SPEC 15.13), with the stored version of each that answers as of asof and its receipt’s bytes.

For a slice of cells: the cells of the slice’s function (its fn_hash, ns and fn, with the same argument names) whose bound arguments are the same typed scalar, whose ranged arguments are of the range’s type and within it (lo <= v <= hi, inclusive, in the type’s order: numbers as exact decimals, dates and instants chronologically, strings by code point; lo after hi is empty), any value for an open argument, and that have a stored version answering as of asof: as stored_asof, the latest version with tx <= asof whose receipt’s asof <= asof (so a late-signed version is not a member’s answer before its asof, and a correction replaces a member’s version from its asof on). Computed versions are not members. In key order: by the open and ranged arguments in ascending name order, each in its type’s order (false before true; blobs as text); the cell id last, for two cells whose key arguments are of different types.

For a version slice {"cell", "from", "to"}: versions_between of its cell. Empty when nothing matches. Since 0.3.1.

Source

fn versions_between( &self, cell_id: &str, from: &str, to: &str, asof: &str, ) -> Result<Vec<SliceMember>>

The stored versions of cell_id with from <= tx <= to that answer as of asof (tx <= asof and the receipt’s asof <= asof), ascending by tx, each with its receipt’s bytes: SPEC 15.13’s version slice. Empty when from is after to. Since 0.3.1.

Source

fn slice_values(&self, slice: &Slice, asof: &str) -> Result<Vec<SliceValue>>

The members slice_members gives, in its order and by its answering rule, each as its version, its receipt’s typed value and its cell (with its arguments), without the receipt’s bytes (the value is a stored column of the receipt and the cell comes from the typed-argument index, neither parsed per call). Since 0.3.2.

Source

fn slice_changed_after(&self, slice: &Slice, asof: &str) -> Result<bool>

Whether the members of slice, or their versions, may answer differently as of some time after asof: whether a cell matching the slice has a stored version whose receipt’s asof is after asof (its tx is never later than that), for a version slice one with tx in [from, to]. false means slice_members (and slice_values) give the same answer as of every time from asof on, until a version is stored with an asof after it; true may be conservative (a late-signed version superseded before its asof never answers). Index scans only, whatever the slice’s size: two bounded probes (at most 10,001 entries each) choose whether to walk the function’s receipts with an asof after asof or the slice’s candidate cells, whichever is fewer, and one query walks it, stopping at the first match. Since 0.3.2.

Source

fn computed_cells( &self, slice: &Slice, asof: &str, limit: usize, ) -> Result<Vec<Cell>>

The cells of slice (matched as slice_values matches them: the fixed arguments, fn_hash, ns, fn and the number of arguments) that have a computed version answering as of asof: one with tx <= asof whose receipt’s asof is <= asof (the rule of computed_asof). Ascending by cell id, at most limit (slice_values takes no limit), each with its arguments from the typed-argument index. A cell with only a stored version is not returned. Since 0.4.2.

Source

fn has_bindings_under(&self, namespace: &str) -> Result<bool>

Whether any name binding or class binding has a name starting with namespace and / (so "a.example/n" is not a namespace of "a.example/ns/f"). Since 0.4.2.

Source

fn upsert_catalog(&self, entries: &[CatalogEntry]) -> Result<Vec<i64>>

Inserts or replaces catalogue entries, keyed by (kind, name); returns each entry’s id, in order. All or nothing: every entry is checked first (the name by the core’s rules, hash as 64 hex digits, the bounds of CatalogEntry) and refused with Error::Invalid before anything is written. An operator’s entry never replaces a publisher’s: that entry is kept, and the call still answers its id. A publisher’s replaces either. Replacing an entry’s label or description drops its embedding. Since 0.5.0.

Source

fn upsert_key_values( &self, owner: &str, key: &str, values: &[KeyValue], ) -> Result<Vec<i64>>

Inserts or replaces the values of key of owner (a function or class name): each value’s label and aliases are replaced, and its n_cells is kept. Values not in values stay (an upsert adds and replaces, it does not prune). Returns each value’s id, in order. Replacing a value’s label drops its embedding. Since 0.5.0.

Source

fn refresh_value_counts(&self) -> Result<u64>

Sets every dictionary value’s n_cells to the number of cells of the function named by its owner that have that value for the key; returns the number of rows refreshed (every value, changed or not). Since 0.5.0.

Source

fn text_find(&self, query: &str, limit: usize) -> Result<Vec<Hit>>

The entries and dictionary values that match every word of query (split on white space; a word matches case-insensitively, literally, in any field of the entry or value, and scores 1.0 as a whole field, 0.8 as one of a field’s words, 0.5 inside a field; a score is the mean over the words, in (0, 1]). Best first, ties by name; at most limit. A blank query finds nothing. Since 0.5.0.

Source

fn vector_find( &self, model: &str, vec: &[f32], limit: usize, ) -> Result<Vec<Hit>>

The entries and values nearest to vec by cosine similarity, among those with an embedding for model: each score is 1 minus the cosine distance (1.0 for the same direction), best first, at most limit. vec has 384 finite values, not all zero (Error::Invalid otherwise). Error::Unsupported where vector_available is false. Since 0.5.0.

Source

fn put_embeddings(&self, model: &str, items: &[Embedding]) -> Result<()>

Stores embeddings for model, one per (kind, id, model): an existing one is replaced. All or nothing; a reference to an entry or value that is not stored is Error::NotFound, and a vector is checked as vector_find checks it. Error::Unsupported where vector_available is false. Since 0.5.0.

Source

fn pending_embeddings( &self, model: &str, limit: usize, ) -> Result<Vec<PendingEmbedding>>

Up to limit entries and values with no embedding for model, with the text to embed (see PendingEmbedding). Empty where vector_available is false (nothing can be stored there). Since 0.5.0.

Source

fn vector_available(&self) -> bool

Whether vectors can be stored and searched by this store: PostgreSQL with the vector extension, where the migration made the embeddings table. Looked at when the store is opened (migrate before opening, as the schema is then in place). Since 0.5.0.

Source

fn log_miss(&self, query: &str) -> Result<()>

Records a find that found nothing: the query’s text (trimmed, at most 512 bytes; a blank query records nothing) and the time. The store keeps at most FIND_MISSES_CAP rows, pruning the oldest. Since 0.5.0.

Source

fn catalog_summary(&self) -> Result<Summary>

The catalogue as an operator reads it: every entry with its label and its cell count, and every dictionary with its first 50 values (by value) and how many it has. Since 0.5.0.

Source

fn put_function_test(&self, test: &FunctionTest) -> Result<bool>

Stores a function test, if its (fn_hash, case) has none: Ok(true) when the row is inserted, Ok(false) when one exists, in which case nothing changes (the first writer’s signed_by and test_json stay). The test is checked first: a 64-digit hash, a 16-digit case, a canonical test_json, a signer of 1 to 256 bytes, an instant and result if it carries them, and branch counts with covered not above total, each at most i32::MAX; a failing check is Error::Invalid and nothing is stored. Since 0.5.1.

Source

fn function_tests(&self, fn_hash: &str) -> Result<Vec<FunctionTest>>

Every test of fn_hash, ordered by case ascending; empty when there are none. Since 0.5.1.

Source

fn record_function_test( &self, fn_hash: &str, case: &str, run_at: &str, result: &str, detail: &str, ) -> Result<bool>

Records a run of the test (fn_hash, case): sets its last_run_at (the instant run_at), last_result and last_detail. Ok(true) when the test exists; Ok(false) when it does not, and nothing is inserted. result must be pass, fail or error: any other value is Error::Invalid, and nothing changes. Since 0.5.1.

Source

fn set_function_branches( &self, fn_hash: &str, total: u32, covered: u32, ) -> Result<()>

Sets branches_total and branches_covered on every test of fn_hash. A function with no tests is a no-op, not an error. covered above total is Error::Invalid. Since 0.5.1.

Source

fn function_readers(&self, name: &str) -> Result<Vec<String>>

The function hashes of the stored descriptors whose inputs contain name (a fully qualified function name), distinct, ascending. Answered from the index of descriptor inputs, which put_descriptor fills; the migration that introduced the index filled it from the descriptors stored before. Since 0.5.1.

Source

fn bound_names(&self, fn_hash: &str) -> Result<Vec<String>>

Every fully qualified name ever bound (by bind_name) to fn_hash, distinct, ascending. A name since bound to another hash still lists this one. Since 0.5.1.

Provided Methods§

Source

fn put_member_set(&self, set: &MemberSet) -> Result<bool>

Writes the member-set row (G2, since 0.6.5): inserted when no row with its entry is held (Ok(true)), otherwise nothing (Ok(false), the held row kept). A row that is not consistent (its entry, slice bytes, function hash or instants) is Error::Invalid.

Source

fn slice_seq(&self, slice: &Slice) -> Result<i64>

The highest insertion seq among the versions (withdrawals included) of the cells a slice matches, whatever their recorded time; 0 when there are none. For a version slice, its cell’s versions (decided 26 Nov, G3: “inserted since”, index-backed). Since 0.6.5.

Source

fn recording_time(&self, signed_tx: &str) -> String

The time a version signed at signed_tx is recorded at by the next put (G9): the greater of signed_tx and this store’s recording clock, or signed_tx with no clock. Exactly the rule the puts apply, so publish-stored can compare against it. Since 0.6.5.

Decided 27 Nov (B5): the puts also record a version after its cell’s latest recorded time, a microsecond later, so the time a put of a cell that already has versions records is later still. This method gives the signed-tx-and-clock part only; a per-cell check must use the cell’s latest.

Source

fn barrier(&self) -> Result<()>

Waits for the writers of versions in flight, and returns at once when there is none (review item 2): once it has passed, any writer still to come records a time later than it. The engine calls it once per request, before its first store read. Since 0.6.5.

Source

fn slice_member_hashes( &self, slice: &Slice, asof: &str, limit: usize, ) -> Result<Vec<String>>

The receipt hashes of the members of a slice as of asof, at most limit, in no particular order (the engine sorts them, and uses the limit only to see whether there are more). Members are selected as of asof by recorded time, the rules of slice_members; no values or receipt bytes are read. Since 0.6.5.

Source

fn later_bound(&self, cell_id: &str, recorded: &str) -> Result<Option<String>>

The least start, over the versions of cell_id recorded after recorded, of max(receipt asof, recorded); None when none is recorded after (decided 27 Nov, A1: the memo bound, one aggregate row). Since 0.6.5.

Source

fn slice_member_hashes_within( &self, slice: &Slice, asof: &str, limit: usize, timeout: Duration, ) -> Result<Vec<String>>

The receipt hashes of the members of a slice as of asof, at most limit, within timeout (decided 27 Nov, B6: the rebuild listing under the budget’s remaining time). On PostgreSQL the statement runs under statement_timeout; on SQLite a progress deadline stops it. Past the timeout the call fails with Error::Timeout. Since 0.6.5.

Source

fn next_version_after( &self, cell_id: &str, recorded: &str, ) -> Result<Option<Version>>

The first version of cell_id recorded after recorded (one row, the memo bound), or None. Since 0.6.5.

Source

fn fn_seq(&self, fn_hash: &str) -> Result<i64>

The highest insertion seq among the versions (withdrawals included) of the functions fn_hash, 0 when there are none: an upper bound of slice_seq for every slice of that function, in one probe of the function’s row (decided 26 Nov, G3: a slice whose fn_seq is at or below its row’s seen_seq is unchanged, with no candidate walk). Since 0.6.5.

Source

fn member_set(&self, entry: &str) -> Result<Option<MemberSet>>

The member-set row of entry, or None (G2, since 0.6.5).

Source

fn put_slice_definition(&self, slice: &Slice) -> Result<bool>

Writes a slice’s definition (G10, since 0.6.5), kept once per slice id (not per date): Ok(true) when inserted, Ok(false) when held already.

Source

fn slice_definition(&self, slice_id: &str) -> Result<Option<Slice>>

The definition of the slice slice_id, or None (G10, since 0.6.5).

Source

fn latest_many(&self, cell_ids: &[&str]) -> Result<Vec<Option<Version>>>

latest of each of cell_ids, in input order (duplicates allowed; empty input, empty result). The first malformed id is the error. Since 0.4.3.

Source

fn receipts_many(&self, hashes: &[&str]) -> Result<Vec<Option<Vec<u8>>>>

receipt of each of hashes, in input order, as owned bytes. Since 0.4.3.

Source

fn put_cells(&self, items: &[CellWrite<'_>]) -> Result<Vec<String>>

For each item in order, put_receipt and then, when the item has a version, put_version; returns the receipt hashes. All or nothing on PostgreSQL (one transaction; calls of up to 10,000 items are the size it is written for). SQLite (and this default) loops, stops at the first error, and need not be atomic: the items before a failing one stay stored there. Since 0.4.3.

Source

fn close_binding(&self, name: &str, at: &str) -> Result<()>

Closes the latest binding of name, a function name or a class name, from at on: as of at or later the name resolves to None (also through resolve_binding and resolve_class_binding), and as of an earlier instant the binding it had. Closing a class name closes its method names (<class name>/<m>, the ones bind_class bound) from the same at. The name may be bound again later (bind_name, bind_class), with a tx after at. Each close is one row of the binding history (with written_at). at must be later than the latest binding of the name; a name with no binding, or whose latest binding is closed, is Error::NotFound (what is binding). A malformed instant is E_CANON_INSTANT. The default is Error::Unsupported. Since 0.6.0.

Source

fn class_names_bound_to( &self, class_hash: &str, at: &str, ) -> Result<Vec<String>>

The class names whose class binding as of at (the latest with tx <= at, as resolve_class_binding takes it) is class_hash, in byte order, each once. A name rebound to another hash is no longer listed from that binding’s tx on. Function names are never listed. Empty when none is bound (also when the hash is not stored, or at is before the first binding). A malformed hash is E_CANON_HEX, a malformed instant E_CANON_INSTANT. The default is Error::Unsupported. Since 0.5.3.

Source

fn slice_withdrawn_latest( &self, slice: &Slice, asof: &str, ) -> Result<Option<(String, String)>>

The latest withdrawal among the cells that match slice (SPEC 8.2, spec-0.7.0): among the cells whose version answering as of asof (the rule of stored_asof) is a withdrawal, the greatest by tx, then by asof; its (tx, asof). None when no such cell. A version slice’s one cell counts when its answering version is a withdrawal with a tx in the slice’s range. A malformed instant is E_CANON_INSTANT. The default is Error::Unsupported. Since 0.6.0.

Source

fn name_function_tests( &self, fn_hash: &str, names: &[(String, String)], ) -> Result<u64>

Sets the function name of tests of fn_hash: each (case, fn_name) names the test of that case, if it has no name yet. A name once set is never changed, and a case with no test changes nothing. Returns the number of tests named (rows changed); an empty list is 0. The default is Error::Unsupported. Since 0.5.2.

Source

fn unnamed_function_tests(&self, limit: usize) -> Result<Vec<FunctionTest>>

Up to limit tests that have no function name, ordered by (function hash, case), each as function_tests gives it. Naming them drains the list. The default is Error::Unsupported. Since 0.5.2.

Source

fn function_test_summary( &self, fn_hash: &str, fn_name: Option<&str>, ) -> Result<TestSummary>

The summary of the tests of fn_hash in one aggregate: every test of the hash when fn_name is None, else only those named fn_name. A hash with no such test gives the zero summary (TestSummary::default). The default computes it from function_tests when fn_name is None, and is Error::Unsupported for a name (0.5.1 does not give a test’s name). Since 0.5.2.

Source

fn function_tests_page( &self, fn_hash: &str, fn_name: Option<&str>, after_case: Option<&str>, limit: usize, ) -> Result<Vec<FunctionTest>>

A page of the tests of fn_hash by case ascending: those named fn_name (or all, when None), with a case after after_case (exclusive, when given), at most limit. Whole rows, as function_tests gives them. The default is the page of function_tests when fn_name is None, and is Error::Unsupported for a name. Since 0.5.2.

Source

fn stored_receipts_of( &self, ns: &str, fn_name: &str, fn_hash: &str, limit: usize, ) -> Result<Vec<Vec<u8>>>

The receipts (bytes, as receipt returns them) of the latest stored version of up to limit cells of ns/fn_name/fn_hash that have one, lowest cell id first: at most limit cells are read. The default is Error::Unsupported (0.5.1 has no read of a function’s cells without a slice). Since 0.5.2.

Source

fn slice_values_limit( &self, slice: &Slice, asof: &str, limit: usize, ) -> Result<Vec<SliceValue>>

slice_values with at most limit members: the first limit of its order (the same members, in the same order). The default takes them from slice_values. Since 0.5.2.

Source

fn versions_limit( &self, cell_id: &str, from: &str, to: &str, limit: usize, ) -> Result<Vec<Version>>

versions with at most limit versions: the first limit, in tx order. The default takes them from versions. Since 0.5.2.

Source

fn stored_cell_count( &self, ns: &str, fn_name: &str, fn_hash: &str, ) -> Result<u64>

The number of cells of ns/fn_name/fn_hash that have a stored version (a second version of a cell is not a second cell). The default is Error::Unsupported. Since 0.5.2.

Source

fn has_key_value(&self, owner: &str, key: &str, value: &str) -> Result<bool>

Whether owner has the dictionary value value for key, exactly (the value’s text, case-sensitive; no prefix, substring or label match). Indexed in the native stores. The default asks text_find for value and keeps the exact match. Since 0.5.2.

Source

fn key_value_count(&self, owner: &str, key: &str) -> Result<u64>

The number of dictionary values owner has for key. The default is Error::Unsupported. Since 0.5.2.

Source

fn mark_key_open(&self, owner: &str, key: &str) -> Result<()>

Marks the key key of owner open: it takes no automatic values from now on. Marking an open key again changes nothing. Its existing values stay. The default is Error::Unsupported. Since 0.5.2.

Source

fn key_is_open(&self, owner: &str, key: &str) -> Result<bool>

Whether the key key of owner has been marked open (mark_key_open). The default is Error::Unsupported. Since 0.5.2.

Source

fn open_key_count(&self) -> Result<u64>

The number of keys marked open, of any owner (mark_key_open). The default is 0, which is exact for a store with no open key. Since 0.5.2.

Source

fn catalog_entry(&self, name: &str) -> Result<Option<CatalogEntry>>

The catalogue entry named name (exactly), if there is one. A name may be the name of a function and of a class; the function’s entry is given first, then a method’s, then a class’s. The default is Error::Unsupported. Since 0.5.2.

Source

fn upsert_catalog_ext(&self, entries: &[CatalogEntryExt]) -> Result<Vec<i64>>

Inserts or replaces catalogue entries with their facets and extends, keyed by (kind, name), as upsert_catalog does, and replaces the facets and extends of an existing row. Checked first, all or nothing (Error::Invalid): the facets (a key of domain, thing, measure, region or frequency; 1 to 8 names each, names of at most 32 bytes, ascending and unique), and extends (a full function name, on a function only). The store does not check that extends names a stored class, nor the key rule of 16.3. Returns each entry’s id, in order. The default is Error::Unsupported. Since 0.6.0.

Source

fn catalog_entry_ext( &self, kind: CatalogKind, name: &str, ) -> Result<Option<CatalogEntryExt>>

The catalogue entry of kind kind and name name (exactly), with its facets and extends, if there is one. The default is Error::Unsupported. Since 0.6.0.

Source

fn catalog_entries_with_facets(&self) -> Result<Vec<FacetedEntry>>

The entries that have at least one facet, by kind (as text: class, function, method) then name in byte order, each with its first binding time (see FacetedEntry). The default is Error::Unsupported. Since 0.6.0.

Source

fn extensions_of(&self, class: &str) -> Result<Vec<CatalogEntryExt>>

The function entries whose extends is class, by name in byte order. A class that is not a full name is Error::Invalid. The default is Error::Unsupported. Since 0.6.0.

Source

fn extensions_of_limit( &self, class: &str, limit: usize, ) -> Result<Vec<CatalogEntryExt>>

extensions_of with at most limit entries: the first limit by name (CONTRACT-round-0.7 R11, the bounded read of a describe). The backends read limit rows (LIMIT, with the index on extends). The default takes them from extensions_of. Since 0.6.0.

Source

fn cell_count(&self, ns: &str, fn_name: &str, fn_hash: &str) -> Result<u64>

The number of cells of ns/fn_name/fn_hash: every cell with a stored receipt, a second version of a cell not counted again. Read from the counter (PK), not counted over the cells. The default is stored_cell_count. Since 0.5.3.

Source

fn function_test( &self, fn_hash: &str, case: &str, ) -> Result<Option<FunctionTest>>

The test of fn_hash with case case (16 hex digits), if there is one: one row by primary key, as function_tests gives it. The default takes it from function_tests. Since 0.5.3.

Source

fn function_tests_failing( &self, fn_hash: &str, fn_name: Option<&str>, limit: usize, ) -> Result<Vec<FunctionTest>>

Up to limit tests of fn_hash whose last result is fail or error, by case ascending, among those named fn_name (or all, when None). A SQL limit: the rows past it are not read. The default pages function_tests_page (which is Error::Unsupported for a name). Since 0.5.3.

Source

fn false_test_cells( &self, fn_hash: &str, limit: usize, ) -> Result<Vec<(String, Vec<u8>)>>

The stored test_case cells of any namespace whose function_hash argument is fn_hash and whose latest version is false: each as (cell id, the bytes of the receipt of that latest version), at most limit, in one query. The default is Error::Unsupported. Since 0.5.3.

Source

fn dependants_of( &self, name: &str, at: &str, limit: usize, ) -> Result<Vec<(String, String)>>

The names bound at at to a function hash that reads name (its descriptor’s inputs name it), as (name, fn_hash), at most limit. The default walks function_readers, bound_names and resolve_name. Since 0.5.3.

Source

fn slice_page( &self, slice: &Slice, asof: &str, after: Option<&[u8]>, limit: usize, ) -> Result<Vec<SliceValue>>

A page of the members of slice as of asof in sort-key order (CONTRACT-0.5.1 S2): those whose SliceValue::sort_key is greater than after (exclusive; all of them when None), at most limit, with the same membership as slice_values (fixed arguments, ranges, the latest version as of asof, withdrawals left out), so that a walk of pages, each from the last member’s key, gives slice_values member for member. A version slice has no key order to page by: Error::Unsupported. The default takes all of slice_values and pages them; the stores read the index of the function’s cells. Since 0.6.4.

Source

fn slice_values_page( &self, slice: &Slice, asof: &str, after_cell_id: Option<&str>, limit: usize, ) -> Result<Vec<SliceValue>>

A page of the members of slice as of asof, by cell id ascending: those whose cell id is after after_cell_id (exclusive, when given), at most limit, with one value per member. The default takes all of slice_values and pages them. Since 0.5.3.

Source

fn catalog_entries_all( &self, limit: usize, ) -> Result<Vec<(CatalogKind, String, String, String)>>

Up to limit catalogue entries as (kind, name, label, description), with no counts. The default is Error::Unsupported. Since 0.5.3.

Source

fn dictionary_values_ordered( &self, owner: &str, key: &str, limit: usize, ) -> Result<Vec<String>>

The values of dictionary key of owner, in insertion order, at most limit. The default is Error::Unsupported. Since 0.5.3.

Source

fn computed_asof_with_receipt( &self, cell_id: &str, asof: &str, ) -> Result<Option<(Version, Cow<'_, [u8]>)>>

computed_asof and the bytes of the version’s receipt (as receipt returns them), which is what a caller reads next. The default asks for the two in turn (a receipt that cannot be read then is Error::NotFound); PgStore and SqliteStore answer both with one query. Since 0.2.0.

Source

fn stored_asof_with_receipt( &self, cell_id: &str, asof: &str, ) -> Result<Option<(Version, Cow<'_, [u8]>)>>

stored_asof and the bytes of the version’s receipt, as computed_asof_with_receipt does. Since 0.2.0.

Source

fn put_listing(&self, l: &Listing) -> Result<ListingWrite>

Writes the listing l, all or nothing. Checked first (Error::Invalid): host a DNS name; name a function name whose first segment is host; fn_hash 64 lowercase hex digits and the hash of descriptor as put_descriptor computes it (a descriptor that does not parse, or hashes to another, is refused); subjects 1 to LISTING_SUBJECTS_MAX, ascending and unique, each key a name of at most 32 bytes; key_id 1 to 256 bytes; label at most 120 bytes; description 1 to 1024 bytes; fetched_at and listed_at instants.

When the stored row of name equals l in every field but fetched_at and listed_at, nothing is written (ListingWrite::Unchanged). Otherwise the row is inserted (ListingWrite::Inserted) or replaced (ListingWrite::Changed, keeping the stored listed_at), and in the same transaction: the descriptor is put in descriptors; the catalogue entry (kind function, name, hash fn_hash, label, description, no args, no examples, source CatalogSource::Listed, signed_by = host, facets = each subject key’s distinct values, ascending, at most 8 per key) is upserted, its embedding dropped when its text changes (as upsert_catalog_ext does). Never touched: name_bindings, the namespace checks, cells, receipts, versions. The default is Error::Unsupported. Since 0.7.0.

Source

fn listing(&self, name: &str) -> Result<Option<Listing>>

The listing of name, if there is one. The default is Error::Unsupported. Since 0.7.0.

Source

fn listings_of(&self, host: &str) -> Result<Vec<Listing>>

The listings of host, by name in byte order. The default is Error::Unsupported. Since 0.7.0.

Source

fn listing_count(&self) -> Result<u64>

The number of listings of every host. The default is Error::Unsupported. Since 0.7.0.

Source

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

Removes the listing of name and its catalogue entry of source listed (with the entry’s embeddings), in one transaction; the descriptor stays in descriptors. Ok(false) when there was none. The default is Error::Unsupported. Since 0.7.0.

Source

fn put_listed_host(&self, h: &ListedHost) -> Result<bool>

Writes the row of a listed host. Checked first (Error::Invalid): host a DNS name, last_seen a date, unreachable_since an instant. When the stored row equals h, nothing is written and the answer is Ok(false); otherwise it is inserted or replaced, Ok(true). The default is Error::Unsupported. Since 0.7.0.

Source

fn listed_host(&self, host: &str) -> Result<Option<ListedHost>>

The row of the listed host host, if there is one. The default is Error::Unsupported. Since 0.7.0.

Source

fn listed_hosts(&self) -> Result<Vec<ListedHost>>

Every listed host’s row, by host in byte order. The default is Error::Unsupported. Since 0.7.0.

Source

fn delete_listed_host(&self, host: &str) -> Result<bool>

Removes the row of host and every listing of host (as delete_listing does), in one transaction. Ok(false) when there was no host row. The default is Error::Unsupported. Since 0.7.0.

Source

fn set_listing_unreached(&self, name: &str, since: Option<&str>) -> Result<bool>

Sets (Some(instant)) or clears (None) the instant the listing of name was first not reached by a run that read its host’s catalogue (CONTRACT-http-listing, the re-review’s N1: a name’s own 7-day clock). Checked first: since an instant (Error::Invalid). No listing of name: Error::NotFound. When the stored value equals since, nothing is written and the answer is Ok(false); otherwise it is written, Ok(true). It touches no other column (not fetched_at). A deleted listing takes it with it; a new listing of the name starts with none. The default is Error::Unsupported. Since 0.7.2.

Source

fn listing_unreached(&self, name: &str) -> Result<Option<String>>

The instant the listing of name was first not reached, if it is not reached now; None when it is, or when there is no listing of name. The default is Error::Unsupported. Since 0.7.2.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§