pub struct RegistrationContext {Show 13 fields
pub schemas: Vec<String>,
pub seed_data: Vec<String>,
pub resources: Vec<ResourceEntry>,
pub web_files: Vec<EmbeddedFile>,
pub auth_providers: Vec<Arc<dyn AuthProvider>>,
pub vector_hooks: Vec<Arc<dyn VectorHook>>,
pub ai_hooks: Vec<Arc<dyn AiHook>>,
pub computed_field_hooks: Vec<Arc<dyn ComputedFieldHook>>,
pub request_services: Vec<ContextService>,
pub table_subscribers: Vec<Box<dyn TableSubscriber>>,
pub background_tasks: Vec<Pin<Box<dyn Future<Output = ()> + Send>>>,
pub app_id: String,
pub root_directory: String,
}Expand description
Write context passed to Plugin::register().
Fields§
§schemas: Vec<String>GraphQL schema strings
seed_data: Vec<String>Seed data JSON strings
resources: Vec<ResourceEntry>Resource handlers
web_files: Vec<EmbeddedFile>Embedded web files for static serving
auth_providers: Vec<Arc<dyn AuthProvider>>Authentication providers
vector_hooks: Vec<Arc<dyn VectorHook>>Vector embedding hooks
ai_hooks: Vec<Arc<dyn AiHook>>AI inference hooks
computed_field_hooks: Vec<Arc<dyn ComputedFieldHook>>Computed field hooks
request_services: Vec<ContextService>Pipeline services — Tower-native replacement for the legacy
RequestMiddleware Vec. Each entry is a
BoxCloneService<Context, Context, YetiError> (see
plugins::request::ContextService); the router runs them in
registration order via RequestPipeline::run.
table_subscribers: Vec<Box<dyn TableSubscriber>>Table subscribers (pubsub safe across the WIT boundary via host-created mpsc bridge)
background_tasks: Vec<Pin<Box<dyn Future<Output = ()> + Send>>>Background tasks to spawn after registration
app_id: StringApplication ID
root_directory: StringRoot directory
Implementations§
Source§impl RegistrationContext
impl RegistrationContext
Sourcepub fn new(app_id: String, root_directory: String) -> Self
pub fn new(app_id: String, root_directory: String) -> Self
Create a new empty registration context.
Sourcepub fn add_schema(&mut self, graphql: &str)
pub fn add_schema(&mut self, graphql: &str)
Add a GraphQL schema string.
Sourcepub fn add_resource(&mut self, entry: ResourceEntry)
pub fn add_resource(&mut self, entry: ResourceEntry)
Add a resource handler.
Sourcepub fn add_web_files(&mut self, files: Vec<EmbeddedFile>)
pub fn add_web_files(&mut self, files: Vec<EmbeddedFile>)
Add embedded web files.
Sourcepub fn add_auth_provider(&mut self, p: Arc<dyn AuthProvider>)
pub fn add_auth_provider(&mut self, p: Arc<dyn AuthProvider>)
Add an authentication provider.
Sourcepub fn add_vector_hook(&mut self, h: Arc<dyn VectorHook>)
pub fn add_vector_hook(&mut self, h: Arc<dyn VectorHook>)
Add a vector embedding hook.
Sourcepub fn add_ai_hook(&mut self, h: Arc<dyn AiHook>)
pub fn add_ai_hook(&mut self, h: Arc<dyn AiHook>)
Add an AI inference hook.
Sourcepub fn add_request_service(&mut self, svc: ContextService)
pub fn add_request_service(&mut self, svc: ContextService)
Register a request-pipeline service. The service runs as part of
the per-request middleware chain built by yeti-router. Plugins
produce a ContextService via tower::service_fn (or by
implementing tower::Service<Context> directly) and call
BoxCloneService::new(svc) before passing it here.
Sourcepub fn add_table_subscriber(&mut self, s: Box<dyn TableSubscriber>)
pub fn add_table_subscriber(&mut self, s: Box<dyn TableSubscriber>)
Add a table subscriber. The runtime will subscribe to the named
table’s pubsub stream on the host tokio runtime and forward each
message to the subscriber’s run() loop via a host-allocated
mpsc channel. Safe to call from wasm applications.