Skip to main content

FlussoDocument

Trait FlussoDocument 

Source
pub trait FlussoDocument: DeserializeOwned {
    const INDEX: &'static str;
    const SCHEMA_HASH: &'static str;

    // Provided methods
    fn physical_index() -> String { ... }
    fn query() -> Search<Self> { ... }
    fn get(
        client: &Client,
        id: impl Display,
    ) -> impl Future<Output = Result<Option<Self>>> { ... }
}
Expand description

A document type bound to a flusso-maintained index — the trait that #[derive(FlussoDocument)] implements.

The derive supplies INDEX and SCHEMA_HASH (the physical index is {INDEX}_{SCHEMA_HASH}, exactly what the OpenSearch sink writes); query and get are provided. DeserializeOwned is required so search hits and fetched documents decode.

Required Associated Constants§

Source

const INDEX: &'static str

The logical index name this binding queries.

Source

const SCHEMA_HASH: &'static str

The schema hash this binding was generated from (the physical-index suffix).

Provided Methods§

Source

fn physical_index() -> String

The physical index this binding addresses — {INDEX}_{SCHEMA_HASH}, exactly what the sink writes. Useful for logging, admin, and hand-written FlussoMultiDocument impls dispatching hits by their _index.

Source

fn query() -> Search<Self>

Start a typed query against this index. No client is involved: the returned Search is a plain value — build it anywhere, store it, clone it, and hand a Client to a terminal (send / ids / count) when it’s time to run.

Source

fn get( client: &Client, id: impl Display, ) -> impl Future<Output = Result<Option<Self>>>

Fetch one document by id; None when absent.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§