Skip to main content

Crate git_remote_object_store

Crate git_remote_object_store 

Source
Expand description

git-remote-object-store — a Rust library and CLI for storing Git repositories in cloud object stores (AWS S3 and Azure Blob Storage).

§Library usage

This crate provides the Remote struct as the primary entry point for library consumers. It wraps an ObjectStore backend together with the repository-level key prefix, so you can read and write objects in the project’s on-bucket format without tracking these separately:

use git_remote_object_store::Remote;

let remote = Remote::connect("s3+https://my-bucket.s3.us-east-1.amazonaws.com/my-repo").await?;
let head = remote.get_head().await?;
println!("{}", String::from_utf8_lossy(&head));

See remote for the full key layout and API documentation.

§Direct file access (packchain remotes only)

read_blob returns the bytes of a single file at a ref’s tip without cloning the repo. The companion PackIndexCache amortises pack-index parses across calls — long-running consumers (CI agents, build systems) keep one cache for the lifetime of the process.

use git_remote_object_store::{PackIndexCache, Remote, read_blob};

let remote = Remote::connect("s3+https://bucket/repo?engine=packchain").await?;
let cache = PackIndexCache::default();
let bytes = read_blob(&remote, "refs/heads/main", "src/main.rs", &cache).await?;
println!("{}", String::from_utf8_lossy(&bytes));

§CLI

The binaries (git-remote-s3-https, git-remote-az-https, etc.) are packaged in the companion git-remote-object-store-cli crate under cli/. Build and install with cargo install --path cli.

§Architecture

This crate ships two backends behind one shared ObjectStore trait — AWS S3 (and S3-compatible endpoints) and Azure Blob Storage. The on-bucket key layout, locking semantics, helper- protocol behaviour, and management-CLI shape are this project’s own decisions; the only external contracts are the git helper-protocol, the LFS protocol, and the cloud-provider HTTP APIs.

Re-exports§

pub use object_store::BoxError;
pub use object_store::GetOpts;
pub use object_store::ObjectMeta;
pub use object_store::ObjectStore;
pub use object_store::ObjectStoreError;
pub use object_store::ProgressSink;
pub use object_store::PutOpts;
pub use packchain::PackIndexCache;
pub use packchain::PackchainError;
pub use packchain::read_blob;
pub use protocol::backend::BackendError;
pub use protocol::backend::BackendKind;
pub use remote::Remote;
pub use remote::RemoteError;
pub use url::RemoteUrl;
pub use url::StorageEngine;

Modules§

git
Native git operations layered on top of gix.
lfs
LFS custom-transfer agent (line-oriented JSON protocol).
manage
Management CLI: doctor, delete-branch, protect, unprotect.
object_store
Backend-neutral object-store trait shared by the S3 and Azure Blob implementations.
packchain
Incremental pack-chain storage engine (issue #52).
protocol
Git remote-helper protocol REPL and command dispatcher.
remote
High-level handle to a git-remote-object-store repository.
url
Parser for the s3+https / s3+http / az+https / az+http URL grammar.