Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.storage.file

pack-priv Class PackDirectory

extends Object
Class Inheritance
Static Imports
org.eclipse.jgit.internal.storage.pack.PackExt.BITMAP_INDEX, .PackExt.INDEX, .PackExt.PACK

Traditional file system packed objects directory handler.

This is the org.eclipse.jgit.internal.storage.file.Packs object representation for a Git object database, where objects are stored in compressed containers known as org.eclipse.jgit.internal.storage.file.Packs.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final Config
private final File
private static final Logger
private static final int
private static final PackDirectory.PackList
private final AtomicReference<PackDirectory.PackList>
private final CoreConfig.TrustStat

Constructor Summary

AccessConstructor and Description
pack-priv
PackDirectory(Config
configuration this directory consults for write settings.
config
,
File
the location of the pack directory.
directory
)

Initialize a reference to an on-disk 'pack' directory.

Method Summary

Modifier and TypeMethod and Description
private int
pack-priv void
pack-priv void
private boolean

Returns:

true if i is a power of 2
doLogExponentialBackoff
(int
count of consecutive failures
n
)

pack-priv File

Returns:

the location of the pack directory.
getDirectory
()

Getter for the field directory.

pack-priv Pack

Returns:

org.eclipse.jgit.internal.storage.file.Pack which contains the specified object or null if it is not stored in this PackDirectory.
getPack
(AnyObjectId
identity of the object to find the Pack for.
objectId
)

Get the org.eclipse.jgit.internal.storage.file.Pack for the specified object if it is stored in this PackDirectory.

private Map<String, Map<PackExt, PackFile>>
getPackFilesByExtById()

Scans the pack directory for org.eclipse.jgit.internal.storage.file.PackFiles and returns them organized by their extensions and their pack ids Skips files in the directory that we cannot create a org.eclipse.jgit.internal.storage.file.PackFile for.

pack-priv Collection<Pack>
pack-priv long
private void
pack-priv boolean

Returns:

true if the specified object is stored in this PackDirectory.
has
(AnyObjectId
identity of the object to test for existence of.
objectId
)

Does the requested object exist in this PackDirectory?

private static int
indexOf(Pack[] list, Pack pack)

pack-priv void
insert(Pack pack)

pack-priv ObjectLoader
open(WindowCursor curs, AnyObjectId objectId)

private void
remove(Pack deadPack)

pack-priv boolean

Returns:

true if the matches were exhausted before reaching maxLimit.
resolve
(Set<ObjectId>
set to add any located ObjectIds to. This is an output parameter.
matches
,
AbbreviatedObjectId
prefix to search for.
id
,
int
maximum number of results to return. At most this many ObjectIds should be added to matches before returning.
matchLimit
)

Find objects matching the prefix abbreviation.

private static Map<String, Pack>
private PackDirectory.PackList
private PackDirectory.PackList
pack-priv boolean
pack-priv void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

configback to summary
private final Config config
directoryback to summary
private final File directory
LOGback to summary
private static final Logger LOG
MAX_PACKLIST_RESCAN_ATTEMPTSback to summary
private static final int MAX_PACKLIST_RESCAN_ATTEMPTS
NO_PACKSback to summary
private static final PackDirectory.PackList NO_PACKS
packListback to summary
private final AtomicReference<PackDirectory.PackList> packList
trustPackStatback to summary
private final CoreConfig.TrustStat trustPackStat

Constructor Detail

PackDirectoryback to summary
pack-priv PackDirectory(Config config, File directory)

Initialize a reference to an on-disk 'pack' directory.

Parameters
config:Config

configuration this directory consults for write settings.

directory:File

the location of the pack directory.

Method Detail

checkRescanPackThresholdback to summary
private int checkRescanPackThreshold(int retries, PackMismatchException e) throws PackMismatchException
closeback to summary
pack-priv void close()
createback to summary
pack-priv void create() throws IOException
doLogExponentialBackoffback to summary
private boolean doLogExponentialBackoff(int n)
Parameters
n:int

count of consecutive failures

Returns:boolean

true if i is a power of 2

getDirectoryback to summary
pack-priv File getDirectory()

Getter for the field directory.

Returns:File

the location of the pack directory.

getPackback to summary
pack-priv Pack getPack(AnyObjectId objectId)

Get the org.eclipse.jgit.internal.storage.file.Pack for the specified object if it is stored in this PackDirectory.

Parameters
objectId:AnyObjectId

identity of the object to find the Pack for.

Returns:Pack

org.eclipse.jgit.internal.storage.file.Pack which contains the specified object or null if it is not stored in this PackDirectory.

Annotations
@Nullable
getPackFilesByExtByIdback to summary
private Map<String, Map<PackExt, PackFile>> getPackFilesByExtById()

Scans the pack directory for org.eclipse.jgit.internal.storage.file.PackFiles and returns them organized by their extensions and their pack ids Skips files in the directory that we cannot create a org.eclipse.jgit.internal.storage.file.PackFile for.

Returns:Map<String, Map<PackExt, PackFile>>

a map of org.eclipse.jgit.internal.storage.file.PackFiles and org.eclipse.jgit.internal.storage.pack.PackExts keyed by pack ids

getPacksback to summary
pack-priv Collection<Pack> getPacks()
getSizeback to summary
pack-priv long getSize(WindowCursor curs, AnyObjectId id) throws PackMismatchException
handlePackErrorback to summary
private void handlePackError(IOException e, Pack p)
hasback to summary
pack-priv boolean has(AnyObjectId objectId)

Does the requested object exist in this PackDirectory?

Parameters
objectId:AnyObjectId

identity of the object to test for existence of.

Returns:boolean

true if the specified object is stored in this PackDirectory.

indexOfback to summary
private static int indexOf(Pack[] list, Pack pack)
insertback to summary
pack-priv void insert(Pack pack)
openback to summary
pack-priv ObjectLoader open(WindowCursor curs, AnyObjectId objectId) throws PackMismatchException
removeback to summary
private void remove(Pack deadPack)
resolveback to summary
pack-priv boolean resolve(Set<ObjectId> matches, AbbreviatedObjectId id, int matchLimit)

Find objects matching the prefix abbreviation.

Parameters
matches:Set<ObjectId>

set to add any located ObjectIds to. This is an output parameter.

id:AbbreviatedObjectId

prefix to search for.

matchLimit:int

maximum number of results to return. At most this many ObjectIds should be added to matches before returning.

Returns:boolean

true if the matches were exhausted before reaching maxLimit.

reuseMapback to summary
private static Map<String, Pack> reuseMap(PackDirectory.PackList old)
scanPacksback to summary
private PackDirectory.PackList scanPacks(PackDirectory.PackList original)
scanPacksImplback to summary
private PackDirectory.PackList scanPacksImpl(PackDirectory.PackList old)
searchPacksAgainback to summary
pack-priv boolean searchPacksAgain(PackDirectory.PackList old)
selectRepresentationback to summary
pack-priv void selectRepresentation(PackWriter packer, ObjectToPack otp, WindowCursor curs) throws PackMismatchException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jgit.internal.storage.file back to summary

pack-priv final Class PackDirectory.PackList

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.storage.file.PackDirectory.PackList

Field Summary

Modifier and TypeField and Description
pack-priv final Pack[]
packs

All known packs, sorted by Pack#SORT.

pack-priv final FileSnapshot
snapshot

State just before reading the pack directory.

Constructor Summary

AccessConstructor and Description
pack-priv
PackList(FileSnapshot monitor, Pack[] packs)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

packsback to summary
pack-priv final Pack[] packs

All known packs, sorted by Pack#SORT.

snapshotback to summary
pack-priv final FileSnapshot snapshot

State just before reading the pack directory.

Constructor Detail

PackListback to summary
pack-priv PackList(FileSnapshot monitor, Pack[] packs)