pub struct RecordModel {Show 31 fields
pub prefix: EmissionPrefix,
pub record: Ident,
pub kind: NodeKind,
pub vis: Visibility,
pub teardown: bool,
pub asynchronous: Option<Path>,
pub streaming: Option<Path>,
pub autonomous: Option<Path>,
pub attributed: bool,
pub krate: Path,
pub remote: Option<Path>,
pub construction: Construction,
pub key: Key,
pub lineage: Option<Lineage>,
pub fields: Vec<Field>,
pub persist: Option<Persist>,
pub order_by: RustSafeName,
pub progress: Option<Progress>,
pub graphql: Option<Graphql>,
pub derived: Vec<Derived>,
pub artifacts: Vec<Artifact>,
pub implements: Vec<Path>,
pub errors: Vec<BackendError>,
pub subscribe: Option<Path>,
pub upstreams: Option<Upstreams>,
pub subscriptions: Option<Subscription>,
pub products: Option<Products>,
pub options: Option<Path>,
pub polls: Option<Polls>,
pub tracing: Option<TracingLevel>,
pub receipt: Option<Path>,
}Expand description
A validated record: what it is called, what it emits, and every field it declares.
Fields§
§prefix: EmissionPrefixThe EMISSION NAMESPACE this declaration’s minted names wear.
EmissionPrefix::INGRAPH for everything ingraph’s own front ends build, and a domain
framework’s own mark for a model mediagraph-codegen or its successors build — see
crate::prefix for what the seat covers and why it is a field rather than a constant.
record: IdentThe record’s own name — the declaration this model came from.
kind: NodeKindWHICH node this is — the derive it was written under.
A MODEL fact rather than a parser one because the emission spends it: the one-storage marker is minted for the kinds that store and for no other, and nothing else in the emitted output could tell them apart.
vis: VisibilityHow visible the record is — and therefore how visible each emitted type and each of its fields is.
Mirrored rather than fixed at pub: a private record whose key were public would have
leaked into its crate’s public API without anyone writing it, and no one can widen a type
they did not declare.
teardown: boolWhether the declaration OPTED IN to the shutdown’s goodbye — teardown on its own attribute.
A fact about the VALUE a launch constructs rather than about anything emitted beside it: what
this node’s AsyncTeardown impl says is the author’s, and what the expansion does with the word is
demand that there be one. The launch entry’s own emission reads it again, to enrol the built
value in the chain.
asynchronous: Option<Path>The MODE WORD, where the declaration wrote one — async on its own attribute, and the path
kept for its SPAN.
A bare declaration is on the blocking face, so the absence is the ordinary state and None is
what says it. The word carries no value, which is why the presence alone is the whole fact —
but unlike teardown, which collapses to a bool the moment it is parsed,
this keeps the syn::Path all the way here ON PURPOSE: the audit it emits has to blame the
word, and a bool has no span for a caret to land on.
streaming: Option<Path>The FACE WORD, where the declaration wrote one — stream on its own attribute, and the path
kept for its SPAN.
A DIFFERENT AXIS from asynchronous, and the two multiply rather than
compete: this one picks the PAIR — Operator/AsyncOperator against
StreamOperator/AsyncStreamOperator — and that one picks which HALF of whichever pair
was chosen. So stream alone names the blocking streaming face and stream, async names the
awaited one, with no mode word of its own: the mode vocabulary already existed, and a second
spelling of it would be a second authority for one fact.
The syn::Path is kept all the way here for asynchronous’s reason: the
audit it emits has to blame the word, and a bool has no span for a caret to land on.
autonomous: Option<Path>The KIND WORD, where the declaration wrote one — autonomous on its own attribute, and the
path kept for its SPAN.
The PAIR axis’s THIRD value, on streaming’s own axis rather than beside
it: a declaration wears exactly one kind, so autonomous and stream are refused together
and the mode word multiplies with either — autonomous alone names the blocking autonomous
face and autonomous, async names the awaited one.
What the word buys is a body that OWNS ITS OWN LOOP: select order, arm priority, intake
gating, batching, ack timing and internal workers are the node’s rather than a driver’s. The
syn::Path is kept all the way here for asynchronous’s reason.
attributed: boolWhether the declaration opted its outputs into the ROOT PROJECTION — attributed on its own
attribute.
A bool rather than a kept syn::Path, on teardown’s precedent and for
its reason: nothing this word emits blames the word back. What it writes is one member of the
facts trait, and a projection that cannot take a root out of this node’s output is refused at
the MOUNT with the payload named — a caret on the word here would point at a declaration that
is not the one to fix.
A SEPARATE axis from every word above it. The pair, the mode and the kind say what a body IS; this says what the framework does with what the body EMITS, so it composes with all of them and refuses none.
krate: PathThe path to the ingraph crate itself — ::ingraph unless #[ingraph(crate = "…")] named
another.
Every framework name an expansion writes is rooted here, and every one of them continues
::__private::<module>::<item> with no exception: the projection traits an accessor qualifies
through (#krate::__private::project::Repeated), the interpretation → filter map a wire
filter names (#krate::__private::graphql::ToGraphqlFilter), and the serde derives a MongoDB
document
carries (#krate::__private::serde::Serialize) together with the #[serde(crate = "…")]
string that points serde’s own expansion at the same place. RecordModel::framework and
RecordModel::vendored are the only two places that spend it.
crate = "…" exists because an expansion lands in the DECLARER’s namespace, where ::ingraph
may not be the framework: the dependency may be renamed, or reached through a re-export shim
that vendors it under another path. Retargeting the root moves every emitted path at once, so
a declaration states it once and no emitted path has to be spelled by hand.
remote: Option<Path>remote = "path::To::Type" — the FOREIGN TYPE this declaration is a transparent wrapper over,
or None for the ordinary declaration that IS its fields.
Its presence is the REWRITE MODE, and it changes what the declaration’s own fields MEAN rather
than adding anything beside them: they stop being storage and become a MANIFEST — the shape of
the wrapped type as this framework needs to read it — while the item the compiler sees is
#[repr(transparent)] struct X(Remote);. Every face downstream is unchanged, because a
manifest column carries exactly what a declared column carried; what moves is where a value is
READ FROM (the remote’s own accessor, crossed by Into) and how one is BUILT (the remote’s own
constructor), which is crate::remote’s whole content.
A syn::Path rather than a syn::Type: a wrapper’s inner type is a named type and nothing
else — a reference, a slice or a generic instantiation has no accessor family to read a
manifest through — and the path is EMITTED, so one naming nothing is E0412 at the string the
author wrote.
construction: Constructionbuilder(…) — HOW the wrapped type is built, where the declaration described it.
The default value is the default LAW rather than an absence: Remote::new(<required columns>)
followed by one .with_<name>(…) per optional one, which is what the rewrite mode emitted
before the vocabulary existed and what it still emits for a declaration that writes no word.
So this is never an Option — see Construction for the words that move it, and for why
the DESCRIBING side takes a smaller vocabulary than a generating one.
Meaningful only under remote: an ordinary declaration IS its fields and is
built by a struct literal, so there is no protocol there for a word to describe. ingraph- derive refuses one written on such a declaration by name rather than leaving it inert.
key: KeyThe key type: its name and its columns.
lineage: Option<Lineage>The lineage type, or None for a root record.
The type and its name are born together and die together, which is why they are one option
rather than a name beside a possibly-empty list: a root emits no *Lineage type, so a root
has no lineage name to hold.
fields: Vec<Field>EVERY field the record declares, in declared order — the record gets an inherent impl of its own, so unmarked data fields reach it too.
persist: Option<Persist>Where the record is PERSISTED, or None for a pure-compute record.
Absence by omission, with no sentinel: a declaration that writes no persist(…) block is not
stored in any persist database, which is the same shape RecordModel::lineage uses for a root.
order_by: RustSafeNameThe ONE order-by type — default_order_by_name unless graphql(order_by(rename = "…"))
named it.
HERE rather than on Graphql, and the move is the point: an ordering term’s content is
mechanical from the STORED columns and its lowering is pure SQL, so no part of it is a wire
fact. It sat inside the wire face because that is where the type happened to be declared, and
the cost was a persist-only record with no term type to name and therefore no page at all.
A name unconditionally, whether or not the record is stored — a model carries what its type
would be called, and RecordModel::ordering is the one place that decides whether the type
is written. The RENAME is still spelled inside the graphql(…) block, which is a fact about
the grammar rather than about this slot: the word has always lived there and moving it would
break every declaration that writes one.
progress: Option<Progress>The record’s PROGRESS ledger, or None when it is stored nowhere a ledger ships.
DERIVED rather than declared, by whichever front end built this model: the ledger is a table in the persist engine’s own pool, so being stored is the whole of what makes one exist.
graphql: Option<Graphql>The record’s WIRE face, or None when it is not exposed.
Absence by omission again. A Graphql can only exist beside a RecordModel::persist: a wire
field with no stored source cannot be populated by a read, so the parser refuses the one
without the other.
derived: Vec<Derived>The REVERSE positions this record declares — derived(tracks = "media::VideoTrack", …) — in
the order they were written.
Empty rather than None, unlike every neighbour above: a reverse position declares no TYPE,
so there is nothing whose absence a None would be standing for. What a derived entry
produces is an AUDIT and a wire position later; the list of them is the whole fact.
artifacts: Vec<Artifact>The ARTIFACT families this record answers an address for — locate(cover = "media::Cover", …)
— in the order they were written.
RecordModel::derived’s sibling and its mirror image, which is why it stands beside it
rather than inside it: a reverse position names a record that points BACK at this one through
a ref column, and an artifact position names a blob node that was DERIVED FROM this one’s
messages. Neither declares a Rust field, both mint one word on this record’s wire face, and
the two share a namespace for exactly that reason — so the front end refuses a locate word
that repeats a derived word, and vice versa, before either reaches this model.
Empty rather than None, for RecordModel::derived’s reason: an artifact position declares
no TYPE of its own, so there is nothing whose absence a None would stand for. What the
OWNING expansion does with each entry is write the field into its own #[Object], which is
what keeps the blob node’s macro out of a coherence argument it cannot win.
implements: Vec<Path>implements(…) — the INTERFACES this record declares itself a member of, in the order they
were written.
Empty rather than None, for RecordModel::derived’s reason: a membership declares no TYPE,
so there is nothing whose absence a None would stand for. What each entry produces is one
impl of Implements<Interface>, which is the EVIDENCE an interface’s own expansion asserts —
the two derives cannot see each other, so an interface claiming a membership its member never
agreed to would be a promise made on somebody else’s behalf.
A PATH rather than a resolved type, for the reason Derived::source is one: every
consequence of it is type-level, so an alias in the path is transparent and nothing here has to
know what it resolves to.
errors: Vec<BackendError>error(<db> = "path::To") — the type every fallible conversion over this record answers with,
per backend. Empty is the boxed refusal at every one of them.
subscribe: Option<Path>subscribe = "path::To::Upstream" — the node whose messages drive this one, or None for a
source that is driven by nothing inside the graph.
A PATH rather than a resolved type, for RecordModel::implements’s reason and one more of
its own: nothing here can resolve it, since the upstream is another declaration’s and the two
derives cannot see each other. What the emission does with it is emit it, and the COMPILER
resolves it there — an unresolved path is E0412 and a path naming something that is not a
node is E0277, both at the declaration that wrote the string.
One upstream and not a list. Several are the FUSION and FAN-IN shapes, which name their
upstreams with upstream(…) entries because each carries a designation this spelling has no room
for; [RecordModel::fusion] is where those land, and a declaration writing both is refused.
upstreams: Option<Upstreams>The upstream(…) entries — the upstreams this node draws from — or None for a node driven by
one upstream or by none.
Beside RecordModel::subscribe rather than replacing it, because the two are different
declarations rather than one written twice: subscribe names an edge and says nothing about
where this node’s identity comes from, where a upstream(…) block says which upstreams there
are AND how this node’s lineage relates to them.
subscriptions: Option<Subscription>The subscribe(…) CONTAINER — every upstream this node’s fan-in draws from, in the order they
were written, or None where the declaration wrote none.
A different axis from RecordModel::upstreams, which is why it is a field of its own rather
than a third arm of Upstreams: the top-level upstream(…) entries say where this node’s
IDENTITY comes from, and the container says how its INTAKE is shaped — which upstreams arrive
independently, which are joined by key before the body sees them, and which product of a
multi-product upstream an edge carries.
products: Option<Products>emits = "…" / emits = ["…", "…"] — the products this node puts on its edges, in the
order they were written, or None where the declaration named none and the product is the
declared struct itself.
options: Option<Path>options = "path::To::Options" — the type a deployment’s section for this node deserializes
into, or None where the declaration wrote none.
A PATH rather than a resolved type, for RecordModel::subscribe’s reason: nothing here can
resolve it, and the compiler resolves it where the expansion lands.
None means () and not unknown. A node with no knobs writes no word, and the emitted
Declared::Options for it is the unit type — which is what its AsyncConstructor already spells,
and what the emitted equation pins the two to.
polls: Option<Polls>poll(<name>, …) — the node’s OWN clocks, in the order they were written, or None where it
declared none, which is most nodes.
Beside RecordModel::subscriptions rather than inside it, and the ruling is explicit about
why: a poll source is not an upstream. A tick is a WAKE — it moves no message, it touches no
In enum, and what the node does with it is read through the handles it already holds. So it
is the node’s own word at container level, and what it buys is a vocabulary of its own.
tracing: Option<TracingLevel>tracing(level = …) — the level this node’s framework spans and its emitted query entries
open at, or None where the declaration wrote no word.
Absence by omission, with no sentinel, which is the shape every optional block here uses: a
declaration that says nothing is a node at the framework’s own default, and the EMISSION says
nothing either — the const is written only where the word was, so Declared::TRACING’s own
default is what a silent node reads. One default, in one place.
The word parses in every build and this field is filled in every build. What rides ingraph’s
feature is what the emitter DOES with it, which is why nothing about this type is conditional.
receipt: Option<Path>receipt = "path::To::Type" — the value this node hands BACK to the producer of an acked
give, or None where the declaration wrote none, which is most nodes.
A PATH rather than a resolved type, for RecordModel::options’s reason exactly: nothing here
can resolve it, and the compiler resolves it where the expansion lands — at the string the
author wrote, because syn::LitStr::parse respans onto the literal.
None means the node states no receipt, and it is NOT (). This is where the word parts
from options, and the difference is the whole of the opt-in seat: Declared::Options is a
member every node fills, so a silent one fills it with the unit type; Receipts is a SIBLING
trait, so a silent node gets no impl at all and every non-receipting operator pays nothing —
no line, no seat, no bound. See ingraph’s own Receipts for why the seat is a sibling rather
than a defaulted member of Operator (associated-type defaults are unstable, E0658).
Implementations§
Source§impl RecordModel
impl RecordModel
Sourcepub fn degenerate_plural(&self) -> Option<String>
pub fn degenerate_plural(&self) -> Option<String>
The name the PAGE would be published under when it is the SINGLE’s own name and no declaration
chose it — the silence a front end refuses, and None when there is nothing to refuse.
§What the answer is, and why it is a name rather than a bool
Some(field) is both root fields would be called field, so the refusal can quote the word
a client would have read. The front end writes the sentence, this answers the fact — the
division RecordModel::emitted_types already
draws, and for its reason: a list of what an emission does kept on the other side of the crate
boundary is a copy, and copies drift.
§THREE conditions, and each one is load-bearing
- the list leg is EMITTED —
Self::wire_filters, whose own note carries that this predicate IS the leg’s, read once rather than restated. A record with no page has no plural to spend, and demanding a word for a field nobody emits would tax a declaration for a schema it does not publish. What that leaves open is the DECLARATION carrying a degenerate word into a later reader — a connection, an aggregate — and that reader will ask this same question when it lands, because the condition is what moves rather than the rule. - nothing was DECLARED — a written
plural = "media"is a choice, and the rule guards silence. The user’s ruling states it in those words: the refusal is about a word nobody chose, not about a word somebody did. - the two fields would COLLIDE — asked on the emitted field NAMES rather than on the words behind them, because the collision is a fact about the schema. The initial is lowered on both sides by the same act, so this compares what a client would actually read.
Source§impl RecordModel
impl RecordModel
Sourcepub fn emit(&self) -> TokenStream
pub fn emit(&self) -> TokenStream
A record’s key type, plus its lineage type when it has a lineage.
The key is FLAT — lineage ⊕ id, root-first, one struct with no nesting — because every use of
it is columnar: a row’s key columns, a prefix range scan, a leading-column attribution.
A root record gets NO lineage type. An empty path has no type worth naming, and its absence is what tells a reader the record is a root.
Both names come from the MODEL. Whether they are the convention’s or an author’s rename was settled before this point, so there is exactly one place a name can be decided.
Source§impl RecordModel
impl RecordModel
Sourcepub fn emitted_methods(&self) -> Vec<Emitted>
pub fn emitted_methods(&self) -> Vec<Emitted>
Every method this model’s emission declares, in EMISSION ORDER.
The order is the emitter’s own walk — the key, the lineage, the record, then each database’s row and comparison, then the wire faces — so a front end reporting a collision can name the earlier of the two as the one already there.
Types are told apart by Owner rather than by name, for the reason that enum records.
Source§impl RecordModel
impl RecordModel
Sourcepub fn fanned_lineage(&self) -> Option<Field>
pub fn fanned_lineage(&self) -> Option<Field>
The field a FAN-IN node’s ancestry rides in, for the echo to append — or None for a node
whose ancestry is a path its declaration wrote.
The mint lives HERE, beside the model that reads it back, for IndexModel::carried_key’s
reason: the name, the type and the visibility are one decision, and the party that appends the
field is not the party that spends it.
Sourcepub fn error(&self, crossing: Crossing, kind: DatabaseKind) -> TokenStream
pub fn error(&self, crossing: Crossing, kind: DatabaseKind) -> TokenStream
The error the fallible impls of ONE CELL answer with: the declared type, or the boxed refusal.
A cell is a (crossing, database) pair, which is what makes the identity uniform WITHIN an impl
and independent BETWEEN them: every fallible leg the row’s own TryFrom spends names one type,
every leg the crossing onto the wire spends names one, and a declaration may make those two
different without saying anything twice.
The boxed default is what a row’s conversions already answered with, and it is the honest one:
a row’s columns may each fail differently and no type names all of them. core’s blanket
From over it is also what makes an undeclared ? compile without anybody writing a bound.
Sourcepub fn operand(&self, source: &Ident, kind: DatabaseKind) -> Option<&Conversion>
pub fn operand(&self, source: &Ident, kind: DatabaseKind) -> Option<&Conversion>
The OPERAND converter one FIELD’s declaration named for kind — the declared half of the
filter crossing — or None where the column takes the stored type’s own TryFrom.
Keyed on the record FIELD rather than on a column, because that is where the word is written
and because a column is one DATABASE’s view of the same field: graphql(input(comparison(…)))
is a wire-side declaration and there is one wire face per record, so the legs live on
GraphqlField::input_crossing and each names the database whose row it crosses into.
A column that is stored and NOT exposed has no wire field to carry a word, so it takes the default chain — which is the same answer as an exposed field that declared nothing.
Sourcepub fn condition(&self, source: &Ident) -> Option<&Condition>
pub fn condition(&self, source: &Ident) -> Option<&Condition>
The CONDITION a record field is declared under — Condition::always for one that wrote no
#[cfg], and for a name no field of this declaration carries.
Looked up on the FIELD by name rather than carried on PersistColumn, because a condition is
the declaration’s own fact and a column is one database’s view of it: four copies of one
predicate is four copies that can drift, and the field is the single place it was written.
Every emitter that holds a column also holds the model — the per-database walks all take one —
so the lookup is reachable everywhere the gate is needed.
Sourcepub fn gate(&self, source: &Ident) -> TokenStream
pub fn gate(&self, source: &Ident) -> TokenStream
The #[cfg(…)] to prefix onto ONE artifact of a record field — empty where it wrote none, and
empty for a name this declaration does not carry.
The spelling every emitter uses, so a site gates by interpolating one token stream rather than by asking a question and branching. An unconditional declaration interpolates nothing, which is what keeps its expansion identical to the one before this seat existed.
Sourcepub fn present(&self, source: &Ident) -> TokenStream
pub fn present(&self, source: &Ident) -> TokenStream
1 or 0 for a record field, as a const expression — the term an ORDINAL’s running sum adds.
Sourcepub fn conditional(&self) -> bool
pub fn conditional(&self) -> bool
Whether ANY field of this declaration is conditional.
The switch between the two shapes an ORDINAL is written in: a declaration with no condition
gets the literal positions it has always got — byte for byte the expansion of before this seat
— and one with a condition gets the const running sum. Two shapes rather than always the
second, because the sum is only correct-and-necessary where something can be absent, and an
expansion that grew a chain of consts for every record in the world would be paying for a
case it does not have.
Source§impl RecordModel
impl RecordModel
Sourcepub fn emitted_types(&self) -> Vec<Declared>
pub fn emitted_types(&self) -> Vec<Declared>
Every TYPE this model’s emission declares, in EMISSION ORDER.
The front end refuses a declaration whose emitted types collide, and it asks HERE which those are rather than keeping a list of its own — one declaration emits every one of these into a single scope, and a list of them written twice is how one copy drifts. That is the argument this module’s defaulted names already carry, one step further: the model says not only what each type is CALLED but which ones there are.
The order is the emitter’s own walk — the key, the lineage, then each database’s row and comparison, then the four wire faces — so a front end reporting a collision can name the earlier of the two as the one already there.
§The RECORD is not here, because no emission declares it
The record’s own type is the DECLARER’s, already in the scope the emission lands in. It still
takes part in the collision rule — a rename onto it clashes like any other — but that is a
fact about the scope rather than about the emission, so the front end adds it and this does
not. Including it here would put a name in the enumeration that
tests::the_enumeration_names_exactly_the_types_the_emission_declares could never find.
§A wire face with no backend declares nothing
Graphql::faces writes no type at all when no backend renders the record, and
this answers alike. The derive cannot reach that state — it refuses a graphql(…) naming no
backend — but a model is PLAIN and a manifest front end can build one, and an enumeration
that named four types the emitter never wrote would refuse a declaration for a clash that
could not happen.
Source§impl RecordModel
impl RecordModel
Sourcepub fn table_name(&self, database: &DatabaseBackend) -> String
pub fn table_name(&self, database: &DatabaseBackend) -> String
The table one database stores the record in, RESOLVED — the declared name, or the record’s own in snake case.
The default is a convention rather than a declaration, and this is the ONE place it is
decided: DDL emission reads the same function, so a table a query selects from and a table a
migration creates cannot come from two conventions. Media is media, VideoTrack is
video_track — heck’s own word splitting, which is what RustSafeName already spends for
the other direction.