Package org.eclipse.jgit.internal.ketch
Class LocalReplica
- java.lang.Object
-
- org.eclipse.jgit.internal.ketch.KetchReplica
-
- org.eclipse.jgit.internal.ketch.LocalReplica
-
public class LocalReplica extends KetchReplica
Ketch replica running on the same system as theKetchLeader.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jgit.internal.ketch.KetchReplica
KetchReplica.CommitMethod, KetchReplica.CommitSpeed, KetchReplica.Participation, KetchReplica.State, KetchReplica.WeakRetryPush
-
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.internal.ketch.KetchReplica
log
-
-
Constructor Summary
Constructors Constructor Description LocalReplica(KetchLeader leader, java.lang.String name, ReplicaConfig cfg)Configure a local replica.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidblockingFetch(Repository repo, ReplicaFetchRequest req)Fetch objects from the remote using the calling thread.private static voidcheckFailed(java.util.List<java.lang.String> failed, ReceiveCommand cmd)protected java.lang.StringdescribeForLog()Get description of this replica for error/debug logging purposes.(package private) voidinitialize(Repository repo)Initializes local replica by reading accepted and committed references.private booleanisOnlyTxnNamespace(java.util.Collection<ReceiveCommand> cmdList)protected voidstartPush(ReplicaPushRequest req)Begin executing a single push.private voidupdate(Repository git, ReplicaPushRequest req, ProposedTimestamp ts)-
Methods inherited from class org.eclipse.jgit.internal.ketch.KetchReplica
afterPush, canDelete, getCommitMethod, getCommitSpeed, getId, getLeader, getName, getParticipation, getSystem, getTxnAccepted, hasAccepted, initialize, prepareCommit, pushCommitAsync, pushTxnAcceptedAsync, shouldPushUnbatchedCommit, shutdown, snapshot
-
-
-
-
Constructor Detail
-
LocalReplica
public LocalReplica(KetchLeader leader, java.lang.String name, ReplicaConfig cfg)
Configure a local replica.- Parameters:
leader- instance this replica follows.name- unique-ish name identifying this replica for debugging.cfg- how Ketch should treat the local system.
-
-
Method Detail
-
describeForLog
protected java.lang.String describeForLog()
Get description of this replica for error/debug logging purposes.- Overrides:
describeForLogin classKetchReplica- Returns:
- description of this replica for error/debug logging purposes.
-
initialize
void initialize(Repository repo) throws java.io.IOException
Initializes local replica by reading accepted and committed references.Loads accepted and committed references from the reference database of the local replica and stores their current ObjectIds in memory.
- Parameters:
repo- repository to initialize state from.- Throws:
java.io.IOException- cannot read repository state.
-
startPush
protected void startPush(ReplicaPushRequest req)
Begin executing a single push.This method must move processing onto another thread. Called with
KetchLeader.lockheld by caller.- Specified by:
startPushin classKetchReplica- Parameters:
req- the request to send to the replica.
-
blockingFetch
protected void blockingFetch(Repository repo, ReplicaFetchRequest req) throws java.io.IOException
Fetch objects from the remote using the calling thread.Called without
KetchLeader.lock.- Specified by:
blockingFetchin classKetchReplica- Parameters:
repo- local repository to fetch objects into.req- the request to fetch from a replica.- Throws:
java.io.IOException- communication with the replica was not possible.
-
update
private void update(Repository git, ReplicaPushRequest req, ProposedTimestamp ts) throws java.io.IOException
- Throws:
java.io.IOException
-
checkFailed
private static void checkFailed(java.util.List<java.lang.String> failed, ReceiveCommand cmd)
-
isOnlyTxnNamespace
private boolean isOnlyTxnNamespace(java.util.Collection<ReceiveCommand> cmdList)
-
-