Table of Contents

Class PackIndex

Namespace
Fenrir.Git
Assembly
Fenrir.Git.dll

Type to store, cache and access information about Git pack files.

This type is thread-safe.

[CompilationMapping(SourceConstructFlags.ObjectType)]
public class PackIndex
Inheritance
PackIndex
Inherited Members

Remarks

This type is optimized for two scenarios:

  1. One-time usage (read-and-forget), for scenarios involving reading one object only. To target these scenarios, we make sure to not read all the indices ahead of time if they might not be used for an operation.
  2. Multi-read usage (cache), for a scenario involving prolonged use (e.g., indexing of the whole repository). To target such scenarios, we allow reading and storing the fanout tables of all the pack index files at once.

Constructors

PackIndex(Lifetime, LocalPath)

Creates a pack index cached for the designated repository.

public PackIndex(Lifetime lifetime, LocalPath gitDir)

Parameters

lifetime Lifetime

Lifetime of the cache. No file access will be performed after the lifetime's termination.

gitDir LocalPath

Path to the .git directory of a repository.

Methods

FindPackOfObject(Sha1Hash)

Searches an object with hash among the pack files included in the index.

public Task<PackedObjectLocation?> FindPackOfObject(Sha1Hash hash)

Parameters

hash Sha1Hash

Hash of the searched object.

Returns

Task<PackedObjectLocation?>

Path to a pack file containing the object.