Skip to main content

ServerConfig

Struct ServerConfig 

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

Public server configuration.

Implementations§

Source§

impl ServerConfig

Source

pub fn new( bind_addr: SocketAddr, public_base_url: String, root_dir: PathBuf, chunk_size: NonZeroUsize, ) -> Self

Creates server configuration.

Source

pub fn from_env() -> Result<Self, ServerConfigError>

Loads server configuration from environment variables.

§Errors

Returns ServerConfigError when an environment value cannot be parsed or when the configured chunk size is zero.

Source

pub const fn bind_addr(&self) -> SocketAddr

Returns the socket address the server binds to.

Source

pub const fn server_role(&self) -> ServerRole

Returns the configured server role.

Source

pub fn server_frontends(&self) -> &[ServerFrontend]

Returns the enabled runtime protocol frontends.

Source

pub fn public_base_url(&self) -> &str

Returns the public base URL used in reconstruction responses.

Source

pub fn root_dir(&self) -> &Path

Returns the local deployment root directory.

Source

pub const fn max_request_body_bytes(&self) -> NonZeroUsize

Returns the maximum request body size accepted by body-buffering extractors.

Source

pub const fn shard_metadata_limits(&self) -> ShardMetadataLimits

Returns the bounded-parser limits for native Xet shard metadata.

Source

pub const fn chunk_size(&self) -> NonZeroUsize

Returns the content chunk size in bytes.

Source

pub const fn with_chunk_size(self, chunk_size: NonZeroUsize) -> Self

Overrides the content chunk size in bytes.

Source

pub const fn upload_max_in_flight_chunks(&self) -> NonZeroUsize

Returns the maximum in-flight upload chunks per file upload stream.

Source

pub const fn transfer_max_in_flight_chunks(&self) -> NonZeroUsize

Returns the maximum concurrent transfer budget measured in chunk-equivalent permits.

Source

pub fn with_root_dir(self, root_dir: PathBuf) -> Self

Overrides the local deployment root directory.

Source

pub fn with_object_storage( self, adapter: ObjectStorageAdapter, s3_config: Option<S3ObjectStoreConfig>, ) -> Self

Selects object storage for immutable CAS objects.

Source

pub const fn with_max_request_body_bytes( self, max_request_body_bytes: NonZeroUsize, ) -> Self

Overrides the maximum request body size accepted by body-buffering extractors.

Source

pub const fn with_shard_metadata_limits( self, shard_metadata_limits: ShardMetadataLimits, ) -> Self

Overrides bounded-parser limits for native Xet shard metadata.

Source

pub const fn with_server_role(self, server_role: ServerRole) -> Self

Selects the server role.

Source

pub fn with_server_frontends( self, server_frontends: impl IntoIterator<Item = ServerFrontend>, ) -> Result<Self, ServerConfigError>

Selects the enabled runtime protocol frontends.

§Errors

Returns ServerConfigError::MissingServerFrontends when the supplied frontend list is empty after deduplication.

Source

pub const fn with_upload_max_in_flight_chunks( self, upload_max_in_flight_chunks: NonZeroUsize, ) -> Self

Overrides the per-upload chunk processing window.

Source

pub const fn with_transfer_max_in_flight_chunks( self, transfer_max_in_flight_chunks: NonZeroUsize, ) -> Self

Overrides the transfer concurrency budget measured in chunk-equivalent permits.

Source

pub fn with_reconstruction_cache_disabled(self) -> Self

Selects the disabled reconstruction-cache adapter.

Source

pub fn with_reconstruction_cache_memory( self, reconstruction_cache_ttl_seconds: NonZeroU64, reconstruction_cache_memory_max_entries: NonZeroUsize, ) -> Self

Selects the bounded in-memory reconstruction-cache adapter.

Source

pub const fn with_oci_upload_session_ttl_seconds( self, oci_upload_session_ttl_seconds: NonZeroU64, ) -> Self

Overrides the maximum idle lifetime for OCI upload sessions.

Source

pub const fn with_oci_upload_max_active_sessions( self, oci_upload_max_active_sessions: NonZeroUsize, ) -> Self

Overrides the maximum number of live OCI upload sessions per server root.

Source

pub const fn with_oci_registry_token_ttl_seconds( self, oci_registry_token_ttl_seconds: NonZeroU64, ) -> Self

Source

pub const fn with_oci_registry_token_max_in_flight_requests( self, oci_registry_token_max_in_flight_requests: NonZeroUsize, ) -> Self

Source

pub fn with_reconstruction_cache_redis( self, reconstruction_cache_redis_url: String, reconstruction_cache_ttl_seconds: NonZeroU64, ) -> Result<Self, ServerConfigError>

Selects the Redis reconstruction-cache adapter.

§Errors

Returns ServerConfigError::EmptyReconstructionCacheRedisUrl when the URL is empty.

Source

pub fn index_postgres_url(&self) -> Option<&str>

Returns the optional Postgres metadata URL.

Source

pub const fn auth_provider(&self) -> AuthProviderKind

Returns the configured auth provider kind.

Source

pub fn auth_oidc_issuer(&self) -> Option<&str>

Returns the optional OIDC issuer URL.

Source

pub fn auth_jwks_url(&self) -> Option<&str>

Returns the optional JWKS endpoint URL.

Source

pub fn auth_jwks_issuer(&self) -> Option<&str>

Returns the optional JWKS issuer for token validation.

Source

pub fn token_signing_key(&self) -> Option<&[u8]>

Returns the optional token signing key.

Source

pub fn metrics_token(&self) -> Option<&[u8]>

Returns the optional metrics bearer token.

Source

pub fn provider_config_path(&self) -> Option<&Path>

Returns the optional provider configuration path.

Source

pub fn provider_api_key(&self) -> Option<&[u8]>

Returns the optional provider bootstrap key.

Source

pub fn provider_token_issuer(&self) -> Option<&str>

Returns the provider token issuer identity when provider issuance is enabled.

Source

pub const fn provider_token_ttl_seconds(&self) -> Option<NonZeroU64>

Returns the provider token lifetime when provider issuance is enabled.

Source

pub fn with_index_postgres_url( self, index_postgres_url: String, ) -> Result<Self, ServerConfigError>

Sets the PostgreSQL connection URL for the index store.

§Errors

Returns ServerConfigError::EmptyIndexPostgresUrl when the URL is empty.

Source

pub fn with_token_signing_key( self, token_signing_key: Vec<u8>, ) -> Result<Self, ServerConfigError>

Enables local bearer-token verification with the supplied signing key.

§Errors

Returns ServerConfigError::EmptyTokenSigningKey when the signing key is empty.

Source

pub const fn with_auth_provider(self, auth_provider: AuthProviderKind) -> Self

Selects the authentication provider.

Source

pub fn with_auth_oidc_issuer(self, issuer: String) -> Self

Sets the OIDC issuer URL for the OIDC auth provider.

Source

pub fn with_auth_jwks_url(self, url: String) -> Self

Sets the JWKS endpoint URL for the JWKS auth provider.

Source

pub fn with_auth_jwks_issuer(self, issuer: String) -> Self

Sets the JWKS issuer for token validation.

Source

pub fn with_metrics_token( self, metrics_token: Vec<u8>, ) -> Result<Self, ServerConfigError>

Enables bearer-token verification for /metrics.

§Errors

Returns ServerConfigError::EmptyMetricsToken when the metrics token is empty.

Source

pub fn with_provider_runtime( self, provider_config_path: PathBuf, provider_api_key: Vec<u8>, issuer_identity: String, ttl_seconds: NonZeroU64, ) -> Result<Self, ServerConfigError>

Enables the provider-facing token issuance surface.

§Errors

Returns ServerConfigError when the provider bootstrap key or issuer identity is empty, or when token signing is not configured.

Source

pub const fn validate_runtime_requirements( &self, ) -> Result<(), ServerConfigError>

Validates runtime requirements implied by the selected route surface.

§Errors

Returns ServerConfigError::MissingTokenSigningKeyForServedRoutes when the selected role would expose authenticated CAS routes without a signing key.

Trait Implementations§

Source§

impl Clone for ServerConfig

Source§

fn clone(&self) -> ServerConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServerConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for ServerConfig

Source§

impl PartialEq for ServerConfig

Source§

fn eq(&self, other: &ServerConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ServerConfig

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ServiceExt for T

Source§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
Source§

fn override_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request. Read more
Source§

fn append_request_header<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Append a header into the request. Read more
Source§

fn insert_request_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetRequestHeader<Self, M>
where Self: Sized,

Insert a header into the request, if the header is not already present. Read more
Source§

fn override_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response. Read more
Source§

fn append_response_header<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Append a header into the response. Read more
Source§

fn insert_response_header_if_not_present<M>( self, header_name: HeaderName, make: M, ) -> SetResponseHeader<Self, M>
where Self: Sized,

Insert a header into the response, if the header is not already present. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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