Skip to main content

PgDocumentBuilder

Struct PgDocumentBuilder 

Source
pub struct PgDocumentBuilder { /* private fields */ }
Expand description

Builds index documents from a Postgres database, driven by a SourceSpec — the enabled indexes and their schemas, translated from the top-level config by the composition root. Cheap to clone — the pool, spec, and primary-key cache are shared.

Implementations§

Source§

impl PgDocumentBuilder

Source

pub fn new(pool: PgPool, spec: Arc<SourceSpec>) -> Self

Create a builder over a connection pool and the source spec.

Source

pub async fn connect( connection_url: &str, spec: Arc<SourceSpec>, ) -> Result<Self>

Connect a pool from a Postgres connection URL and build over it.

Trait Implementations§

Source§

impl Catalog for PgDocumentBuilder

The Postgres source’s view of its own catalog. The index mapping is derived from the self-describing schema in schema_core; this is the one store-specific piece used for validation — how Postgres types and constrains a column — so a declared schema can be checked against the live database.

Source§

fn column<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, schema: &'life1 DatabaseSchema, table: &'life2 TableName, column: &'life3 ColumnName, ) -> Pin<Box<dyn Future<Output = Result<ColumnInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

The type and nullability of column in table (within schema), as the store defines it.
Source§

impl Clone for PgDocumentBuilder

Source§

fn clone(&self) -> PgDocumentBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PgDocumentBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DocumentBuilder for PgDocumentBuilder

Source§

fn resolve<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, table: &'life1 TableName, key: &'life2 RowKey, ) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentId>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

The documents the changed row affects. Empty if it touches nothing any index cares about.
Source§

fn build<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 DocumentId, ) -> Pin<Box<dyn Future<Output = Result<Document>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Assemble one document, or report it deleted if its root row is absent.
Source§

fn build_many<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [DocumentId], ) -> Pin<Box<dyn Future<Output = Result<Vec<Document>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Assemble many documents at once. Returns one Document per requested id — an Upsert, or a Delete tombstone when the root row is absent — in any order; callers match results back by Document::id. Read more
Source§

fn backfill_scopes(&self) -> Vec<IndexScope>

The enabled indexes this builder serves, each with the root table to snapshot when seeding it. The engine uses this to scope an initial backfill per index. The default is empty — a builder with no backfillable indexes, which the engine simply never seeds.
Source§

fn index_mappings<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<IndexMapping>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The resolved mapping of every index this builder serves: each field typed from the schema’s explicit mapping where one is given, and from the source’s own column types otherwise. Sinks that own their index use this to create it up front. The default is empty — a builder that leaves index creation to whatever the sink does on first write.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more