Skip to main content

ServerBuilder

Struct ServerBuilder 

Source
pub struct ServerBuilder { /* private fields */ }
Expand description

Builder for configuring and creating a Arete server

Implementations§

Source§

impl ServerBuilder

Source

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

Set the specification (bytecode, parsers, program_ids)

Source

pub fn views(self, views: ViewIndex) -> Self

Set custom view index

Source

pub fn websocket(self) -> Self

Enable WebSocket server with default configuration

Source

pub fn websocket_config(self, config: WebSocketConfig) -> Self

Configure WebSocket server

Source

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

Set a WebSocket auth plugin used to authorize inbound connections.

Source

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

Set an HTTP auth plugin used to authorize inbound read requests.

Source

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

Set an async usage emitter for billing-grade websocket usage events.

Source

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

Source

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

Set the maximum number of concurrent WebSocket clients.

Source

pub fn 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 websocket_admission_provider( self, provider: Arc<dyn WebSocketAdmissionProvider>, ) -> Self

Install an embedder-owned provider for cross-runtime admission.

Source

pub fn websocket_delivery_config(self, config: WebSocketDeliveryConfig) -> Self

Configure list-view buffering and latest-state collection delivery.

Source

pub fn websocket_limits(self, config: WebSocketLimitsConfig) -> Self

Configure WebSocket message, frame and handshake limits.

Source

pub fn http_limits(self, config: HttpLimitsConfig) -> Self

Configure HTTP body, header and read RPC limits.

Source

pub fn bind(self, addr: impl Into<SocketAddr>) -> Self

Set the bind address for WebSocket server

Source

pub fn yellowstone(self, config: YellowstoneConfig) -> Self

Configure Yellowstone gRPC connection

Source

pub fn health_monitoring(self) -> Self

Enable health monitoring with default configuration

Source

pub fn health_config(self, config: HealthConfig) -> Self

Configure health monitoring

Source

pub fn snapshots(self, config: SnapshotConfig) -> Self

Configure state snapshots (restart recovery). Without this call the server falls back to SnapshotConfig::from_env() (ARETE_SNAPSHOT_*).

Source

pub fn journal(self, config: JournalConfig) -> Self

Retain published events for replayable append subscriptions on this runtime, overriding ARETE_JOURNAL_* for this instance only.

Source

pub fn reconnection(self) -> Self

Enable reconnection with default configuration

Source

pub fn reconnection_config(self, config: ReconnectionConfig) -> Self

Configure reconnection behavior

Source

pub fn http(self) -> Self

Enable the HTTP server with default configuration (port 8081).

This serves health endpoints plus stack-scoped HTTP reads.

Source

pub fn http_config(self, config: HttpServerConfig) -> Self

Configure the HTTP server.

Source

pub fn transactions_config(self, config: TransactionConfig) -> Self

Configure and explicitly enable the fixed transaction HTTP routes.

Source

pub fn runtime_plan(self, plan: RuntimePlan) -> Self

Replace the inferred capability set with an explicit runtime plan.

Source

pub fn program_reads(self) -> Self

Enable only health and release-pinned program reads over HTTP.

Source

pub fn program_read_binding(self, target_id: impl Into<String>) -> Self

Enable program reads bound to one exact hosted program-read target.

Source

pub fn chain_reads(self) -> Self

Source

pub fn stack_queries(self) -> Self

Source

pub fn live_runtime(self) -> Self

Source

pub fn http_bind(self, addr: impl Into<SocketAddr>) -> Self

Set the bind address for the HTTP server.

Source

pub fn http_health(self) -> Self

Enable HTTP health server with default configuration (port 8081)

Source

pub fn http_health_config(self, config: HttpHealthConfig) -> Self

Configure HTTP health server

Source

pub fn health_bind(self, addr: impl Into<SocketAddr>) -> Self

Set the bind address for HTTP health server

Source

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

Build, start and block until shutdown. See Runtime::run.

Source

pub fn build(self) -> Result<Runtime>

Build the Runtime without starting it.

For callers that embed the server: build then Runtime::spawn gives a runtime::RuntimeHandle that serves connections the caller accepted and can be shut down on demand.

Auto Trait Implementations§

§

impl !RefUnwindSafe for ServerBuilder

§

impl !UnwindSafe for ServerBuilder

§

impl Forget for ServerBuilder

§

impl Freeze for ServerBuilder
where *const u8 is !null: 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<(String, Vec<ViewSpec>)>: Freeze, PhantomData<(String, ViewSpec)>: Freeze, *const ArcInner<RwLock<HashMap<String, SortedViewCache>>> is !null: Freeze, PhantomData<ArcInner<RwLock<HashMap<String, SortedViewCache>>>>: Freeze, PhantomData<(String, ScopeField)>: Freeze, PhantomData<(String, Arc<MaterializedView>)>: 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<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 ServerBuilder

§

impl Send for ServerBuilder
where RawTable<(String, EntityBytecode)>: Send, RawTable<(String, Vec<String>)>: Send, RawTable<(String, ())>: Send, RawTable<(String, fn(&[u8]) -> Result<(Value, String), Box<dyn Error>>)>: Send, RawVecInner: 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<(String, Vec<ViewSpec>)>: Send, RawTable<(String, ViewSpec)>: Send, Arc<RwLock<HashMap<String, SortedViewCache>>>: Send, RawTable<(String, ScopeField)>: Send, RawTable<(String, Arc<MaterializedView>)>: Send, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Send, BoxRaw<(String, SetValZST)>: Send, Arc<dyn WebSocketAuthPlugin>: Send, Arc<dyn WebSocketUsageEmitter>: Send, Arc<dyn OwnerTokenAccountsProvider>: Send, Arc<dyn SolanaGatewayUsageObserver>: Send, Arc<dyn WebSocketAdmissionProvider>: Send,

§

impl Sync for ServerBuilder
where RawTable<(String, EntityBytecode)>: Sync, RawTable<(String, Vec<String>)>: Sync, RawTable<(String, ())>: Sync, RawTable<(String, fn(&[u8]) -> Result<(Value, String), Box<dyn Error>>)>: Sync, RawVecInner: 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<(String, Vec<ViewSpec>)>: Sync, RawTable<(String, ViewSpec)>: Sync, Arc<RwLock<HashMap<String, SortedViewCache>>>: Sync, RawTable<(String, ScopeField)>: Sync, RawTable<(String, Arc<MaterializedView>)>: Sync, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Sync, BoxRaw<(String, SetValZST)>: Sync, Arc<dyn WebSocketAuthPlugin>: Sync, Arc<dyn WebSocketUsageEmitter>: Sync, Arc<dyn OwnerTokenAccountsProvider>: Sync, Arc<dyn SolanaGatewayUsageObserver>: Sync, Arc<dyn WebSocketAdmissionProvider>: Sync,

§

impl Unpin for ServerBuilder

§

impl UnsafeUnpin for ServerBuilder
where *const u8 is !null: 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<(String, Vec<ViewSpec>)>: UnsafeUnpin, PhantomData<(String, ViewSpec)>: UnsafeUnpin, *const ArcInner<RwLock<HashMap<String, SortedViewCache>>> is !null: UnsafeUnpin, PhantomData<ArcInner<RwLock<HashMap<String, SortedViewCache>>>>: UnsafeUnpin, PhantomData<(String, ScopeField)>: UnsafeUnpin, PhantomData<(String, Arc<MaterializedView>)>: 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<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