Class PackIndex
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:
- 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.
- 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
LifetimeLifetime of the cache. No file access will be performed after the lifetime's termination.
gitDir
LocalPathPath 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
Sha1HashHash of the searched object.
Returns
- Task<PackedObjectLocation?>
Path to a pack file containing the object.