Skip to main content

TableDefinition

Struct TableDefinition 

Source
pub struct TableDefinition {
Show 25 fields pub name: String, pub database: String, pub table_name: TableName, pub storage: BackendType, pub fields: Vec<FieldDefinition>, pub primary_key: String, pub indexed: Vec<String>, pub exported: bool, pub custom_path: Option<String>, pub rest_enabled: bool, pub graphql_enabled: bool, pub ws_enabled: bool, pub sse_enabled: bool, pub mqtt_enabled: bool, pub mcp_enabled: bool, pub grpc_enabled: bool, pub public_operations: HashSet<PublicAccess>, pub access: Option<AccessConfig>, pub expiration: Option<u64>, pub composite_indexes: Vec<CompositeIndexDef>, pub distribute: Option<DistributeConfig>, pub store: Option<StoreConfig>, pub source: Option<SourceConfig>, pub audit: Option<AuditConfig>, pub crdt_fields: HashMap<String, String>,
}
Expand description

Represents a table definition parsed from a GraphQL schema.

Fields§

§name: String

GraphQL type name

§database: String

Database namespace (default: “data”)

§table_name: TableName

Physical table name (default: same as name)

§storage: BackendType

Storage backend type (default: RocksDb)

§fields: Vec<FieldDefinition>

List of field definitions

§primary_key: String

Name of the primary key field

§indexed: Vec<String>

List of indexed attribute names

§exported: bool

Whether this table is exported as a REST endpoint

§custom_path: Option<String>

URL path segment from @export(path: "/v1/posts"). Stored without leading/trailing slashes (the loader normalizes during parse). Replaces the type-name default segment in route registration. None falls back to the lowercased type name. Replaces the older @export(name:) arg.

§rest_enabled: bool

Whether REST interface is enabled

§graphql_enabled: bool

Whether GraphQL interface is enabled

§ws_enabled: bool

Whether WebSocket interface is enabled

§sse_enabled: bool

Whether SSE interface is enabled

§mqtt_enabled: bool

Whether MQTT interface is enabled

§mcp_enabled: bool

Whether MCP interface is enabled

§grpc_enabled: bool

Whether gRPC interface is enabled

§public_operations: HashSet<PublicAccess>

Operations declared publicly accessible. Now sourced from @access(public: [...]); populated identically from AccessConfig.public so existing runtime consumers (yeti-table constructors, discovery JSON) don’t have to dereference an Option on the hot path. Future hardening can fold this back through access.

§access: Option<AccessConfig>

Authorization config from @access directive. None = no @access block in the schema; the app’s auth pipeline owns access decisions. When set, access.public matches public_operations and access.roles carries the per-op RBAC matrix.

§expiration: Option<u64>

Cache expiration in seconds from @table(expiration: N)

§composite_indexes: Vec<CompositeIndexDef>

Composite index definitions

§distribute: Option<DistributeConfig>

Distribution topology from @distribute directive

§store: Option<StoreConfig>

Storage-engine config from @store directive. None = platform defaults: BackendType::Disk + WAL on. When set, store.durability overrides the system-database WAL_REQUIRED_DATABASES policy.

§source: Option<SourceConfig>

Origin source config from @source directive. None = data lives only in this table. When set, one of three arms drives populator behavior: URL pull, function call, or cross-table sync. Runtime arms land in follow-on commits; the directive surface ships first.

§audit: Option<AuditConfig>

Audit configuration from @audit directive

§crdt_fields: HashMap<String, String>

Per-field CRDT type declarations (field_name -> crdt_type)

Implementations§

Source§

impl TableDefinition

Source

pub fn endpoint_name(&self) -> String

Returns the endpoint name: custom path if set, otherwise lowercase type name.

Source

pub fn consistency(&self) -> Option<ConsistencyMode>

Convenience: get consistency mode from @distribute or None.

Source

pub fn residency(&self) -> Option<&str>

Convenience: get residency from @distribute or None.

Source

pub fn replication_factor(&self) -> Option<u8>

Convenience: get replication factor from @distribute or None.

Source

pub fn sharding(&self) -> Option<&str>

Convenience: get sharding strategy from @distribute or None.

Source

pub const fn is_audited(&self) -> bool

Whether this table has audit enabled.

Source

pub const fn transport_enabled(&self, transport: Transport) -> bool

Whether transport is enabled for this table. The single bridge between the canonical Transport set and the readable per- transport bool projection — consumers (inventory, dispatch) query the canonical type, not seven scattered fields.

Source

pub fn transport_set(&self) -> TransportSet

The effective TransportSet this table exposes. Empty when the table is not exported.

Source

pub fn schema_fingerprint(&self) -> String

Compute a fingerprint of the schema-relevant parts of this table definition. Used to detect schema changes between restarts. Only includes fields that affect data layout, indexing, or defaults — not transport flags.

Source

pub fn diff_against( &self, old_fields: &[String], old_indexed: &[String], ) -> SchemaDiff

Compute the diff between this schema and a stored fingerprint’s field list. Returns the fields to strip (removed), fields to inject defaults (new with @default), and fields to build indexes for (gained @indexed).

Source

pub fn builder(name: &str) -> TableDefinitionBuilder

Create a new TableDefinition builder with the given name.

Source

pub fn to_json_schema(&self) -> Value

Convert to JSON schema for core node table creation.

Trait Implementations§

Source§

impl Clone for TableDefinition

Source§

fn clone(&self) -> TableDefinition

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 TableDefinition

Source§

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

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

impl Default for TableDefinition

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<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> 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<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