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 class
PackDirectory.PackList
-
Field Summary
Fields Modifier and Type Field Description private Config
config
private java.io.File
directory
private static org.slf4j.Logger
LOG
private static PackDirectory.PackList
NO_PACKS
private 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) void
close()
(package private) void
create()
private boolean
doLogExponentialBackoff(int n)
(package private) java.io.File
getDirectory()
Getter for the fielddirectory
.(package private) Pack
getPack(AnyObjectId objectId)
Get thePack
for 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) long
getSize(WindowCursor curs, AnyObjectId id)
private void
handlePackError(java.io.IOException e, Pack p)
(package private) boolean
has(AnyObjectId objectId)
Does the requested object exist in this PackDirectory?private static int
indexOf(Pack[] list, Pack pack)
(package private) void
insert(Pack pack)
(package private) ObjectLoader
open(WindowCursor curs, AnyObjectId objectId)
private void
remove(Pack deadPack)
(package private) boolean
resolve(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.PackList
scanPacks(PackDirectory.PackList original)
private PackDirectory.PackList
scanPacksImpl(PackDirectory.PackList old)
(package private) boolean
searchPacksAgain(PackDirectory.PackList old)
(package private) void
selectRepresentation(PackWriter packer, ObjectToPack otp, WindowCursor curs)
java.lang.String
toString()
-
-
-
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 thepack
directory.
-
-
Method Detail
-
getDirectory
java.io.File getDirectory()
Getter for the fielddirectory
.- Returns:
- the location of the
pack
directory.
-
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:
toString
in 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:
true
if the specified object is stored in this PackDirectory.
-
getPack
@Nullable Pack getPack(AnyObjectId objectId)
Get thePack
for the specified object if it is stored in this PackDirectory.- Parameters:
objectId
- identity of the object to find the Pack for.- Returns:
Pack
which contains the specified object ornull
if 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:
true
if 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)
-
-