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§
Structs§
- Backup
Manifest Report - Adapter-neutral backup manifest summary.
- Batch
Reconstruction Response - Batch reconstruction response for multiple file identifiers.
- Benchmark
Backend - Public benchmark-facing backend wrapper that resolves the active metadata and object adapters without exposing the private server runtime enum.
- Config
Check Report - Result of validating a Shardline runtime configuration.
- Database
Migration - One Shardline schema migration.
- Database
Migration Options - Database-migration runtime options.
- Database
Migration Report - Database-migration execution report.
- Database
Migration Status Entry - One migration row in the status report.
- File
Reconstruction Response - File reconstruction response.
- File
Reconstruction V2Response - V2 file reconstruction response.
- Fuzz
Bazel Http Frontend Summary - Summary of Bazel HTTP cache frontend validation used by fuzz targets.
- Fuzz
LfsFrontend Summary - Summary of Git LFS frontend validation used by fuzz targets.
- Fuzz
Lifecycle Repair Summary - Summary of lifecycle-repair classifications used by fuzz targets.
- Fuzz
OciFrontend Summary - Summary of OCI frontend parsing and validation used by fuzz targets.
- Fuzz
Protocol Frontend Summary - Summary of protocol-frontend parser and key validation used by fuzz targets.
- Fuzz
Reconstruction Response Summary - Summary of reconstruction response shape used by fuzz targets.
- Fuzz
Retained Shard Summary - Summary of chunk hashes retained by a shard payload.
- Fuzz
Validated Xorb Summary - Summary of a normalized and validated xorb payload used by fuzz targets.
- GitLfs
Authenticate Response - Git LFS authenticate response carrying Xet custom-transfer bootstrap headers.
- Health
Response - Health response returned by the HTTP server.
- Lifecycle
Repair Options - Lifecycle-repair execution options.
- Lifecycle
Repair Report - Lifecycle-repair report.
- Local
Backend - Local filesystem backend for file chunk storage and reconstruction metadata.
- Local
GcDiagnostics - Detailed GC diagnostics intended for operators and automation.
- Local
GcOptions - Local filesystem garbage-collection execution options.
- Local
GcReport - Local filesystem garbage-collection report.
- Provider
Token Issue Request - Provider-backed CAS token issuance request.
- Provider
Token Issue Response - Provider-backed CAS token issuance response.
- Provider
Webhook Response - Provider webhook handling response.
- Ready
Response - Readiness response returned by the HTTP server.
- Reconstruction
Cache Bench Report - Benchmarks one cold reconstruction load followed by one hot cache hit.
- Reconstruction
Cache Service - Runtime reconstruction-cache service.
- Server
Config - Public server configuration.
- Server
Frontend Parse Error - Invalid server frontend token.
- Server
Role Parse Error - Invalid server role token.
- Server
Stats Response - Storage stats response.
- Shard
Metadata Limits - Bounded-parser limits for native Xet shard metadata. Bounded-parser limits for native Xet shard metadata.
- Storage
Migration Options - Storage-migration runtime options.
- Storage
Migration Report - Storage-migration summary.
- Transfer
Limiter - Weighted transfer concurrency limiter based on chunk-equivalent cost.
- XetCas
Token Response - Xet CAS access-token response consumed by reference clients.
- Xorb
Upload Response - Upload result for a single xorb.
Enums§
- Auth
Provider Kind - Authentication provider selection.
- Bazel
Cache Kind - Database
Migration Command - Requested database-migration action.
- Database
Migration Error - Database-migration failure.
- Fsck
Issue Detail - Integrity issue detail.
- Fsck
Issue Kind - Integrity issue kinds for the checker.
- Fsck
Reconstruction Plan Detail - Reconstruction-plan detail for fsck issues.
- Index
Rebuild Issue Detail - Index-rebuild issue detail.
- Index
Rebuild Reconstruction Plan Detail - Index-rebuild reconstruction-plan issue detail.
- Object
Storage Adapter - Immutable object-storage adapter selection.
- Provider
Repository State Timestamp Field - Provider repository state timestamp field.
- Server
Backend - Server
Config Error - Server configuration loading failure.
- Server
Error - Server runtime failure.
- Server
Frontend - Runtime protocol frontend selection.
- Server
Object Store - Unified object-store backend that delegates to local, S3, or blackhole storage.
- Server
Role - Runtime server role selection.
- Storage
Migration Endpoint - 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.
- fuzz_
bazel_ http_ frontend_ summary - Validates Bazel HTTP cache key derivation for fuzzing.
- fuzz_
lfs_ frontend_ summary - Validates Git LFS object identity and key determinism for fuzzing.
- fuzz_
lifecycle_ repair_ summary - Classifies lifecycle-repair decisions for fuzzed metadata states.
- fuzz_
normalize_ and_ validate_ xorb - Normalizes a raw uploaded Xorb payload and validates the normalized result.
- fuzz_
oci_ frontend_ summary - Validates OCI path parsing and identity derivation for fuzzing.
- fuzz_
protocol_ frontend_ summary - Parses protocol frontend selectors and validates protocol-specific object keys.
- fuzz_
reconstruction_ response_ summary - Builds a reconstruction response and checks protocol-shape invariants for fuzzing.
- fuzz_
retained_ shard_ chunk_ hashes - Parses a serialized shard with bounded metadata limits and reports the retained dedupe chunk hashes.
- 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.
- 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 - try_
for_ each_ serialized_ xorb_ chunk - Decodes the packed chunk stream of a previously validated serialized xorb and
passes each decoded chunk to
visitorbefore 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§
- Local
Fsck Issue - Backward-compatible local fsck issue alias.
- Local
Fsck Issue Kind - Backward-compatible local fsck issue-kind alias.
- Local
Fsck Report - Backward-compatible local fsck report alias.
- Local
Index Rebuild Issue - Backward-compatible local index-rebuild issue alias.
- Local
Index Rebuild Issue Kind - Backward-compatible local index-rebuild issue-kind alias.
- Local
Index Rebuild Report - Backward-compatible local index-rebuild report alias.