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

public Class MergedReftable

extends Reftable
Class Inheritance
Imports
java.io.IOException, java.util.ArrayList, .List, .PriorityQueue, org.eclipse.jgit.lib.AnyObjectId, .Ref, .ReflogEntry

Merges multiple reference tables together.

A org.eclipse.jgit.internal.storage.reftable.MergedReftable merge-joins multiple org.eclipse.jgit.internal.storage.reftable.ReftableReader on the fly. Tables higher/later in the stack shadow lower/earlier tables, hiding references that been updated/replaced.

By default deleted references are skipped and not returned to the caller. setIncludeDeletes(boolean) can be used to modify this behavior if the caller needs to preserve deletions during partial compaction.

A MergedReftable is not thread-safe.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class
private class
private class
private static class

Field Summary

Modifier and TypeField and Description
private final ReftableReader[]
Inherited from org.eclipse.jgit.internal.storage.reftable.Reftable:
includeDeletes

Constructor Summary

AccessConstructor and Description
public
MergedReftable(List<ReftableReader>
stack of tables to read from. The base of the stack is at index 0, the most recent should be at the top of the stack at tableStack.size() - 1. The top of the stack (higher index) shadows the base of the stack (lower index).
tableStack
)

Initialize a merged table reader.

Method Summary

Modifier and TypeMethod and Description
public LogCursor
allLogs()

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.allLogs.

Seek reader to read log records.

public RefCursor
allRefs()

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.allRefs.

Seek to the first reference, to iterate in order.

public RefCursor
byObjectId(AnyObjectId
object to find.
name
)

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.byObjectId.

Match references pointing to a specific object.

public boolean
hasObjectMap()

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.hasObjectMap.

Whether this reftable can do a fast SHA1 => ref lookup

public long
maxUpdateIndex()

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.maxUpdateIndex.

Get the maximum update index for ref entries that appear in this reftable.

public long
minUpdateIndex()

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.minUpdateIndex.

Get the minimum update index for ref entries that appear in this reftable.

pack-priv int
public LogCursor
seekLog(String
exact name of the reference whose log to read.
refName
,
long
most recent index to return first in the log cursor. Log records at or before updateIndex will be returned.
updateIdx
)

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.seekLog.

Seek to an update index in a reference's log.

public RefCursor
seekRef(String
reference name.
name
)

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.seekRef.

Seek to a reference.

public RefCursor
seekRefsWithPrefix(String
prefix to find.
prefix
)

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.seekRefsWithPrefix.

Seek references with prefix.

Inherited from org.eclipse.jgit.internal.storage.reftable.Reftable:
exactReffromhasIdhasRefhasRefsWithPrefixresolveseekLogsetIncludeDeletes

Field Detail

tablesback to summary
private final ReftableReader[] tables

Constructor Detail

MergedReftableback to summary
public MergedReftable(List<ReftableReader> tableStack)

Initialize a merged table reader.

Parameters
tableStack:List<ReftableReader>

stack of tables to read from. The base of the stack is at index 0, the most recent should be at the top of the stack at tableStack.size() - 1. The top of the stack (higher index) shadows the base of the stack (lower index).

Method Detail

allLogsback to summary
public LogCursor allLogs() throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.allLogs.

Doc from org.eclipse.jgit.internal.storage.reftable.Reftable.allLogs.

Seek reader to read log records.

Returns:LogCursor

cursor to iterate; empty cursor if no logs are present.

Annotations
@Override
Exceptions
IOException:
if logs cannot be read.
allRefsback to summary
public RefCursor allRefs() throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.allRefs.

Doc from org.eclipse.jgit.internal.storage.reftable.Reftable.allRefs.

Seek to the first reference, to iterate in order.

Returns:RefCursor

cursor to iterate.

Annotations
@Override
Exceptions
IOException:
if references cannot be read.
byObjectIdback to summary
public RefCursor byObjectId(AnyObjectId name) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.byObjectId.

Doc from org.eclipse.jgit.internal.storage.reftable.Reftable.byObjectId.

Match references pointing to a specific object.

Parameters
name:AnyObjectId

object to find.

Returns:RefCursor

cursor to iterate; empty cursor if no references match.

Annotations
@Override
Exceptions
IOException:
if references cannot be read.
hasObjectMapback to summary
public boolean hasObjectMap() throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.hasObjectMap.

Doc from org.eclipse.jgit.internal.storage.reftable.Reftable.hasObjectMap.

Whether this reftable can do a fast SHA1 => ref lookup

Returns:boolean

whether this reftable can do a fast SHA1 => ref lookup.

Annotations
@Override
Exceptions
IOException:
on I/O problems.
maxUpdateIndexback to summary
public long maxUpdateIndex() throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.maxUpdateIndex.

Doc from org.eclipse.jgit.internal.storage.reftable.Reftable.maxUpdateIndex.

Get the maximum update index for ref entries that appear in this reftable.

Returns:long

the maximum update index for ref entries that appear in this reftable.

Annotations
@Override
Exceptions
IOException:
file cannot be read.
minUpdateIndexback to summary
public long minUpdateIndex() throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.minUpdateIndex.

Doc from org.eclipse.jgit.internal.storage.reftable.Reftable.minUpdateIndex.

Get the minimum update index for ref entries that appear in this reftable.

Returns:long

the minimum update index for ref entries that appear in this reftable.

Annotations
@Override
Exceptions
IOException:
file cannot be read.
queueSizeback to summary
pack-priv int queueSize()
seekLogback to summary
public LogCursor seekLog(String refName, long updateIdx) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.seekLog.

Doc from org.eclipse.jgit.internal.storage.reftable.Reftable.seekLog.

Seek to an update index in a reference's log.

Parameters
refName:String

exact name of the reference whose log to read.

updateIdx:long

most recent index to return first in the log cursor. Log records at or before updateIndex will be returned.

Returns:LogCursor

cursor to iterate; empty cursor if no logs match.

Annotations
@Override
Exceptions
IOException:
if logs cannot be read.
seekRefback to summary
public RefCursor seekRef(String name) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.seekRef.

Doc from org.eclipse.jgit.internal.storage.reftable.Reftable.seekRef.

Seek to a reference.

This method will seek to the reference refName. If present, the returned cursor will iterate exactly one entry. If not found, an empty cursor is returned.

Parameters
name:String

reference name.

Returns:RefCursor

cursor to iterate; empty cursor if no references match.

Annotations
@Override
Exceptions
IOException:
if references cannot be read.
seekRefsWithPrefixback to summary
public RefCursor seekRefsWithPrefix(String prefix) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.Reftable.seekRefsWithPrefix.

Doc from org.eclipse.jgit.internal.storage.reftable.Reftable.seekRefsWithPrefix.

Seek references with prefix.

The method will seek all the references starting with prefix as a prefix. If no references start with this prefix, an empty cursor is returned.

Parameters
prefix:String

prefix to find.

Returns:RefCursor

cursor to iterate; empty cursor if no references match.

Annotations
@Override
Exceptions
IOException:
if references cannot be read.
org.eclipse.jgit.internal.storage.reftable back to summary

private Class MergedReftable.FilteringMergedRefCursor

extends MergedRefCursor
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv Ref
pack-priv final AnyObjectId

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Ref
public boolean
next()

Overrides org.eclipse.jgit.internal.storage.reftable.MergedReftable.MergedRefCursor.next.

Check if another reference is available.

Inherited from org.eclipse.jgit.internal.storage.reftable.MergedReftable.MergedRefCursor:
addcloseseekPastPrefix

Field Detail

filteredRefback to summary
pack-priv Ref filteredRef
filterIdback to summary
pack-priv final AnyObjectId filterId

Constructor Detail

FilteringMergedRefCursorback to summary
pack-priv FilteringMergedRefCursor(AnyObjectId id)

Method Detail

getRefback to summary
public Ref getRef()

Overrides org.eclipse.jgit.internal.storage.reftable.MergedReftable.MergedRefCursor.getRef.

Doc from org.eclipse.jgit.internal.storage.reftable.RefCursor.getRef.

Get reference at the current position.

Returns:Ref

reference at the current position.

Annotations
@Override
nextback to summary
public boolean next() throws IOException

Overrides org.eclipse.jgit.internal.storage.reftable.MergedReftable.MergedRefCursor.next.

Doc from org.eclipse.jgit.internal.storage.reftable.RefCursor.next.

Check if another reference is available.

Returns:boolean

true if there is another result.

Annotations
@Override
Exceptions
IOException:
references cannot be read.
org.eclipse.jgit.internal.storage.reftable back to summary

private Class MergedReftable.LogQueueEntry

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.storage.reftable.MergedReftable.LogQueueEntry

Field Summary

Modifier and TypeField and Description
pack-priv final LogCursor
pack-priv final int

Constructor Summary

AccessConstructor and Description
pack-priv
LogQueueEntry(LogCursor lc, int stackIdx)

Method Summary

Modifier and TypeMethod and Description
pack-priv static int
pack-priv long
pack-priv String
name()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lcback to summary
pack-priv final LogCursor lc
stackIdxback to summary
pack-priv final int stackIdx

Constructor Detail

LogQueueEntryback to summary
pack-priv LogQueueEntry(LogCursor lc, int stackIdx)

Method Detail

compareback to summary
pack-priv static int compare(MergedReftable.LogQueueEntry a, MergedReftable.LogQueueEntry b)
indexback to summary
pack-priv long index()
nameback to summary
pack-priv String name()
org.eclipse.jgit.internal.storage.reftable back to summary

private Class MergedReftable.MergedLogCursor

extends LogCursor
Class Inheritance

Field Summary

Modifier and TypeField and Description
private ReflogEntry
private final PriorityQueue<MergedReftable.LogQueueEntry>
private String
private long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public void
close()

Implements abstract org.eclipse.jgit.internal.storage.reftable.LogCursor.close.

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public ReflogEntry
public String
getRefName()

Implements abstract org.eclipse.jgit.internal.storage.reftable.LogCursor.getRefName.

Get name of the current reference.

public long
getUpdateIndex()

Implements abstract org.eclipse.jgit.internal.storage.reftable.LogCursor.getUpdateIndex.

Get identifier of the transaction that created the log record.

public boolean
next()

Implements abstract org.eclipse.jgit.internal.storage.reftable.LogCursor.next.

Check if another log record is available.

private void
skipShadowed(String name, long index)

Field Detail

entryback to summary
private ReflogEntry entry
queueback to summary
private final PriorityQueue<MergedReftable.LogQueueEntry> queue
refNameback to summary
private String refName
updateIndexback to summary
private long updateIndex

Constructor Detail

MergedLogCursorback to summary
pack-priv MergedLogCursor()

Method Detail

addback to summary
pack-priv void add(MergedReftable.LogQueueEntry t) throws IOException
closeback to summary
public void close()

Implements abstract org.eclipse.jgit.internal.storage.reftable.LogCursor.close.

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
getReflogEntryback to summary
public ReflogEntry getReflogEntry()

Implements abstract org.eclipse.jgit.internal.storage.reftable.LogCursor.getReflogEntry.

Doc from org.eclipse.jgit.internal.storage.reftable.LogCursor.getReflogEntry.

Get current log entry.

Returns:ReflogEntry

current log entry. Maybe null if we are producing deletions.

Annotations
@Override
getRefNameback to summary
public String getRefName()

Implements abstract org.eclipse.jgit.internal.storage.reftable.LogCursor.getRefName.

Doc from org.eclipse.jgit.internal.storage.reftable.LogCursor.getRefName.

Get name of the current reference.

Returns:String

name of the current reference.

Annotations
@Override
getUpdateIndexback to summary
public long getUpdateIndex()

Implements abstract org.eclipse.jgit.internal.storage.reftable.LogCursor.getUpdateIndex.

Doc from org.eclipse.jgit.internal.storage.reftable.LogCursor.getUpdateIndex.

Get identifier of the transaction that created the log record.

Returns:long

identifier of the transaction that created the log record.

Annotations
@Override
nextback to summary
public boolean next() throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.LogCursor.next.

Doc from org.eclipse.jgit.internal.storage.reftable.LogCursor.next.

Check if another log record is available.

Returns:boolean

true if there is another result.

Annotations
@Override
Exceptions
IOException:
logs cannot be read.
skipShadowedback to summary
private void skipShadowed(String name, long index) throws IOException
org.eclipse.jgit.internal.storage.reftable back to summary

private Class MergedReftable.MergedRefCursor

extends RefCursor
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.internal.storage.reftable.MergedReftable.FilteringMergedRefCursor

Field Summary

Modifier and TypeField and Description
private MergedReftable.RefQueueEntry
private final PriorityQueue<MergedReftable.RefQueueEntry>
private Ref

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
public void
close()

Implements abstract org.eclipse.jgit.internal.storage.reftable.RefCursor.close.

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

public Ref
getRef()

Implements abstract org.eclipse.jgit.internal.storage.reftable.RefCursor.getRef.

Get reference at the current position.

public boolean
next()

Implements abstract org.eclipse.jgit.internal.storage.reftable.RefCursor.next.

Check if another reference is available.

private MergedReftable.RefQueueEntry
poll()

public void
seekPastPrefix(String
prefix that should be skipped. All previous refs before it will be skipped.
prefixName
)

Implements abstract org.eclipse.jgit.internal.storage.reftable.RefCursor.seekPastPrefix.

Seeks forward to the first ref record lexicographically beyond prefixName that doesn't start with prefixName.

private void
Inherited from org.eclipse.jgit.internal.storage.reftable.RefCursor:
wasDeleted

Field Detail

headback to summary
private MergedReftable.RefQueueEntry head
queueback to summary
private final PriorityQueue<MergedReftable.RefQueueEntry> queue
refback to summary
private Ref ref

Constructor Detail

MergedRefCursorback to summary
pack-priv MergedRefCursor()

Method Detail

addback to summary
pack-priv void add(MergedReftable.RefQueueEntry t) throws IOException
closeback to summary
public void close()

Implements abstract org.eclipse.jgit.internal.storage.reftable.RefCursor.close.

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
getRefback to summary
public Ref getRef()

Implements abstract org.eclipse.jgit.internal.storage.reftable.RefCursor.getRef.

Doc from org.eclipse.jgit.internal.storage.reftable.RefCursor.getRef.

Get reference at the current position.

Returns:Ref

reference at the current position.

Annotations
@Override
nextback to summary
public boolean next() throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.RefCursor.next.

Doc from org.eclipse.jgit.internal.storage.reftable.RefCursor.next.

Check if another reference is available.

Returns:boolean

true if there is another result.

Annotations
@Override
Exceptions
IOException:
references cannot be read.
pollback to summary
private MergedReftable.RefQueueEntry poll()
seekPastPrefixback to summary
public void seekPastPrefix(String prefixName) throws IOException

Implements abstract org.eclipse.jgit.internal.storage.reftable.RefCursor.seekPastPrefix.

Doc from org.eclipse.jgit.internal.storage.reftable.RefCursor.seekPastPrefix.

Seeks forward to the first ref record lexicographically beyond prefixName that doesn't start with prefixName. If there are no more results, skipping some refs won't add new results. E.g if we create a RefCursor that returns only results with a specific prefix, skipping that prefix won't give results that are not part of the original prefix.

Parameters
prefixName:String

prefix that should be skipped. All previous refs before it will be skipped.

Annotations
@Override
Exceptions
IOException:
references cannot be read.
skipShadowedRefsback to summary
private void skipShadowedRefs(String name) throws IOException
org.eclipse.jgit.internal.storage.reftable back to summary

private Class MergedReftable.RefQueueEntry

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.storage.reftable.MergedReftable.RefQueueEntry

Field Summary

Modifier and TypeField and Description
pack-priv final RefCursor
pack-priv final int

Constructor Summary

AccessConstructor and Description
pack-priv
RefQueueEntry(RefCursor rc, int stackIdx)

Method Summary

Modifier and TypeMethod and Description
pack-priv static int
pack-priv String
name()

pack-priv long
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rcback to summary
pack-priv final RefCursor rc
stackIdxback to summary
pack-priv final int stackIdx

Constructor Detail

RefQueueEntryback to summary
pack-priv RefQueueEntry(RefCursor rc, int stackIdx)

Method Detail

compareback to summary
pack-priv static int compare(MergedReftable.RefQueueEntry a, MergedReftable.RefQueueEntry b)
nameback to summary
pack-priv String name()
updateIndexback to summary
pack-priv long updateIndex()