RefDirectory.
This is intended to be short-term write-through snapshot based cache used in a request scope to avoid re-reading packed-refs on each read and to avoid refreshing paths to a loose ref that has already been refreshed.
Only use this class when concurrent writes from other requests (not using the same instance of SnapshottingRefDirectory) generally need not be visible to the current request. The exception to this is when such writes would cause writes from this snapshot to fail due to their base ref value being outdated.
| Modifier and Type | Class and Description |
|---|---|
| private static interface | |
| private static class | |
| private static class | |
| private static class | |
| private static interface | |
| private static interface |
| Modifier and Type | Field and Description |
|---|---|
| private volatile boolean | |
| pack-priv final RefDirectory | |
| private final Set |
| Access | Constructor and Description |
|---|---|
| pack-priv | SnapshottingRefDirectory(RefDirectory
a reference to the ref database refDb)Create a snapshotting write-through cache of a |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv RefDirectoryRename | |
| pack-priv RefDirectoryUpdate | |
| pack-priv void | |
| pack-priv RefDirectory. | getPackedRefs()
Overrides org. Lazily initializes and returns a PackedRefList snapshot. |
| pack-priv synchronized void | |
| private static <T> T | |
| private static <A, R> R | |
| private static <A1, A2, A3> void | invalidateSnapshotOnError(SnapshottingRefDirectory.
|
| public PackedBatchRefUpdate | newBatchUpdate()
Overrides org. Create a new batch update to attempt on this database. |
| public PackedBatchRefUpdate | newBatchUpdate(boolean
whether loose refs should be locked during the batch ref
update. Note that this should only be set to shouldLockLooseRefs)false if
the application using this ensures that no other ref updates
run concurrently to avoid lost updates caused by a race. In
such cases it can improve performance.Overrides org. Create a new batch update to attempt on this database. |
| pack-priv RefDirectoryUpdate | newTemporaryUpdate()
Overrides org. Create a reference update to write a temporary reference. |
| public RefDirectoryUpdate | newUpdate(String
the name of the reference. name, boolean if detach)true and name is currently a
org., the update will
replace it with an org..
Otherwise, the update will recursively traverse
org.s and operate on the
leaf org..Overrides org. Create a new update command to create, modify or delete a reference. |
| pack-priv void | refreshPathToLooseRef(Path
path of a loose ref relative to the repository root refPath)Overrides org. Workaround for issues caused by NFS caching. |
| private synchronized void |
| isValid | back to summary |
|---|---|
| private volatile boolean isValid | |
| refDb | back to summary |
|---|---|
| pack-priv final RefDirectory refDb | |
| refreshedLooseRefDirs | back to summary |
|---|---|
| private final Set<File> refreshedLooseRefDirs | |
| SnapshottingRefDirectory | back to summary |
|---|---|
| pack-priv SnapshottingRefDirectory(RefDirectory refDb) Create a snapshotting write-through cache of a
| |
| createRefDirectoryRename | back to summary |
|---|---|
| pack-priv RefDirectoryRename createRefDirectoryRename(RefDirectoryUpdate from, RefDirectoryUpdate to) Overrides org.
| |
| createRefDirectoryUpdate | back to summary |
|---|---|
| pack-priv RefDirectoryUpdate createRefDirectoryUpdate(Ref ref) Overrides org.
| |
| delete | back to summary |
|---|---|
| pack-priv void delete(RefDirectoryUpdate update) throws IOException Overrides org.
| |
| getPackedRefs | back to summary |
|---|---|
| pack-priv RefDirectory. Overrides org. Lazily initializes and returns a PackedRefList snapshot.
A newer snapshot will be returned when a ref update is performed using
this
| |
| invalidateSnapshot | back to summary |
|---|---|
| pack-priv synchronized void invalidateSnapshot() | |
| invalidateSnapshotOnError | back to summary |
|---|---|
| private static <T> T invalidateSnapshotOnError(SnapshottingRefDirectory. | |
| invalidateSnapshotOnError | back to summary |
|---|---|
| private static <A, R> R invalidateSnapshotOnError(SnapshottingRefDirectory. | |
| invalidateSnapshotOnError | back to summary |
|---|---|
| private static <A1, A2, A3> void invalidateSnapshotOnError(SnapshottingRefDirectory. | |
| newBatchUpdate | back to summary |
|---|---|
| public PackedBatchRefUpdate newBatchUpdate() Overrides org. Doc from org. Create a new batch update to attempt on this database. The default implementation performs a sequential update of each command.
| |
| newBatchUpdate | back to summary |
|---|---|
| public PackedBatchRefUpdate newBatchUpdate(boolean shouldLockLooseRefs) Overrides org. Doc from org. Create a new batch update to attempt on this database.
| |
| newTemporaryUpdate | back to summary |
|---|---|
| pack-priv RefDirectoryUpdate newTemporaryUpdate() throws IOException Overrides org. Doc from org. Create a reference update to write a temporary reference.
| |
| newUpdate | back to summary |
|---|---|
| public RefDirectoryUpdate newUpdate(String name, boolean detach) throws IOException Overrides org. Doc from org. Create a new update command to create, modify or delete a reference.
| |
| refreshPathToLooseRef | back to summary |
|---|---|
| pack-priv void refreshPathToLooseRef(Path refPath) Overrides org. Doc from org. Workaround for issues caused by NFS caching. Refresh directories starting from the repository root to a loose ref by opening an input stream. This refreshes file attributes of the loose ref (at least on some NFS clients). | |
| refreshSnapshot | back to summary |
|---|---|
| private synchronized void refreshSnapshot() throws IOException Refresh our snapshot by calling the underlying RefDirectory's getPackedRefs(). Update the in-memory copy of the underlying RefDirectory's packed-refs to avoid the overhead of re-reading packed-refs on each new snapshot as the packed-refs of the underlying RefDirectory may not get updated if most threads use this snapshot.
| |
| Modifier and Type | Method and Description |
|---|---|
| public R |
| apply | back to summary |
|---|---|
| public R apply(A a) throws FunctionThrowsException:E | |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | execute(RevWalk
a RevWalk to parse tags in case the storage system wants to
store them pre-peeled, a common performance optimization. walk, ProgressMonitor progress monitor to receive update status on. monitor, List<String> a list of option strings; set null to execute without options)Overrides org. Execute this batch update. |
| public void | execute(RevWalk
a RevWalk to parse tags in case the storage system wants to
store them pre-peeled, a common performance optimization. walk, ProgressMonitor progress monitor to receive update status on. monitor)Overrides org. Execute this batch update without option strings. |
| public SnapshottingRefDirectory | getRefDatabase()
Overrides org. Get the ref database associated with this update. |
| SnapshotPackedBatchRefUpdate | back to summary |
|---|---|
| pack-priv SnapshotPackedBatchRefUpdate(RefDirectory refDb) | |
| SnapshotPackedBatchRefUpdate | back to summary |
|---|---|
| pack-priv SnapshotPackedBatchRefUpdate(RefDirectory refDb, boolean shouldLockLooseRefs) | |
| execute | back to summary |
|---|---|
| public void execute(RevWalk walk, ProgressMonitor monitor, List<String> options) throws IOException Overrides org. Doc from org. Execute this batch update. The default implementation of this method performs a sequential reference update over each reference.
Implementations must respect the atomicity requirements of the underlying
database as described in
| |
| execute | back to summary |
|---|---|
| public void execute(RevWalk walk, ProgressMonitor monitor) throws IOException Overrides org. Doc from org. Execute this batch update without option strings.
| |
| getRefDatabase | back to summary |
|---|---|
| public SnapshottingRefDirectory getRefDatabase() Overrides org. Doc from org. Get the ref database associated with this update.
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public SnapshottingRefDirectory | getRefDirectory()
Overrides org. Get the ref directory associated with this rename. |
| public RefUpdate. |
| SnapshotRefDirectoryRename | back to summary |
|---|---|
| pack-priv SnapshotRefDirectoryRename(RefDirectoryUpdate src, RefDirectoryUpdate dst) | |
| getRefDirectory | back to summary |
|---|---|
| public SnapshottingRefDirectory getRefDirectory() Overrides org. Doc from org. Get the ref directory associated with this rename.
| |
| rename | back to summary |
|---|---|
| public RefUpdate. Overrides org. Doc from org. Rename
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public RefUpdate. | |
| public RefUpdate. | delete(RevWalk
a RevWalk instance this delete command can borrow to perform
the merge test. The walk will be reset to perform the test. walk)Overrides org. Delete the ref. |
| protected void | doAfterLocking(String
the name of the reference. name)Overrides org. Invalidate the SnapshottingRefDirectory snapshot after locking the ref. |
| public RefUpdate. | forceUpdate()
Overrides org. Force the ref to take the new value. |
| public SnapshottingRefDirectory | getRefDatabase()
Overrides org. Get the reference database this update modifies. |
| public RefUpdate. | link(String
name of the new target for this reference. The new target name
must be absolute, so it must begin with target)refs/.Overrides org. Replace this reference with a symbolic reference to another reference. |
| public RefUpdate. | update()
Overrides org. Gracefully update the ref to the new value. |
| public RefUpdate. | update(RevWalk
a RevWalk instance this update command can borrow to perform
the merge test. The walk will be reset to perform the test. walk)Overrides org. Gracefully update the ref to the new value. |
| SnapshotRefDirectoryUpdate | back to summary |
|---|---|
| pack-priv SnapshotRefDirectoryUpdate(RefDirectory r, Ref ref) | |
| delete | back to summary |
|---|---|
| public RefUpdate. Overrides org. Doc from org. Delete the ref. This is the same as: return delete(new RevWalk(getRepository()));
| |
| delete | back to summary |
|---|---|
| public RefUpdate. Overrides org. Doc from org. Delete the ref.
| |
| doAfterLocking | back to summary |
|---|---|
| protected void doAfterLocking(String name) Overrides org. Invalidate the SnapshottingRefDirectory snapshot after locking the ref. Doing this after locking the ref ensures that the upcoming write is not based on a cached value. | |
| forceUpdate | back to summary |
|---|---|
| public RefUpdate. Overrides org. Doc from org. Force the ref to take the new value. This is just a convenient helper for setting the force flag, and as such the merge test is performed.
| |
| getRefDatabase | back to summary |
|---|---|
| public SnapshottingRefDirectory getRefDatabase() Overrides org. Doc from org. Get the reference database this update modifies.
| |
| link | back to summary |
|---|---|
| public RefUpdate. Overrides org. Doc from org. Replace this reference with a symbolic reference to another reference. This exact reference (not its traversed leaf) is replaced with a symbolic reference to the requested name.
| |
| update | back to summary |
|---|---|
| public RefUpdate. Overrides org. Doc from org. Gracefully update the ref to the new value.
Merge test will be performed according to This is the same as: return update(new RevWalk(getRepository()));
| |
| update | back to summary |
|---|---|
| public RefUpdate. Overrides org. Doc from org. Gracefully update the ref to the new value.
Merge test will be performed according to
| |
| Modifier and Type | Method and Description |
|---|---|
| public R |
| call | back to summary |
|---|---|
| public R call() throws SupplierThrowsException:E | |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| accept | back to summary |
|---|---|
| public void accept(A1 a1, A2 a2, A3 a3) throws TriConsumerThrowsException:E | |