Expand description
Shared protocol adapters for Git LFS, Bazel HTTP cache, and related object-key mapping.
This crate owns the small, self-contained functions that map protocol
identifiers to validated shardline_storage::ObjectKey values. It
avoids pulling in heavy server dependencies such as axum or sqlx.
§Quick start
Everything here is pure. The most common task is mapping an LFS object ID to a storage key:
use shardline_protocol_adapters::{LfsOperation, TransferAdapter, lfs_object_key};
use shardline_server_core::AuthorizedRepository;
let oid = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
let key = lfs_object_key(oid, &AuthorizedRepository::anonymous_full_access())?;
assert!(key.as_str().starts_with("protocols/lfs/global/objects/"));
assert!(key.as_str().ends_with(oid));
// Malformed OIDs are rejected instead of being stored under a bad key.
assert!(
lfs_object_key("not-a-valid-sha256", &AuthorizedRepository::anonymous_full_access())
.is_err()
);
// Batch operations and transfer adapters round-trip through their wire names.
assert_eq!("download".parse(), Ok(LfsOperation::Download));
assert_eq!(TransferAdapter::Xet.as_str(), "xet");See also bazel_cache_object_key for the Bazel HTTP cache mapping and
scope_namespace for repository-scoped key prefixes.
Modules§
- cas_
headers - Xet CAS transfer header names used in LFS batch responses and provider token-issuance flows. These tell the git-xet transfer agent where and how to connect to the content-addressed storage layer.
Structs§
Enums§
- Bazel
Cache Kind - LfsOperation
- LFS batch operation identifiers.
- LfsValidation
Error - Well-known LFS validation error messages.
- Protocol
Error - Protocol adapter error type.
- Transfer
Adapter - LFS transfer adapter identifiers negotiated in the batch API.
Constants§
Functions§
- bazel_
cache_ object_ key - Returns the storage object key for a Bazel cache entry.
- lfs_
object_ key - Returns the storage object key for an LFS object.
- object_
key - Maps a raw string to a validated
ObjectKey. - scope_
namespace - Produces a deterministic namespace prefix for a repository scope.
- validate_
content_ hash - Validates that
valueis exactly 64 lowercase hexadecimal characters.