|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.jgit.transport.IndexPack
public class IndexPack
Indexes Git pack files for local use.
| Field Summary | |
|---|---|
static int |
BUFFER_SIZE
Size of the internal stream buffer. |
static java.lang.String |
PROGRESS_DOWNLOAD
Progress message when reading raw data from the pack. |
static java.lang.String |
PROGRESS_RESOLVE_DELTA
Progress message when computing names of delta compressed objects. |
| Constructor Summary | |
|---|---|
IndexPack(Repository db,
java.io.InputStream src,
java.io.File dstBase)
Create a new pack indexer utility. |
|
| Method Summary | |
|---|---|
static IndexPack |
create(Repository db,
java.io.InputStream is)
Create an index pack instance to load a new pack into a repository. |
void |
index(ProgressMonitor progress)
Consume data from the input stream until the packfile is indexed. |
void |
renameAndOpenPack()
Rename the pack to it's final name and location and open it. |
PackLock |
renameAndOpenPack(java.lang.String lockMessage)
Rename the pack to it's final name and location and open it. |
void |
setFixThin(boolean fix)
Configure this index pack instance to make a thin pack complete. |
void |
setIndexVersion(int version)
Set the pack index file format version this instance will create. |
void |
setKeepEmpty(boolean empty)
Configure this index pack instance to keep an empty pack. |
void |
setObjectChecker(ObjectChecker oc)
Configure the checker used to validate received objects. |
void |
setObjectChecking(boolean on)
Configure the checker used to validate received objects. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PROGRESS_DOWNLOAD
public static final java.lang.String PROGRESS_RESOLVE_DELTA
public static final int BUFFER_SIZE
If callers are going to be supplying IndexPack a BufferedInputStream they should use this buffer size as the size of the buffer for that BufferedInputStream, and any other its may be wrapping. This way the buffers will cascade efficiently and only the IndexPack buffer will be receiving the bulk of the data stream.
| Constructor Detail |
|---|
public IndexPack(Repository db,
java.io.InputStream src,
java.io.File dstBase)
throws java.io.IOException
db - src - stream to read the pack data from. If the stream is buffered
use BUFFER_SIZE as the buffer size for the stream.dstBase -
java.io.IOException - the output packfile could not be created.| Method Detail |
|---|
public static IndexPack create(Repository db,
java.io.InputStream is)
throws java.io.IOException
The received pack data and generated index will be saved to temporary
files within the repository's objects directory. To use the
data contained within them call renameAndOpenPack() once the
indexing is complete.
db - the repository that will receive the new pack.is - stream to read the pack data from. If the stream is buffered
use BUFFER_SIZE as the buffer size for the stream.
java.io.IOException - a temporary file could not be created.public void setIndexVersion(int version)
version - the version to write. The special version 0 designates the
oldest (most compatible) format available for the objects.PackIndexWriterpublic void setFixThin(boolean fix)
Thin packs are sometimes used during network transfers to allow a delta to be sent without a base object. Such packs are not permitted on disk. They can be fixed by copying the base object onto the end of the pack.
fix - true to enable fixing a thin pack.public void setKeepEmpty(boolean empty)
By default an empty pack (a pack with no objects) is not kept, as doing so is completely pointless. With no objects in the pack there is no data stored by it, so the pack is unnecessary.
empty - true to enable keeping an empty pack.public void setObjectChecker(ObjectChecker oc)
Usually object checking isn't necessary, as Git implementations only create valid objects in pack files. However, additional checking may be useful if processing data from an untrusted source.
oc - the checker instance; null to disable object checking.public void setObjectChecking(boolean on)
Usually object checking isn't necessary, as Git implementations only create valid objects in pack files. However, additional checking may be useful if processing data from an untrusted source.
This is shorthand for:
setObjectChecker(on ? new ObjectChecker() : null);
on - true to enable the default checker; false to disable it.
public void index(ProgressMonitor progress)
throws java.io.IOException
progress - progress feedback
java.io.IOException
public void renameAndOpenPack()
throws java.io.IOException
If the call completes successfully the repository this IndexPack instance was created with will have the objects in the pack available for reading and use, without needing to scan for packs.
java.io.IOException - The pack could not be inserted into the repository's objects
directory. The pack no longer exists on disk, as it was
removed prior to throwing the exception to the caller.
public PackLock renameAndOpenPack(java.lang.String lockMessage)
throws java.io.IOException
If the call completes successfully the repository this IndexPack instance was created with will have the objects in the pack available for reading and use, without needing to scan for packs.
lockMessage - message to place in the pack-*.keep file. If null, no lock
will be created, and this method returns null.
java.io.IOException - The pack could not be inserted into the repository's objects
directory. The pack no longer exists on disk, as it was
removed prior to throwing the exception to the caller.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||