Class PackDirectory
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.file.PackDirectory
-
class PackDirectory extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classPackDirectory.PackList
-
Field Summary
Fields Modifier and Type Field Description private Configconfigprivate java.io.Filedirectoryprivate static org.slf4j.LoggerLOGprivate static PackDirectory.PackListNO_PACKSprivate java.util.concurrent.atomic.AtomicReference<PackDirectory.PackList>packList
-
Constructor Summary
Constructors Constructor Description PackDirectory(Config config, java.io.File directory)Initialize a reference to an on-disk 'pack' directory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidclose()(package private) voidcreate()private booleandoLogExponentialBackoff(int n)(package private) java.io.FilegetDirectory()Getter for the fielddirectory.(package private) PackgetPack(AnyObjectId objectId)Get thePackfor the specified object if it is stored in this PackDirectory.private java.util.Map<java.lang.String,java.util.Map<PackExt,PackFile>>getPackFilesByExtById()(package private) java.util.Collection<Pack>getPacks()(package private) longgetSize(WindowCursor curs, AnyObjectId id)private voidhandlePackError(java.io.IOException e, Pack p)(package private) booleanhas(AnyObjectId objectId)Does the requested object exist in this PackDirectory?private static intindexOf(Pack[] list, Pack pack)(package private) voidinsert(Pack pack)(package private) ObjectLoaderopen(WindowCursor curs, AnyObjectId objectId)private voidremove(Pack deadPack)(package private) booleanresolve(java.util.Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit)Find objects matching the prefix abbreviation.private static java.util.Map<java.lang.String,Pack>reuseMap(PackDirectory.PackList old)private PackDirectory.PackListscanPacks(PackDirectory.PackList original)private PackDirectory.PackListscanPacksImpl(PackDirectory.PackList old)(package private) booleansearchPacksAgain(PackDirectory.PackList old)(package private) voidselectRepresentation(PackWriter packer, ObjectToPack otp, WindowCursor curs)java.lang.StringtoString()
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
NO_PACKS
private static final PackDirectory.PackList NO_PACKS
-
config
private final Config config
-
directory
private final java.io.File directory
-
packList
private final java.util.concurrent.atomic.AtomicReference<PackDirectory.PackList> packList
-
-
Constructor Detail
-
PackDirectory
PackDirectory(Config config, java.io.File directory)
Initialize a reference to an on-disk 'pack' directory.- Parameters:
config- configuration this directory consults for write settings.directory- the location of thepackdirectory.
-
-
Method Detail
-
getDirectory
java.io.File getDirectory()
Getter for the fielddirectory.- Returns:
- the location of the
packdirectory.
-
create
void create() throws java.io.IOException- Throws:
java.io.IOException
-
close
void close()
-
getPacks
java.util.Collection<Pack> getPacks()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
has
boolean has(AnyObjectId objectId)
Does the requested object exist in this PackDirectory?- Parameters:
objectId- identity of the object to test for existence of.- Returns:
trueif the specified object is stored in this PackDirectory.
-
getPack
@Nullable Pack getPack(AnyObjectId objectId)
Get thePackfor the specified object if it is stored in this PackDirectory.- Parameters:
objectId- identity of the object to find the Pack for.- Returns:
Packwhich contains the specified object ornullif it is not stored in this PackDirectory.
-
resolve
boolean resolve(java.util.Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit)
Find objects matching the prefix abbreviation.- Parameters:
matches- set to add any located ObjectIds to. This is an output parameter.id- prefix to search for.matchLimit- maximum number of results to return. At most this many ObjectIds should be added to matches before returning.- Returns:
trueif the matches were exhausted before reachingmaxLimit.
-
open
ObjectLoader open(WindowCursor curs, AnyObjectId objectId)
-
getSize
long getSize(WindowCursor curs, AnyObjectId id)
-
selectRepresentation
void selectRepresentation(PackWriter packer, ObjectToPack otp, WindowCursor curs)
-
handlePackError
private void handlePackError(java.io.IOException e, Pack p)
-
doLogExponentialBackoff
private boolean doLogExponentialBackoff(int n)
- Parameters:
n- count of consecutive failures- Returns:
-
searchPacksAgain
boolean searchPacksAgain(PackDirectory.PackList old)
-
insert
void insert(Pack pack)
-
remove
private void remove(Pack deadPack)
-
scanPacks
private PackDirectory.PackList scanPacks(PackDirectory.PackList original)
-
scanPacksImpl
private PackDirectory.PackList scanPacksImpl(PackDirectory.PackList old)
-
reuseMap
private static java.util.Map<java.lang.String,Pack> reuseMap(PackDirectory.PackList old)
-
-