Skip to main content

Module discovery

Module discovery 

Source
Expand description

Store-defined model discovery, separate from reading tensor bytes.

Providers advertise their filters. Common result metadata is optional and does not determine execution compatibility or replace a checkpoint inventory.

Adapters declare parameters through SearchSchema and implement StoreDiscovery. Callers use Discovery to validate requests, attach store identities, and follow continuation pages:

use cherenkov_model_data::discovery::*;
use serde_json::json;

fn browse(adapter: &dyn StoreDiscovery, id: StoreId) -> anyhow::Result<()> {
    let store = Discovery::new(id, adapter);
    let mut query = SearchQuery {
        text: None,
        filters: vec![Filter {
            field: "author".to_owned(),
            operator: FilterOperator::Equal,
            value: json!("example-team"),
        }],
        page: PageRequest { limit: 20, cursor: None },
    };

    loop {
        let page = store.search(&query)?;
        for item in page.items {
            println!("{}: {}", item.store.0, item.candidate.reference);
        }
        query.page.cursor = page.next_cursor;
        if query.page.cursor.is_none() {
            return Ok(());
        }
    }
}

An empty page can have a continuation. Keep the query and page size unchanged and pass the cursor back verbatim. Adapters remain responsible for native cursor validity and for returning candidates that satisfy every predicate.

Modules§

dispatch 🔒
Checked adapter calls, store-qualified results, and scoped continuations.
query 🔒
Schema validation checks operands; adapters evaluate them against metadata.

Structs§

Discovery
Validates discovery requests and attaches store identity to results. Constructing a dispatcher performs no I/O and does not enumerate the store. Search and enumeration are synchronous and may block on the adapter’s I/O. Cursor envelopes detect accidental reuse; they do not authenticate input.
DiscoveryCapabilities
Discovery operations supported by a store.
Filter
One predicate using a field from the selected store’s search schema.
MetadataGap
Missing metadata that prevented evaluating a supported filter for candidates.
ModelCandidate
A discovered candidate; the locator remains meaningful to its originating store.
ModelMetadata
Optional descriptive metadata shared by discovery results. Absence means unknown, rather than an empty string, zero, or a negative claim.
PageRequest
Bounded page request shared by search and inventory enumeration.
SearchField
Accepted operands and operations for one provider-specific search field. Advertising a field does not imply every candidate has a known value for it.
SearchPage
One result page. An empty page can still carry a continuation cursor.
SearchQuery
Search text and predicates, all of which must match for a result to qualify.
SearchSchema
Provider-defined filter fields and search limits, also usable to generate help. For example, an adapter can expose an exact publishing-account filter:
StoreId
Stable identity assigned by the store registry, independent of its display name. IDs must be unique and persist across restarts and enable/disable operations. A replacement store with a different source namespace needs a new ID so saved locators and cursors cannot silently resolve against another source.
StoredCandidate
Candidate with the store needed to resolve its provider-defined reference.
ValidatedPage
Enumeration request checked by Discovery, with a provider-native cursor. The adapter must still reject invalid or expired native positions.
ValidatedSearch
Search request checked by Discovery, with a provider-native cursor. Validation covers the advertised schema, not the native cursor’s contents or whether returned candidates satisfy the filters. The adapter checks those.

Enums§

FilterOperator
Predicate operations; providers advertise only those they can honor.
ValueType
JSON value types accepted as filter operands; values are never coerced.

Traits§

StoreDiscovery
Optional discovery operations exposed by a file-store adapter. Discovery returns candidates without registering models or fetching weights. Methods are synchronous; search and enumeration may block on I/O. Advertise only operations and filter semantics the adapter can honor.