Expand description
Shared core types for the Shardline server ecosystem.
This crate contains pure data structures and constants that are shared between the server crate and potential future crate extractions.
§Quick start
Store a content-addressed object under a validated key. This example uses
a blackhole store, which discards all writes and performs no I/O:
use shardline_protocol::ShardlineHash;
use shardline_server_core::ServerObjectStore;
use shardline_storage::{ObjectBody, ObjectIntegrity, ObjectKey, ObjectStore, PutOutcome};
let store = ServerObjectStore::blackhole();
let key = ObjectKey::parse("chunks/aa/bb/example.xorb")?;
let hash = ShardlineHash::from_bytes([7; 32]);
let body = ObjectBody::from_slice(b"serialized chunk bytes");
let integrity = ObjectIntegrity::new(hash, body.as_slice().len() as u64);
assert_eq!(
ObjectStore::put_if_absent(&store, &key, body, &integrity)?,
PutOutcome::Inserted
);
assert!(!ObjectStore::contains(&store, &key)?);For filesystem-backed storage, use ServerObjectStore::local (see its
documentation for a no_run example).
Re-exports§
pub use auth_capability::AuthorizedRepository;pub use auth_capability::scope_allows;pub use object_store::BoundedObjectReadError;pub use object_store::MaterializedObject;pub use object_store::OpsRecordKind;pub use object_store::OpsRecordStore;pub use object_store::ServerObjectStore;pub use object_store::ServerObjectStoreError;pub use object_store::read_full_object;pub use validation::chunk_hash;pub use validation::chunk_hash_from_chunk_object_key_if_present;pub use validation::chunk_object_key;pub use validation::content_hash;pub use ops::ParseStoredFileRecordError;pub use ops::parse_stored_file_record_bytes;pub use ops::provider_directory;
Modules§
- at_rest
- Shared at-rest encryption envelope (AES-256-GCM) for sensitive configuration values.
- auth
- Authentication and authorization types used by the Shardline server.
- auth_
capability - Typed, repo-scoped authorization capabilities.
- object_
store - ops
- protocol_
support - server_
frontend - Runtime protocol frontends served by the Shardline server.
- validation
Structs§
- Auth
Context - Verified request authorization context.
- Ed25519
Auth Provider - Ed25519 asymmetric-key authentication provider.
- Local
Hmac Provider - Shared-key token provider using HMAC-SHA256.
- Passthrough
Provider - Trust-all authentication provider for development mode.
- Rebuild
Overflow Error - Arithmetic overflow during rebuild operations.
- Shard
Metadata Limits - Bounded-parser limits for native Xet shard metadata.
- Validate
Content Hash Error - Content hash validation failure.
- Validate
Identifier Error - File identifier validation failure.
- Verified
Auth Context - Verified request authorization context, mintable only by the auth layer.
Enums§
- Auth
Error - Authentication provider failure.
- Invalid
Lifecycle Metadata Error - Lifecycle metadata consistency failure.
- Invalid
Reconstruction Response Error - Reconstruction response shape failure.
- Invalid
Serialized Shard Error - Serialized shard validation failure.
Constants§
- DEFAULT_
LOCAL_ GC_ RETENTION_ SECONDS - Default retention window for new local quarantine candidates.
- DEFAULT_
MAX_ SHARD_ FILES - Default bounded-parser limits for native Xet shard metadata.
- DEFAULT_
MAX_ SHARD_ RECONSTRUCTION_ TERMS - Default maximum shard reconstruction terms.
- DEFAULT_
MAX_ SHARD_ XORBS - Default maximum shard xorb sections.
- DEFAULT_
MAX_ SHARD_ XORB_ CHUNKS - Default maximum shard xorb chunk records.
- DEFAULT_
SHARD_ METADATA_ LIMITS - Default bounded-parser limits for native Xet shard metadata.
- MAX_
LOCAL_ RECORD_ METADATA_ BYTES - Maximum allowed stored file record metadata size in bytes.
Traits§
- Auth
Provider - Provider-agnostic authentication trait.
Functions§
- checked_
add - Checked addition returning an error on overflow.
- checked_
increment - Checked increment returning an error on overflow.
- unix_
now_ seconds_ checked - Returns the current Unix time in seconds, or an error if the system clock is before the Unix epoch.
- validate_
content_ hash - Validates that a content hash is exactly 64 lowercase hex characters.
- validate_
content_ hash_ with - Validates that a content hash is exactly 64 lowercase hex characters.
- validate_
identifier - Validates that a file identifier is safe for use as a single path component.