Skip to main content

Crate shardline_server

Crate shardline_server 

Source
Expand description

HTTP server runtime and operator workflows for Shardline.

This crate owns the deployable server boundary: HTTP routing, configuration, local and Postgres metadata backends, provider token issuance, integrity checks, repair flows, garbage collection, backup manifests, and storage migration.

Most embedders only need ServerConfig and serve. Operational tooling can use the same library entry points exposed by the shardline CLI, such as run_fsck, run_lifecycle_repair, run_gc, and run_storage_migration.

§Example

use shardline_server::{ServerConfig, serve};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = ServerConfig::from_env()?;
    serve(config).await?;
    Ok(())
}

Re-exports§

pub use app::ProtocolMetrics;
pub use app::AppState;
pub use app::MAX_PROVIDER_NAME_BYTES;
pub use app::MAX_PROVIDER_SUBJECT_BYTES;
pub use app::MAX_PROVIDER_TOKEN_REQUEST_BODY_BYTES;
pub use app::MAX_PROVIDER_WEBHOOK_BODY_BYTES;
pub use app::acquire_chunk_transfer_permit;
pub use app::full_byte_stream_response;
pub use download_stream::STREAM_READ_BUFFER_BYTES;
pub use download_stream::ServerByteStream;
pub use app::serve;
pub use app::serve_with_listener;

Modules§

app
download_stream
metrics
test_fixtures
test_invariant_error

Structs§

BackupManifestReport
Adapter-neutral backup manifest summary.
BatchReconstructionResponse
Batch reconstruction response for multiple file identifiers.
BenchmarkBackend
Public benchmark-facing backend wrapper that resolves the active metadata and object adapters without exposing the private server runtime enum.
ConfigCheckReport
Result of validating a Shardline runtime configuration.
DatabaseMigration
One Shardline schema migration.
DatabaseMigrationOptions
Database-migration runtime options.
DatabaseMigrationReport
Database-migration execution report.
DatabaseMigrationStatusEntry
One migration row in the status report.
FileReconstructionResponse
File reconstruction response.
FileReconstructionV2Response
V2 file reconstruction response.
GitLfsAuthenticateResponse
Git LFS authenticate response carrying Xet custom-transfer bootstrap headers.
HealthResponse
Health response returned by the HTTP server.
LifecycleRepairOptions
Lifecycle-repair execution options.
LifecycleRepairReport
Lifecycle-repair report.
LocalBackend
Local filesystem backend for file chunk storage and reconstruction metadata.
LocalGcDiagnostics
Detailed GC diagnostics intended for operators and automation.
LocalGcOptions
Local filesystem garbage-collection execution options.
LocalGcReport
Local filesystem garbage-collection report.
PostgresBackend
Server backend that keeps file metadata in Postgres and object bytes in the selected store.
ProviderTokenIssueRequest
Provider-backed CAS token issuance request.
ProviderTokenIssueResponse
Provider-backed CAS token issuance response.
ProviderWebhookResponse
Provider webhook handling response.
ReadyResponse
Readiness response returned by the HTTP server.
ReconstructionCacheBenchReport
Benchmarks one cold reconstruction load followed by one hot cache hit.
ReconstructionCacheService
Runtime reconstruction-cache service.
ServerConfig
Public server configuration.
ServerFrontendParseError
Invalid server frontend token.
ServerRoleParseError
Invalid server role token.
ServerStatsResponse
Storage stats response.
ShardMetadataLimits
Bounded-parser limits for native Xet shard metadata. Bounded-parser limits for native Xet shard metadata.
StorageMigrationOptions
Storage-migration runtime options.
StorageMigrationReport
Storage-migration summary.
TransferLimiter
Weighted transfer concurrency limiter based on chunk-equivalent cost.
XetCasTokenResponse
Xet CAS access-token response consumed by reference clients.
XorbUploadResponse
Upload result for a single xorb.

Enums§

AuthProviderKind
Authentication provider selection.
BazelCacheKind
DatabaseMigrationCommand
Requested database-migration action.
DatabaseMigrationError
Database-migration failure.
FsckIssueDetail
Integrity issue detail.
FsckIssueKind
Integrity issue kinds for the checker.
FsckReconstructionPlanDetail
Reconstruction-plan detail for fsck issues.
IndexRebuildIssueDetail
Index-rebuild issue detail.
IndexRebuildReconstructionPlanDetail
Index-rebuild reconstruction-plan issue detail.
ObjectStorageAdapter
Immutable object-storage adapter selection.
ObjectStoreError
Object-storage subsystem failure.
ProviderRepositoryStateTimestampField
Provider repository state timestamp field.
ServerBackend
ServerConfigError
Server configuration loading failure.
ServerError
Server runtime failure.
ServerFrontend
Runtime protocol frontend selection.
ServerObjectStore
Unified object-store backend that delegates to local, S3, or blackhole storage.
ServerRole
Runtime server role selection.
StorageMigrationEndpoint
Object-storage endpoint used by storage migration.

Constants§

DEFAULT_LOCAL_GC_RETENTION_SECONDS
Default retention window for new local quarantine candidates.
DEFAULT_WEBHOOK_DELIVERY_RETENTION_SECONDS
Default retention for processed webhook delivery claims before repair prunes them.

Functions§

apply_database_migrations
Applies pending Shardline migrations to an existing Postgres pool.
bazel_cache_object_key
Returns the storage object key for a Bazel cache entry.
benchmark_memory_reconstruction_cache
Measures cold and hot reconstruction-cache behavior over the local backend path.
bundled_database_migrations
Returns the bundled Shardline migration list in application order.
chunk_hash
clear_repository_reference_probe_filter
decode_serialized_xorb_chunks
Decodes the packed chunk stream of a previously validated serialized xorb.
ingest_without_storage_with_parallelism
Runs the upload ingestion pipeline without storage using explicit chunk parallelism.
lfs_object_key
Returns the storage object key for an LFS object.
load_server_config_from_env_with_toml
Loads server configuration from environment variables, applying optional TOML config file values as defaults. Environment variables already set in the process take precedence over TOML values.
load_toml_config
Parses a shardline.toml file at the given path (or auto-detected) and returns the deserialized config struct.
lock_repository_reference_probe_test
oci_blob_key
Errors
oci_manifest_key
Errors
oci_manifest_media_type_key
Errors
repository_reference_probe_count
reset_repository_reference_probe_count_for_hash
run_config_check
Validates the selected runtime configuration and backend reachability.
run_database_migration
Executes a Shardline database-migration command against Postgres.
run_fsck
Runs integrity checks against the configured metadata backend and local chunk storage.
run_gc
Runs garbage collection against the configured metadata backend and local chunk storage.
run_gc_diagnostics
Runs garbage collection and returns operator diagnostics.
run_index_rebuild
Rebuilds latest-record state against the configured metadata backend.
run_lifecycle_repair
Repairs stale lifecycle metadata against the configured metadata backend.
run_local_fsck
Runs local filesystem integrity checks over Shardline metadata and chunk storage.
run_local_index_rebuild
Rebuilds local latest-record state from immutable version records.
run_local_lifecycle_repair
Repairs stale lifecycle metadata for one local storage root.
run_storage_migration
Copies immutable payload objects between object-storage adapters.
shared_sha256_object_key
Builds a shared-namespace object key for a SHA-256 digest.
try_for_each_serialized_xorb_chunk
Decodes the packed chunk stream of a previously validated serialized xorb and passes each decoded chunk to visitor before decoding the next chunk.
validate_serialized_xorb
Validates a serialized Xet xorb against the requested content hash and extracts trusted chunk metadata.
write_backup_manifest
Writes an adapter-neutral backup manifest for the configured deployment.

Type Aliases§

LocalFsckIssue
Backward-compatible local fsck issue alias.
LocalFsckIssueKind
Backward-compatible local fsck issue-kind alias.
LocalFsckReport
Backward-compatible local fsck report alias.
LocalIndexRebuildIssue
Backward-compatible local index-rebuild issue alias.
LocalIndexRebuildIssueKind
Backward-compatible local index-rebuild issue-kind alias.
LocalIndexRebuildReport
Backward-compatible local index-rebuild report alias.