Reference range backend for an atomically published local directory.
A store contains immutable packs/pack-<checksum>.pack and .idx files
plus manifest.json. The manifest is replaced atomically only after all
content-addressed artifacts are present. read_ranges/2 uses positional
reads and never shares or advances a mutable file offset.
publish/2 captures every object the repository stores — packed and
loose, reachable or not; it never garbage-collects. Existing packs are
copied as-is. When loose objects exist, it feeds their complete object-ID
list to the configured Git executable's pack-objects plumbing, adding
that new pack beside the existing packs in the published manifest.
Publication follows objects/info/alternates transitively; a missing
alternate objects directory is a loud error rather than an incomplete
published store.
Packing loose objects briefly stages a temporary directory below the
source repository's objects/ directory so Git can rename its output on
the same filesystem; the directory is always removed afterward. A source
that cannot create this staging directory returns
{:error, :source_repository_read_only}.
:ok =
Gitility.ODB.RangeBackend.LocalDirectory.publish(
"/srv/git/project.git",
"/srv/gitility/project-packs"
)
{:ok, supervisor} =
Gitility.ODB.PackFetch.start_link(
backend: {Gitility.ODB.RangeBackend.LocalDirectory,
"/srv/gitility/project-packs"},
into: {:dir, "/var/cache/gitility/project"}
)
Summary
Functions
Publishes the pack inventory of a local repository into destination.
Functions
Publishes the pack inventory of a local repository into destination.
Pack and index files are written through same-directory temporary files;
manifest.json is the final atomic rename. Existing source packs are never
repacked. The optional :git_executable application environment setting
(Application.put_env(:gitility, :git_executable, …)) selects the Git
executable used only when loose objects need packing.