Declared in | GITPackIndex.h |
---|
The
class cluster provides access to the PACK index files for looking up SHA1 object hashes when extracting GIT Objects from PACK files.GITPackIndex
Current features of the PACK Index object include;
Parsing of the Fan Out Table
Locating SHA1 entries in the Index
+ (id)packIndexWithPath:(NSString *)indexPath error:(NSError **)error
Path to the index file
NSError
describing the error that occurred
autoreleased index file object or nil on error
Creates an autoreleased Index file object with the specified path.
GITPackIndex
.h
- (id)initWithPath:(NSString *)indexPath error:(NSError **)error
Path to the index file
NSError
describing the error that occurred
index file object or nil on error
Initialise the Index file with the provided path.
GITPackIndex
.h
- (id)initWithData:(NSData *)indexData error:(NSError **)error
index file object or nil on error
Initialise the Index file with the provided data.
GITPackIndex
.h
- (NSUInteger)version
Integer version of the index file
Returns the version of the index file.
GITPackIndex
.h
- (NSArray *)fanoutTable
contents of the receivers fanout table or nil if an error occurred
Returns the contents of the receivers fanout table.
GITPackIndex
.h
- (NSArray *)fanoutTable:(NSError **)error
NSError
describing the error which occurred
contents of the receivers fanout table or nil if an error occurred
Returns the contents of the receivers fanout table.
The fanout table consists of one entry per byte value (0-255). The entry value indicates the number of SHA1 hashes stored in the Index file which have a first byte which is less than or equal to the entry index. The contents of the fanout table are used to determine a bounding box of index positions within the main index table in which a SHA1 index entry will exist.
If the offset fanout table is corrupted a GITPackIndexErrorCorrupt NSError
will be returned through the passed error.
GITPackIndex
.h
- (NSUInteger)numberOfObjects
number of objects stored in the PACK file
Returns the number of objects stored in the PACK file.
GITPackIndex
.h
- (NSUInteger)indexOfSha1:(GITObjectHash *)objectHash
Object hash to find the index of
index position of the entry in the main index table
Returns the index position of the entry for the object has in the main index table.
Uses a binary search of the main index table bounded by the range given by the fanout table.
GITPackIndex
.h
- (off_t)packOffsetAtIndex:(NSUInteger)idx
Index position of the offset to retrieve
the offset from the entry at the specified index position
Returns the offset from the entry in the index table at the specified idx.
GITPackIndex
.h
- (off_t)packOffsetForSha1:(GITObjectHash *)objectHash
Object hash to find the PACK offset of
the PACK offset where data of the object can be retrieved or NSNotFound on error
Returns the offset in the PACK file where the object data can be retrieved.
GITPackIndex
.h
- (off_t)packOffsetForSha1:(GITObjectHash *)objectHash error:(NSError **)error
Object hash to find the PACK offset of
NSError
describing the error which occurred
the PACK offset where data of the object can be retrieved or NSNotFound on error
Returns the offset in the PACK file where the object data can be retrieved.
If the object cannot be found in the Index file then a GITPackErrorObjectNotFound
error is returned via the error argument.
GITPackIndex
.h
- (GITFanoutEntry)fanoutEntryForShasStartingWithByte:(uint8_t)byte
The byte corresponding to the fanout entry
A fanout entry for the SHA starting with the specified byte
Returns a fanout entry for SHA starting with the specified byte.
GITPackIndex
.h
Last updated: 2011-2-20