Skip to main content

VirtualRowProvider

Trait VirtualRowProvider 

Source
pub trait VirtualRowProvider:
    Send
    + Sync
    + Debug {
    // Required methods
    fn id(&self) -> ProviderId;
    fn version(&self) -> u64;
    fn collect(&self) -> Vec<VirtualRow>;
}
Expand description

A producer of virtual rows.

Producers are registered with the (future) virtual-rows worker, which calls Self::collect when rebuilding the published VirtualRowMatrix. The worker merges the outputs of all registered providers, sorts, and publishes via ArcSwap.

D.0a ships the trait; the worker itself lands in D.0a.1 (or as part of D.3 when the first production consumer appears, whichever ships first). Tests build VirtualRowMatrix directly via VirtualRowMatrix::build rather than through a provider registry.

Required Methods§

Source

fn id(&self) -> ProviderId

A stable id for this provider. Used by the worker to deduplicate registration + route mutation notifications.

Source

fn version(&self) -> u64

Monotonic version counter — the provider bumps it whenever the rows Self::collect would emit have changed. The worker uses the combined fingerprint of all providers’ versions to short-circuit on the cache-hit path without paying for the (potentially expensive) collect calls.

D.0a.1 introduces this. Implementations whose row set is truly static may return 0 forever — the worker will then cache-hit unless some other provider’s version changes or the document’s line count changes.

Source

fn collect(&self) -> Vec<VirtualRow>

Emit the current set of virtual rows for the associated document.

Called by the worker on its rebuild path. Providers must not block; non-trivial computation belongs in the provider’s own background task with the result cached here.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§