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

public Class CommitGraphWriter

extends Object
Class Inheritance
Static Imports
org.eclipse.jgit.internal.storage.commitgraph.CommitGraphConstants.CHUNK_ID_BLOOM_FILTER_DATA, .CommitGraphConstants.CHUNK_ID_BLOOM_FILTER_INDEX, .CommitGraphConstants.CHUNK_ID_COMMIT_DATA, .CommitGraphConstants.CHUNK_ID_EXTRA_EDGE_LIST, .CommitGraphConstants.CHUNK_ID_OID_FANOUT, .CommitGraphConstants.CHUNK_ID_OID_LOOKUP, .CommitGraphConstants.CHUNK_LOOKUP_WIDTH, .CommitGraphConstants.COMMIT_DATA_WIDTH, .CommitGraphConstants.COMMIT_GRAPH_MAGIC, .CommitGraphConstants.GRAPH_EXTRA_EDGES_NEEDED, .CommitGraphConstants.GRAPH_LAST_EDGE, .CommitGraphConstants.GRAPH_NO_PARENT, org.eclipse.jgit.lib.Constants.COMMIT_GENERATION_NOT_COMPUTED, .Constants.COMMIT_GENERATION_UNKNOWN, .Constants.OBJECT_ID_LENGTH

Writes a commit-graph formatted file.
Since
6.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
pack-priv static class
public static class
CommitGraphWriter.Stats

Statistics collected during a single commit graph write.

Field Summary

Modifier and TypeField and Description
private static final int
private final boolean
private static final int
private static final int
private final GraphCommits
private final int
private static final int
private static final int
private static final CommitGraphWriter.PathDiffCalculator

Constructor Summary

AccessConstructor and Description
public
CommitGraphWriter(GraphCommits
the commits which will be writen to the commit-graph.
graphCommits
)

Create commit-graph writer for these commits.

public
CommitGraphWriter(GraphCommits
the commits which will be writen to the commit-graph.
graphCommits
,
boolean
whether changed path filters are generated
generateChangedPathFilters
)

Create commit-graph writer for these commits.

Method Summary

Modifier and TypeMethod and Description
private static long
private CommitGraphWriter.BloomFilterChunks
private int[]
private static List<CommitGraphWriter.ChunkHeader>
private static List<CommitGraphWriter.ChunkHeader>
createCoreChunks(int hashsz, GraphCommits graphCommits)

public CommitGraphWriter.Stats

Returns:

statistics gathered during the run
write
(ProgressMonitor
progress monitor to report the number of items written.
monitor
,
OutputStream
output stream of commit-graph data. The stream should be buffered by the caller. The caller is responsible for closing the stream.
commitGraphStream
)

Write commit-graph to the supplied stream.

private void
private void
private void
private void
private void
private void
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COMMIT_GRAPH_VERSION_GENERATEDback to summary
private static final int COMMIT_GRAPH_VERSION_GENERATED
generateChangedPathFiltersback to summary
private final boolean generateChangedPathFilters
GENERATION_NUMBER_MAXback to summary
private static final int GENERATION_NUMBER_MAX
GRAPH_FANOUT_SIZEback to summary
private static final int GRAPH_FANOUT_SIZE
graphCommitsback to summary
private final GraphCommits graphCommits
hashszback to summary
private final int hashsz
MAX_CHANGED_PATHSback to summary
private static final int MAX_CHANGED_PATHS
OID_HASH_VERSIONback to summary
private static final int OID_HASH_VERSION
PATH_DIFF_CALCULATORback to summary
private static final CommitGraphWriter.PathDiffCalculator PATH_DIFF_CALCULATOR

Constructor Detail

CommitGraphWriterback to summary
public CommitGraphWriter(GraphCommits graphCommits)

Create commit-graph writer for these commits.

Parameters
graphCommits:GraphCommits

the commits which will be writen to the commit-graph.

CommitGraphWriterback to summary
public CommitGraphWriter(GraphCommits graphCommits, boolean generateChangedPathFilters)

Create commit-graph writer for these commits.

Parameters
graphCommits:GraphCommits

the commits which will be writen to the commit-graph.

generateChangedPathFilters:boolean

whether changed path filters are generated

Method Detail

calculateExpectedSizeback to summary
private static long calculateExpectedSize(List<CommitGraphWriter.ChunkHeader> chunks)
computeBloomFilterChunksback to summary
private CommitGraphWriter.BloomFilterChunks computeBloomFilterChunks(ProgressMonitor monitor) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException
computeGenerationNumbersback to summary
private int[] computeGenerationNumbers(ProgressMonitor monitor) throws MissingObjectException
createBloomFilterChunkHeadersback to summary
private static List<CommitGraphWriter.ChunkHeader> createBloomFilterChunkHeaders(CommitGraphWriter.BloomFilterChunks bloomFilterChunks)
createCoreChunksback to summary
private static List<CommitGraphWriter.ChunkHeader> createCoreChunks(int hashsz, GraphCommits graphCommits)
writeback to summary
public CommitGraphWriter.Stats write(ProgressMonitor monitor, OutputStream commitGraphStream) throws IOException

Write commit-graph to the supplied stream.

Parameters
monitor:ProgressMonitor

progress monitor to report the number of items written.

commitGraphStream:OutputStream

output stream of commit-graph data. The stream should be buffered by the caller. The caller is responsible for closing the stream.

Returns:CommitGraphWriter.Stats

statistics gathered during the run

Exceptions
IOException:
if an error occurred
writeCheckSumback to summary
private void writeCheckSum(CancellableDigestOutputStream out) throws IOException
writeChunkLookupback to summary
private void writeChunkLookup(CancellableDigestOutputStream out, List<CommitGraphWriter.ChunkHeader> chunks) throws IOException
writeChunksback to summary
private void writeChunks(CancellableDigestOutputStream out, List<CommitGraphWriter.ChunkHeader> chunks) throws IOException
writeCommitDataback to summary
private void writeCommitData(CancellableDigestOutputStream out) throws IOException
writeExtraEdgesback to summary
private void writeExtraEdges(CancellableDigestOutputStream out) throws IOException
writeFanoutTableback to summary
private void writeFanoutTable(CancellableDigestOutputStream out) throws IOException
writeHeaderback to summary
private void writeHeader(CancellableDigestOutputStream out, int numChunks) throws IOException
writeOidLookUpback to summary
private void writeOidLookUp(CancellableDigestOutputStream out) throws IOException
org.eclipse.jgit.internal.storage.commitgraph back to summary

private Class CommitGraphWriter.BloomFilterChunks

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.storage.commitgraph.CommitGraphWriter.BloomFilterChunks

Field Summary

Modifier and TypeField and Description
pack-priv final ByteArrayOutputStream
pack-priv final long
pack-priv final long
pack-priv final ByteArrayOutputStream

Constructor Summary

AccessConstructor and Description
pack-priv
BloomFilterChunks(ByteArrayOutputStream index, ByteArrayOutputStream data, long filtersReused, long filtersComputed)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
pack-priv final ByteArrayOutputStream data
filtersComputedback to summary
pack-priv final long filtersComputed
filtersReusedback to summary
pack-priv final long filtersReused
indexback to summary
pack-priv final ByteArrayOutputStream index

Constructor Detail

BloomFilterChunksback to summary
pack-priv BloomFilterChunks(ByteArrayOutputStream index, ByteArrayOutputStream data, long filtersReused, long filtersComputed)
org.eclipse.jgit.internal.storage.commitgraph back to summary

private Class CommitGraphWriter.ChunkHeader

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.storage.commitgraph.CommitGraphWriter.ChunkHeader

Field Summary

Modifier and TypeField and Description
pack-priv final Optional<ByteArrayOutputStream>
pack-priv final int
pack-priv final long

Constructor Summary

AccessConstructor and Description
public
ChunkHeader(int id, long size)

pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
pack-priv final Optional<ByteArrayOutputStream> data
idback to summary
pack-priv final int id
sizeback to summary
pack-priv final long size

Constructor Detail

ChunkHeaderback to summary
public ChunkHeader(int id, long size)
ChunkHeaderback to summary
pack-priv ChunkHeader(int id, ByteArrayOutputStream data)
org.eclipse.jgit.internal.storage.commitgraph back to summary

pack-priv Class CommitGraphWriter.PathDiffCalculator

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.storage.commitgraph.CommitGraphWriter.PathDiffCalculator

Field Summary

Modifier and TypeField and Description
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Optional<HashSet<ByteBuffer>>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

stepCounterback to summary
pack-priv int stepCounter

Constructor Detail

PathDiffCalculatorback to summary
pack-priv PathDiffCalculator()

Method Detail

changedPathsback to summary
pack-priv Optional<HashSet<ByteBuffer>> changedPaths(ObjectReader or, RevCommit cmit) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException
org.eclipse.jgit.internal.storage.commitgraph back to summary

public Class CommitGraphWriter.Stats

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.storage.commitgraph.CommitGraphWriter.Stats

Statistics collected during a single commit graph write.

Field Summary

Modifier and TypeField and Description
private long
private long
pack-priv static final CommitGraphWriter.Stats

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static final CommitGraphWriter.Stats
public long

Returns:

count of changed path filters
getChangedPathFiltersComputed
()

Returns the number of changed path filters that were computed from scratch, for statistical purposes.

public long

Returns:

count of changed path filters
getChangedPathFiltersReused
()

Returns the number of existing changed path filters that were reused when writing, for statistical purposes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

changedPathFiltersComputedback to summary
private long changedPathFiltersComputed
changedPathFiltersReusedback to summary
private long changedPathFiltersReused
EMPTYback to summary
pack-priv static final CommitGraphWriter.Stats EMPTY

Constructor Detail

Statsback to summary
private Stats()

Method Detail

fromback to summary
pack-priv static final CommitGraphWriter.Stats from(CommitGraphWriter.BloomFilterChunks bloomFilterChunks)
getChangedPathFiltersComputedback to summary
public long getChangedPathFiltersComputed()

Returns the number of changed path filters that were computed from scratch, for statistical purposes.

Returns:long

count of changed path filters

getChangedPathFiltersReusedback to summary
public long getChangedPathFiltersReused()

Returns the number of existing changed path filters that were reused when writing, for statistical purposes.

Returns:long

count of changed path filters