Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime { /* private fields */ }

Implementations§

Source§

impl Runtime

Source

pub fn new(config: ServerConfig, view_index: ViewIndex) -> Self

Source

pub fn with_spec(self, spec: Spec) -> Result<Self>

Source

pub fn with_materialized_views(self, registry: MaterializedViewRegistry) -> Self

Source

pub fn with_websocket_auth_plugin( self, websocket_auth_plugin: Arc<dyn WebSocketAuthPlugin>, ) -> Self

Source

pub fn with_http_auth_plugin( self, http_auth_plugin: Arc<dyn WebSocketAuthPlugin>, ) -> Self

Source

pub fn with_websocket_usage_emitter( self, websocket_usage_emitter: Arc<dyn WebSocketUsageEmitter>, ) -> Self

Source

pub fn with_owner_token_accounts_provider( self, provider: Arc<dyn OwnerTokenAccountsProvider>, ) -> Self

Source

pub fn with_solana_gateway_usage_observer( self, observer: Arc<dyn SolanaGatewayUsageObserver>, ) -> Self

Source

pub fn with_websocket_max_clients(self, websocket_max_clients: usize) -> Self

Source

pub fn with_websocket_rate_limit_config(self, config: RateLimitConfig) -> Self

Configure rate limiting for WebSocket connections.

This sets global rate limits such as maximum connections per IP, timeouts, and rate windows. Per-subject limits are controlled via AuthContext.Limits from the authentication token.

Source

pub fn with_websocket_admission_provider( self, provider: Arc<dyn WebSocketAdmissionProvider>, ) -> Self

Source

pub fn plan(&self) -> RuntimePlan

Return the immutable capability plan selected by the builder.

Source

pub async fn run(self) -> Result<()>

Start everything and block until a shutdown signal, then stop cleanly.

This is spawn followed by waiting for SIGINT/SIGTERM (or for a core task to exit) and RuntimeHandle::shutdown. Callers that embed the server in a larger process should use spawn directly and decide for themselves when to stop.

Source

pub async fn spawn(self) -> Result<RuntimeHandle>

Start the runtime’s tasks and return a handle that owns them.

Everything run starts is started here: projector, parser, snapshot manager, bus cleanup, stats, and - only when configured - the WebSocket listener and the HTTP health server. Nothing here installs signal handlers or blocks; the handle is how the caller waits, serves connections it accepted itself, and shuts the runtime down.

A handle owns its runtime’s channel, buses, cache and snapshot state outright; nothing is shared through process globals, so a test or an application can start and stop runtimes independently.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Runtime

§

impl !UnwindSafe for Runtime

§

impl Forget for Runtime

§

impl Freeze for Runtime
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<IpNet>: Freeze, *const LeafNode<String, SetValZST> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(String, SetValZST)>>: Freeze, *const ArcInner<ViewIndex> is !null: Freeze, PhantomData<ArcInner<ViewIndex>>: Freeze, PhantomData<(String, EntityBytecode)>: Freeze, PhantomData<(String, Vec<String>)>: Freeze, PhantomData<(String, ())>: Freeze, PhantomData<(String, fn(&[u8]) -> Result<(Value, String), Box<dyn Error>>)>: Freeze, PhantomData<String>: Freeze, *const ArcInner<dyn Fn(Sender<MutationBatch>, Option<HealthMonitor>, ReconnectionConfig) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> + Sync + Send> is !null: Freeze, PhantomData<ArcInner<dyn Fn(Sender<MutationBatch>, Option<HealthMonitor>, ReconnectionConfig) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> + Sync + Send>>: Freeze, PhantomData<ProgramRuntimeDefinition>: Freeze, PhantomData<SerializableStreamSpec>: Freeze, PhantomData<ViewDef>: Freeze, PhantomData<(HashId<ProgramRelease>, ProgramRuntimeDefinition)>: Freeze, PhantomData<(String, Arc<MaterializedView>)>: Freeze, *const ArcInner<dyn WebSocketAuthPlugin> is !null: Freeze, PhantomData<ArcInner<dyn WebSocketAuthPlugin>>: Freeze, *const ArcInner<dyn WebSocketUsageEmitter> is !null: Freeze, PhantomData<ArcInner<dyn WebSocketUsageEmitter>>: Freeze, *const ArcInner<dyn OwnerTokenAccountsProvider> is !null: Freeze, PhantomData<ArcInner<dyn OwnerTokenAccountsProvider>>: Freeze, *const ArcInner<dyn SolanaGatewayUsageObserver> is !null: Freeze, PhantomData<ArcInner<dyn SolanaGatewayUsageObserver>>: Freeze, *const ArcInner<dyn WebSocketAdmissionProvider> is !null: Freeze, PhantomData<ArcInner<dyn WebSocketAdmissionProvider>>: Freeze,

§

impl Move for Runtime

§

impl Send for Runtime
where RawVecInner: Send, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Send, BoxRaw<(String, SetValZST)>: Send, Arc<ViewIndex>: Send, RawTable<(String, EntityBytecode)>: Send, RawTable<(String, Vec<String>)>: Send, RawTable<(String, ())>: Send, RawTable<(String, fn(&[u8]) -> Result<(Value, String), Box<dyn Error>>)>: Send, Arc<dyn Fn(Sender<MutationBatch>, Option<HealthMonitor>, ReconnectionConfig) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> + Sync + Send>: Send, Arc<dyn Fn(&str, &[u8]) -> Result<Value, Error> + Sync + Send>: Send, BoxRaw<IdlTypeSnapshot>: Send, NodeRef<Owned, String, Value, LeafOrInternal>: Send, BoxRaw<(String, Value)>: Send, BoxRaw<MappingSource>: Send, NodeRef<Owned, String, Transformation, LeafOrInternal>: Send, BoxRaw<(String, Transformation)>: Send, BoxRaw<ComputedExpr>: Send, NodeRef<Owned, String, FieldTypeInfo, LeafOrInternal>: Send, BoxRaw<(String, FieldTypeInfo)>: Send, BoxRaw<Predicate>: Send, RawTable<(HashId<ProgramRelease>, ProgramRuntimeDefinition)>: Send, RawTable<(String, Arc<MaterializedView>)>: Send, Arc<dyn WebSocketAuthPlugin>: Send, Arc<dyn WebSocketUsageEmitter>: Send, Arc<dyn OwnerTokenAccountsProvider>: Send, Arc<dyn SolanaGatewayUsageObserver>: Send, Arc<dyn WebSocketAdmissionProvider>: Send,

§

impl Sync for Runtime
where RawVecInner: Sync, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Sync, BoxRaw<(String, SetValZST)>: Sync, Arc<ViewIndex>: Sync, RawTable<(String, EntityBytecode)>: Sync, RawTable<(String, Vec<String>)>: Sync, RawTable<(String, ())>: Sync, RawTable<(String, fn(&[u8]) -> Result<(Value, String), Box<dyn Error>>)>: Sync, Arc<dyn Fn(Sender<MutationBatch>, Option<HealthMonitor>, ReconnectionConfig) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> + Sync + Send>: Sync, Arc<dyn Fn(&str, &[u8]) -> Result<Value, Error> + Sync + Send>: Sync, BoxRaw<IdlTypeSnapshot>: Sync, NodeRef<Owned, String, Value, LeafOrInternal>: Sync, BoxRaw<(String, Value)>: Sync, BoxRaw<MappingSource>: Sync, NodeRef<Owned, String, Transformation, LeafOrInternal>: Sync, BoxRaw<(String, Transformation)>: Sync, BoxRaw<ComputedExpr>: Sync, NodeRef<Owned, String, FieldTypeInfo, LeafOrInternal>: Sync, BoxRaw<(String, FieldTypeInfo)>: Sync, BoxRaw<Predicate>: Sync, RawTable<(HashId<ProgramRelease>, ProgramRuntimeDefinition)>: Sync, RawTable<(String, Arc<MaterializedView>)>: Sync, Arc<dyn WebSocketAuthPlugin>: Sync, Arc<dyn WebSocketUsageEmitter>: Sync, Arc<dyn OwnerTokenAccountsProvider>: Sync, Arc<dyn SolanaGatewayUsageObserver>: Sync, Arc<dyn WebSocketAdmissionProvider>: Sync,

§

impl Unpin for Runtime

§

impl UnsafeUnpin for Runtime
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<IpNet>: UnsafeUnpin, *const LeafNode<String, SetValZST> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(String, SetValZST)>>: UnsafeUnpin, *const ArcInner<ViewIndex> is !null: UnsafeUnpin, PhantomData<ArcInner<ViewIndex>>: UnsafeUnpin, PhantomData<(String, EntityBytecode)>: UnsafeUnpin, PhantomData<(String, Vec<String>)>: UnsafeUnpin, PhantomData<(String, ())>: UnsafeUnpin, PhantomData<(String, fn(&[u8]) -> Result<(Value, String), Box<dyn Error>>)>: UnsafeUnpin, PhantomData<String>: UnsafeUnpin, *const ArcInner<dyn Fn(Sender<MutationBatch>, Option<HealthMonitor>, ReconnectionConfig) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> + Sync + Send> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn Fn(Sender<MutationBatch>, Option<HealthMonitor>, ReconnectionConfig) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> + Sync + Send>>: UnsafeUnpin, PhantomData<ProgramRuntimeDefinition>: UnsafeUnpin, PhantomData<SerializableStreamSpec>: UnsafeUnpin, PhantomData<ViewDef>: UnsafeUnpin, PhantomData<(HashId<ProgramRelease>, ProgramRuntimeDefinition)>: UnsafeUnpin, PhantomData<(String, Arc<MaterializedView>)>: UnsafeUnpin, *const ArcInner<dyn WebSocketAuthPlugin> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn WebSocketAuthPlugin>>: UnsafeUnpin, *const ArcInner<dyn WebSocketUsageEmitter> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn WebSocketUsageEmitter>>: UnsafeUnpin, *const ArcInner<dyn OwnerTokenAccountsProvider> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn OwnerTokenAccountsProvider>>: UnsafeUnpin, *const ArcInner<dyn SolanaGatewayUsageObserver> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn SolanaGatewayUsageObserver>>: UnsafeUnpin, *const ArcInner<dyn WebSocketAdmissionProvider> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn WebSocketAdmissionProvider>>: UnsafeUnpin,

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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