pub struct ServerConfig { /* private fields */ }Expand description
Public server configuration.
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn new(
bind_addr: SocketAddr,
public_base_url: String,
root_dir: PathBuf,
chunk_size: NonZeroUsize,
) -> Self
pub fn new( bind_addr: SocketAddr, public_base_url: String, root_dir: PathBuf, chunk_size: NonZeroUsize, ) -> Self
Creates server configuration.
Sourcepub fn from_env() -> Result<Self, ServerConfigError>
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.
Sourcepub const fn bind_addr(&self) -> SocketAddr
pub const fn bind_addr(&self) -> SocketAddr
Returns the socket address the server binds to.
Sourcepub const fn server_role(&self) -> ServerRole
pub const fn server_role(&self) -> ServerRole
Returns the configured server role.
Sourcepub fn server_frontends(&self) -> &[ServerFrontend]
pub fn server_frontends(&self) -> &[ServerFrontend]
Returns the enabled runtime protocol frontends.
Sourcepub fn public_base_url(&self) -> &str
pub fn public_base_url(&self) -> &str
Returns the public base URL used in reconstruction responses.
Sourcepub const fn max_request_body_bytes(&self) -> NonZeroUsize
pub const fn max_request_body_bytes(&self) -> NonZeroUsize
Returns the maximum request body size accepted by body-buffering extractors.
Sourcepub const fn shard_metadata_limits(&self) -> ShardMetadataLimits
pub const fn shard_metadata_limits(&self) -> ShardMetadataLimits
Returns the bounded-parser limits for native Xet shard metadata.
Sourcepub const fn chunk_size(&self) -> NonZeroUsize
pub const fn chunk_size(&self) -> NonZeroUsize
Returns the content chunk size in bytes.
Sourcepub const fn with_chunk_size(self, chunk_size: NonZeroUsize) -> Self
pub const fn with_chunk_size(self, chunk_size: NonZeroUsize) -> Self
Overrides the content chunk size in bytes.
Sourcepub const fn upload_max_in_flight_chunks(&self) -> NonZeroUsize
pub const fn upload_max_in_flight_chunks(&self) -> NonZeroUsize
Returns the maximum in-flight upload chunks per file upload stream.
Sourcepub const fn transfer_max_in_flight_chunks(&self) -> NonZeroUsize
pub const fn transfer_max_in_flight_chunks(&self) -> NonZeroUsize
Returns the maximum concurrent transfer budget measured in chunk-equivalent permits.
Sourcepub fn with_root_dir(self, root_dir: PathBuf) -> Self
pub fn with_root_dir(self, root_dir: PathBuf) -> Self
Overrides the local deployment root directory.
Sourcepub fn with_object_storage(
self,
adapter: ObjectStorageAdapter,
s3_config: Option<S3ObjectStoreConfig>,
) -> Self
pub fn with_object_storage( self, adapter: ObjectStorageAdapter, s3_config: Option<S3ObjectStoreConfig>, ) -> Self
Selects object storage for immutable CAS objects.
Sourcepub const fn with_max_request_body_bytes(
self,
max_request_body_bytes: NonZeroUsize,
) -> Self
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.
Sourcepub const fn with_shard_metadata_limits(
self,
shard_metadata_limits: ShardMetadataLimits,
) -> Self
pub const fn with_shard_metadata_limits( self, shard_metadata_limits: ShardMetadataLimits, ) -> Self
Overrides bounded-parser limits for native Xet shard metadata.
Sourcepub const fn with_server_role(self, server_role: ServerRole) -> Self
pub const fn with_server_role(self, server_role: ServerRole) -> Self
Selects the server role.
Sourcepub fn with_server_frontends(
self,
server_frontends: impl IntoIterator<Item = ServerFrontend>,
) -> Result<Self, ServerConfigError>
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.
Sourcepub const fn with_upload_max_in_flight_chunks(
self,
upload_max_in_flight_chunks: NonZeroUsize,
) -> Self
pub const fn with_upload_max_in_flight_chunks( self, upload_max_in_flight_chunks: NonZeroUsize, ) -> Self
Overrides the per-upload chunk processing window.
Sourcepub const fn with_transfer_max_in_flight_chunks(
self,
transfer_max_in_flight_chunks: NonZeroUsize,
) -> Self
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.
Sourcepub fn with_reconstruction_cache_disabled(self) -> Self
pub fn with_reconstruction_cache_disabled(self) -> Self
Selects the disabled reconstruction-cache adapter.
Sourcepub fn with_reconstruction_cache_memory(
self,
reconstruction_cache_ttl_seconds: NonZeroU64,
reconstruction_cache_memory_max_entries: NonZeroUsize,
) -> Self
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.
Sourcepub const fn with_oci_upload_session_ttl_seconds(
self,
oci_upload_session_ttl_seconds: NonZeroU64,
) -> Self
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.
Sourcepub const fn with_oci_upload_max_active_sessions(
self,
oci_upload_max_active_sessions: NonZeroUsize,
) -> Self
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.
pub const fn with_oci_registry_token_ttl_seconds( self, oci_registry_token_ttl_seconds: NonZeroU64, ) -> Self
pub const fn with_oci_registry_token_max_in_flight_requests( self, oci_registry_token_max_in_flight_requests: NonZeroUsize, ) -> Self
Sourcepub fn with_reconstruction_cache_redis(
self,
reconstruction_cache_redis_url: String,
reconstruction_cache_ttl_seconds: NonZeroU64,
) -> Result<Self, ServerConfigError>
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.
Sourcepub fn index_postgres_url(&self) -> Option<&str>
pub fn index_postgres_url(&self) -> Option<&str>
Returns the optional Postgres metadata URL.
Sourcepub const fn auth_provider(&self) -> AuthProviderKind
pub const fn auth_provider(&self) -> AuthProviderKind
Returns the configured auth provider kind.
Sourcepub fn auth_oidc_issuer(&self) -> Option<&str>
pub fn auth_oidc_issuer(&self) -> Option<&str>
Returns the optional OIDC issuer URL.
Sourcepub fn auth_jwks_url(&self) -> Option<&str>
pub fn auth_jwks_url(&self) -> Option<&str>
Returns the optional JWKS endpoint URL.
Sourcepub fn auth_jwks_issuer(&self) -> Option<&str>
pub fn auth_jwks_issuer(&self) -> Option<&str>
Returns the optional JWKS issuer for token validation.
Sourcepub fn token_signing_key(&self) -> Option<&[u8]>
pub fn token_signing_key(&self) -> Option<&[u8]>
Returns the optional token signing key.
Sourcepub fn metrics_token(&self) -> Option<&[u8]>
pub fn metrics_token(&self) -> Option<&[u8]>
Returns the optional metrics bearer token.
Sourcepub fn provider_config_path(&self) -> Option<&Path>
pub fn provider_config_path(&self) -> Option<&Path>
Returns the optional provider configuration path.
Sourcepub fn provider_api_key(&self) -> Option<&[u8]>
pub fn provider_api_key(&self) -> Option<&[u8]>
Returns the optional provider bootstrap key.
Sourcepub fn provider_token_issuer(&self) -> Option<&str>
pub fn provider_token_issuer(&self) -> Option<&str>
Returns the provider token issuer identity when provider issuance is enabled.
Sourcepub const fn provider_token_ttl_seconds(&self) -> Option<NonZeroU64>
pub const fn provider_token_ttl_seconds(&self) -> Option<NonZeroU64>
Returns the provider token lifetime when provider issuance is enabled.
Sourcepub fn with_index_postgres_url(
self,
index_postgres_url: String,
) -> Result<Self, ServerConfigError>
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.
Sourcepub fn with_token_signing_key(
self,
token_signing_key: Vec<u8>,
) -> Result<Self, ServerConfigError>
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.
Sourcepub const fn with_auth_provider(self, auth_provider: AuthProviderKind) -> Self
pub const fn with_auth_provider(self, auth_provider: AuthProviderKind) -> Self
Selects the authentication provider.
Sourcepub fn with_auth_oidc_issuer(self, issuer: String) -> Self
pub fn with_auth_oidc_issuer(self, issuer: String) -> Self
Sets the OIDC issuer URL for the OIDC auth provider.
Sourcepub fn with_auth_jwks_url(self, url: String) -> Self
pub fn with_auth_jwks_url(self, url: String) -> Self
Sets the JWKS endpoint URL for the JWKS auth provider.
Sourcepub fn with_auth_jwks_issuer(self, issuer: String) -> Self
pub fn with_auth_jwks_issuer(self, issuer: String) -> Self
Sets the JWKS issuer for token validation.
Sourcepub fn with_metrics_token(
self,
metrics_token: Vec<u8>,
) -> Result<Self, ServerConfigError>
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.
Sourcepub fn with_provider_runtime(
self,
provider_config_path: PathBuf,
provider_api_key: Vec<u8>,
issuer_identity: String,
ttl_seconds: NonZeroU64,
) -> Result<Self, ServerConfigError>
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.
Sourcepub const fn validate_runtime_requirements(
&self,
) -> Result<(), ServerConfigError>
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
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServerConfig
impl Debug for ServerConfig
impl Eq for ServerConfig
Source§impl PartialEq for ServerConfig
impl PartialEq for ServerConfig
Source§fn eq(&self, other: &ServerConfig) -> bool
fn eq(&self, other: &ServerConfig) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ServerConfig
Auto Trait Implementations§
impl Freeze for ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnsafeUnpin for ServerConfig
impl UnwindSafe for ServerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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