Skip to main content

RegistrationContext

Struct RegistrationContext 

Source
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: String

Application ID

§root_directory: String

Root directory

Implementations§

Source§

impl RegistrationContext

Source

pub fn new(app_id: String, root_directory: String) -> Self

Create a new empty registration context.

Source

pub fn add_schema(&mut self, graphql: &str)

Add a GraphQL schema string.

Source

pub fn add_resource(&mut self, entry: ResourceEntry)

Add a resource handler.

Source

pub fn add_web_files(&mut self, files: Vec<EmbeddedFile>)

Add embedded web files.

Source

pub fn add_auth_provider(&mut self, p: Arc<dyn AuthProvider>)

Add an authentication provider.

Source

pub fn add_vector_hook(&mut self, h: Arc<dyn VectorHook>)

Add a vector embedding hook.

Source

pub fn add_ai_hook(&mut self, h: Arc<dyn AiHook>)

Add an AI inference hook.

Source

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.

Source

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.

Source

pub fn root_dir(&self) -> &str

Get the root directory path.

Source

pub fn app_id(&self) -> &str

Get the application ID.

Trait Implementations§

Source§

impl Debug for RegistrationContext

Source§

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

Formats the value using the given formatter. 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> 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, 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