The compactor combines several pack files together by including all objects contained in each pack file into the same output pack. If an object appears multiple times, it is only included once in the result. Because the new pack is constructed by enumerating the indexes of the source packs, it is quicker than doing a full repack of the repository, however the result is not nearly as space efficient as new delta compression is disabled.
This method is suitable for quickly combining several packs together after receiving a number of small fetch or push operations into a repository, allowing the system to maintain reasonable read performance without expending a lot of time repacking the entire repository.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private RevFlag | |
| private int | |
| private final List | |
| private RevFlag | |
| private PackStatistics | |
| private DfsPackDescription | |
| private ReftableConfig | |
| private final DfsRepository | |
| private RevWalk | |
| private final List | |
| private final List |
| Access | Constructor and Description |
|---|---|
| public | DfsPackCompactor(DfsRepository
repository objects to be packed will be read from. repository)Initialize a pack compactor. |
| Modifier and Type | Method and Description |
|---|---|
| public DfsPackCompactor | Returns: thisa pack to combine into the resulting pack. pack)Add a pack to be compacted. |
| public DfsPackCompactor | |
| private void | |
| public DfsPackCompactor | |
| public void | compact(ProgressMonitor
progress monitor to receive updates on as packing may take a
while, depending on the size of the repository. pm)Compact the pack files together. |
| private void | |
| private void | |
| pack-priv static ReftableConfig | |
| private long | |
| public DfsPackCompactor | Returns: this.objects to not include. set)Exclude objects from the compacted pack. |
| public DfsPackCompactor | Returns: this.objects to not include. pack)Exclude objects from the compacted pack. |
| public List | Returns: new packs created by this compaction.Get new packs created by this compaction. |
| public List | Returns: statistics corresponding to thegetNewPacks().Get statistics corresponding to the |
| public Collection | Returns: all of the source packs that fed into this compaction.Get all of the source packs that fed into this compaction. |
| private void | |
| public DfsPackCompactor | Returns: thisconfiguration to write a reftable. Reftable compacting is
disabled (default) when cfg)cfg is null.Set configuration to write a reftable. |
| private List | |
| private Collection | |
| private static void | |
| private static void | |
| private static void |
| added | back to summary |
|---|---|
| private RevFlag added | |
| autoAddSize | back to summary |
|---|---|
| private int autoAddSize | |
| exclude | back to summary |
|---|---|
| private final List<ObjectIdSet> exclude | |
| isBase | back to summary |
|---|---|
| private RevFlag isBase | |
| newStats | back to summary |
|---|---|
| private PackStatistics newStats | |
| outDesc | back to summary |
|---|---|
| private DfsPackDescription outDesc | |
| reftableConfig | back to summary |
|---|---|
| private ReftableConfig reftableConfig | |
| repo | back to summary |
|---|---|
| private final DfsRepository repo | |
| rw | back to summary |
|---|---|
| private RevWalk rw | |
| srcPacks | back to summary |
|---|---|
| private final List<DfsPackFile> srcPacks | |
| srcReftables | back to summary |
|---|---|
| private final List<DfsReftable> srcReftables | |
| DfsPackCompactor | back to summary |
|---|---|
| public DfsPackCompactor(DfsRepository repository) Initialize a pack compactor.
| |
| add | back to summary |
|---|---|
| public DfsPackCompactor add(DfsPackFile pack) Add a pack to be compacted. All of the objects in this pack will be copied into the resulting pack. The resulting pack will order objects according to the source pack's own description ordering (which is based on creation date), and then by the order the objects appear in the source pack.
| |
| add | back to summary |
|---|---|
| public DfsPackCompactor add(DfsReftable table) Add a reftable to be compacted.
| |
| addObjectsToPack | back to summary |
|---|---|
| private void addObjectsToPack(PackWriter pw, DfsReader ctx, ProgressMonitor pm) throws IOException, IncorrectObjectTypeException | |
| autoAdd | back to summary |
|---|---|
| public DfsPackCompactor autoAdd() throws IOException Automatically select pack and reftables to be included, and add them. Packs are selected based on size, smaller packs get included while bigger ones are omitted.
| |
| compact | back to summary |
|---|---|
| public void compact(ProgressMonitor pm) throws IOException Compact the pack files together.
| |
| compactPacks | back to summary |
|---|---|
| private void compactPacks(DfsReader ctx, ProgressMonitor pm) throws IOException, IncorrectObjectTypeException | |
| compactReftables | back to summary |
|---|---|
| private void compactReftables(DfsReader ctx) throws IOException | |
| configureReftable | back to summary |
|---|---|
| pack-priv static ReftableConfig configureReftable(ReftableConfig cfg, DfsOutputStream out) | |
| estimatePackSize | back to summary |
|---|---|
| private long estimatePackSize() | |
| exclude | back to summary |
|---|---|
| public DfsPackCompactor exclude(ObjectIdSet set) Exclude objects from the compacted pack.
| |
| exclude | back to summary |
|---|---|
| public DfsPackCompactor exclude(DfsPackFile pack) throws IOException Exclude objects from the compacted pack.
| |
| getNewPacks | back to summary |
|---|---|
| public List Get new packs created by this compaction.
| |
| getNewPackStatistics | back to summary |
|---|---|
| public List Get statistics corresponding to the
| |
| getSourcePacks | back to summary |
|---|---|
| public Collection Get all of the source packs that fed into this compaction.
| |
| initOutDesc | back to summary |
|---|---|
| private void initOutDesc(DfsObjDatabase objdb) throws IOException | |
| setReftableConfig | back to summary |
|---|---|
| public DfsPackCompactor setReftableConfig(ReftableConfig cfg) Set configuration to write a reftable.
| |
| toInclude | back to summary |
|---|---|
| private List | |
| toPrune | back to summary |
|---|---|
| private Collection | |
| writeIndex | back to summary |
|---|---|
| private static void writeIndex(DfsObjDatabase objdb, DfsPackDescription pack, PackWriter pw) throws IOException | |
| writeObjectSizeIndex | back to summary |
|---|---|
| private static void writeObjectSizeIndex(DfsObjDatabase objdb, DfsPackDescription pack, PackWriter pw) throws IOException | |
| writePack | back to summary |
|---|---|
| private static void writePack(DfsObjDatabase objdb, DfsPackDescription pack, PackWriter pw, ProgressMonitor pm) throws IOException | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| offset | back to summary |
|---|---|
| pack-priv final long offset | |
| ObjectIdWithOffset | back to summary |
|---|---|
| pack-priv ObjectIdWithOffset(AnyObjectId id, long ofs) | |