pub trait TypesRegistryClient: Send + Sync {
Show 13 methods
// Required methods
fn register<'life0, 'async_trait>(
&'life0 self,
entities: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisterResult>, TypesRegistryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn register_type_schemas<'life0, 'async_trait>(
&'life0 self,
type_schemas: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisterResult>, TypesRegistryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_type_schema<'life0, 'life1, 'async_trait>(
&'life0 self,
type_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<GtsTypeSchema, TypesRegistryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_type_schema_by_uuid<'life0, 'async_trait>(
&'life0 self,
type_uuid: Uuid,
) -> Pin<Box<dyn Future<Output = Result<GtsTypeSchema, TypesRegistryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_type_schemas<'life0, 'async_trait>(
&'life0 self,
type_ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<GtsTypeSchema, TypesRegistryError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_type_schemas_by_uuid<'life0, 'async_trait>(
&'life0 self,
type_uuids: Vec<Uuid>,
) -> Pin<Box<dyn Future<Output = HashMap<Uuid, Result<GtsTypeSchema, TypesRegistryError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_type_schemas<'life0, 'async_trait>(
&'life0 self,
query: TypeSchemaQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<GtsTypeSchema>, TypesRegistryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn register_instances<'life0, 'async_trait>(
&'life0 self,
instances: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisterResult>, TypesRegistryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_instance<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<GtsInstance, TypesRegistryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_instance_by_uuid<'life0, 'async_trait>(
&'life0 self,
uuid: Uuid,
) -> Pin<Box<dyn Future<Output = Result<GtsInstance, TypesRegistryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_instances<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<GtsInstance, TypesRegistryError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_instances_by_uuid<'life0, 'async_trait>(
&'life0 self,
uuids: Vec<Uuid>,
) -> Pin<Box<dyn Future<Output = HashMap<Uuid, Result<GtsInstance, TypesRegistryError>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_instances<'life0, 'async_trait>(
&'life0 self,
query: InstanceQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<GtsInstance>, TypesRegistryError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Public API trait for the types-registry module.
This trait can be consumed by other modules via ClientHub:
let client = hub.get::<dyn TypesRegistryClient>()?;
let schema = client.get_type_schema("gts.acme.core.events.user.v1~").await?;GTS type-schemas and instances are global resources (not tenant-scoped), so no security context is required for these operations.
Required Methods§
Sourcefn register<'life0, 'async_trait>(
&'life0 self,
entities: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisterResult>, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register<'life0, 'async_trait>(
&'life0 self,
entities: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisterResult>, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Register GTS entities (type-schemas or instances) in batch.
Each JSON value must contain a valid GTS identifier in one of the
configured ID fields ($id, gtsId, id). The batch is sorted
lexicographically by GTS id before processing so parents are
registered before their children within the same batch.
Per-item failures are reported via RegisterResult::Err; success
carries only the canonical gts_id. To inspect
the typed view of a registered entity, follow up with
Self::get_type_schema / Self::get_instance.
§Errors
Returns Err only for catastrophic failures (e.g., backend unavailable).
Sourcefn register_type_schemas<'life0, 'async_trait>(
&'life0 self,
type_schemas: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisterResult>, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register_type_schemas<'life0, 'async_trait>(
&'life0 self,
type_schemas: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisterResult>, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Register GTS type-schemas in batch.
Each input value must have a GTS id ending with ~. Inputs whose
identifier does not match the type-schema kind are returned as
per-item RegisterResult::Err with InvalidGtsTypeId. In ready
phase, items whose chain parent is not yet registered fail with
ParentTypeSchemaNotRegistered (callers may register the parent
then retry the failed item).
§Errors
Returns Err only for catastrophic failures.
Sourcefn get_type_schema<'life0, 'life1, 'async_trait>(
&'life0 self,
type_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<GtsTypeSchema, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_type_schema<'life0, 'life1, 'async_trait>(
&'life0 self,
type_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<GtsTypeSchema, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve a registered GTS type-schema by its type id.
§Errors
GtsTypeSchemaNotFound— no type-schema with this id is registered.InvalidGtsTypeId— id format is invalid, kind-mismatched, or resolves to a non-type-schema entity.
Sourcefn get_type_schema_by_uuid<'life0, 'async_trait>(
&'life0 self,
type_uuid: Uuid,
) -> Pin<Box<dyn Future<Output = Result<GtsTypeSchema, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_type_schema_by_uuid<'life0, 'async_trait>(
&'life0 self,
type_uuid: Uuid,
) -> Pin<Box<dyn Future<Output = Result<GtsTypeSchema, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve a registered GTS type-schema by its deterministic UUID v5.
§Errors
GtsTypeSchemaNotFound— no type-schema is registered with this UUID (also returned when the UUID exists but points to an instance).
Sourcefn get_type_schemas<'life0, 'async_trait>(
&'life0 self,
type_ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<GtsTypeSchema, TypesRegistryError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_type_schemas<'life0, 'async_trait>(
&'life0 self,
type_ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<GtsTypeSchema, TypesRegistryError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve multiple type-schemas by id in one call.
Returns a map keyed by the input ids; each value is a per-item
Result carrying either the resolved schema or the per-item error
(GtsTypeSchemaNotFound,
InvalidGtsTypeId, …).
Duplicate ids in the input collapse to a single entry. The map
always has a value for every distinct input id.
Sourcefn get_type_schemas_by_uuid<'life0, 'async_trait>(
&'life0 self,
type_uuids: Vec<Uuid>,
) -> Pin<Box<dyn Future<Output = HashMap<Uuid, Result<GtsTypeSchema, TypesRegistryError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_type_schemas_by_uuid<'life0, 'async_trait>(
&'life0 self,
type_uuids: Vec<Uuid>,
) -> Pin<Box<dyn Future<Output = HashMap<Uuid, Result<GtsTypeSchema, TypesRegistryError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve multiple type-schemas by deterministic UUID v5 in one call.
Same per-key semantics as Self::get_type_schemas: a map keyed
by the input UUIDs, per-item failures carried in the inner
Result. Duplicates collapse.
Sourcefn list_type_schemas<'life0, 'async_trait>(
&'life0 self,
query: TypeSchemaQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<GtsTypeSchema>, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_type_schemas<'life0, 'async_trait>(
&'life0 self,
query: TypeSchemaQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<GtsTypeSchema>, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List registered GTS type-schemas matching the query.
Sourcefn register_instances<'life0, 'async_trait>(
&'life0 self,
instances: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisterResult>, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register_instances<'life0, 'async_trait>(
&'life0 self,
instances: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<Vec<RegisterResult>, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Register GTS instances in batch.
Each input value must have a GTS id that does NOT end with ~. Inputs
whose identifier does not match the instance kind are returned as
per-item RegisterResult::Err with InvalidGtsInstanceId. In ready
phase, items whose declaring type-schema is not yet registered fail
with ParentTypeSchemaNotRegistered.
§Errors
Returns Err only for catastrophic failures.
Sourcefn get_instance<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<GtsInstance, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_instance<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<GtsInstance, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve a registered GTS instance by its instance id.
§Errors
GtsInstanceNotFound— no instance with this id is registered.InvalidGtsInstanceId— id format is invalid, kind-mismatched, or resolves to a non-instance entity.
Sourcefn get_instance_by_uuid<'life0, 'async_trait>(
&'life0 self,
uuid: Uuid,
) -> Pin<Box<dyn Future<Output = Result<GtsInstance, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_instance_by_uuid<'life0, 'async_trait>(
&'life0 self,
uuid: Uuid,
) -> Pin<Box<dyn Future<Output = Result<GtsInstance, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve a registered GTS instance by its deterministic UUID v5.
§Errors
GtsInstanceNotFound— no instance is registered with this UUID (also returned when the UUID exists but points to a type-schema).
Sourcefn get_instances<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<GtsInstance, TypesRegistryError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_instances<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = HashMap<String, Result<GtsInstance, TypesRegistryError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve multiple instances by id in one call.
Returns a map keyed by the input ids; each value is a per-item
Result carrying either the resolved instance or the per-item
error (GtsInstanceNotFound,
InvalidGtsInstanceId,
…). Duplicate ids in the input collapse to a single entry.
Sourcefn get_instances_by_uuid<'life0, 'async_trait>(
&'life0 self,
uuids: Vec<Uuid>,
) -> Pin<Box<dyn Future<Output = HashMap<Uuid, Result<GtsInstance, TypesRegistryError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_instances_by_uuid<'life0, 'async_trait>(
&'life0 self,
uuids: Vec<Uuid>,
) -> Pin<Box<dyn Future<Output = HashMap<Uuid, Result<GtsInstance, TypesRegistryError>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieve multiple instances by deterministic UUID v5 in one call.
Same per-key semantics as Self::get_instances: a map keyed by
the input UUIDs, per-item failures carried in the inner Result.
Duplicates collapse.
Sourcefn list_instances<'life0, 'async_trait>(
&'life0 self,
query: InstanceQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<GtsInstance>, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_instances<'life0, 'async_trait>(
&'life0 self,
query: InstanceQuery,
) -> Pin<Box<dyn Future<Output = Result<Vec<GtsInstance>, TypesRegistryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List registered GTS instances matching the query.