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: StringGraphQL type name
database: StringDatabase namespace (default: “data”)
table_name: TableNamePhysical table name (default: same as name)
storage: BackendTypeStorage backend type (default: RocksDb)
fields: Vec<FieldDefinition>List of field definitions
primary_key: StringName of the primary key field
indexed: Vec<String>List of indexed attribute names
exported: boolWhether 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: boolWhether REST interface is enabled
graphql_enabled: boolWhether GraphQL interface is enabled
ws_enabled: boolWhether WebSocket interface is enabled
sse_enabled: boolWhether SSE interface is enabled
mqtt_enabled: boolWhether MQTT interface is enabled
mcp_enabled: boolWhether MCP interface is enabled
grpc_enabled: boolWhether 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
impl TableDefinition
Sourcepub fn endpoint_name(&self) -> String
pub fn endpoint_name(&self) -> String
Returns the endpoint name: custom path if set, otherwise lowercase type name.
Sourcepub fn consistency(&self) -> Option<ConsistencyMode>
pub fn consistency(&self) -> Option<ConsistencyMode>
Convenience: get consistency mode from @distribute or None.
Sourcepub fn replication_factor(&self) -> Option<u8>
pub fn replication_factor(&self) -> Option<u8>
Convenience: get replication factor from @distribute or None.
Sourcepub fn sharding(&self) -> Option<&str>
pub fn sharding(&self) -> Option<&str>
Convenience: get sharding strategy from @distribute or None.
Sourcepub const fn is_audited(&self) -> bool
pub const fn is_audited(&self) -> bool
Whether this table has audit enabled.
Sourcepub const fn transport_enabled(&self, transport: Transport) -> bool
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.
Sourcepub fn transport_set(&self) -> TransportSet
pub fn transport_set(&self) -> TransportSet
The effective TransportSet this table exposes. Empty when the
table is not exported.
Sourcepub fn schema_fingerprint(&self) -> String
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.
Sourcepub fn diff_against(
&self,
old_fields: &[String],
old_indexed: &[String],
) -> SchemaDiff
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).
Sourcepub fn builder(name: &str) -> TableDefinitionBuilder
pub fn builder(name: &str) -> TableDefinitionBuilder
Create a new TableDefinition builder with the given name.
Sourcepub fn to_json_schema(&self) -> Value
pub fn to_json_schema(&self) -> Value
Convert to JSON schema for core node table creation.
Trait Implementations§
Source§impl Clone for TableDefinition
impl Clone for TableDefinition
Source§fn clone(&self) -> TableDefinition
fn clone(&self) -> TableDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more