public class LocalReplica extends KetchReplica
KetchLeader.KetchReplica.CommitMethod, KetchReplica.CommitSpeed, KetchReplica.Participation, KetchReplica.State, KetchReplica.WeakRetryPushlog| Constructor and Description |
|---|
LocalReplica(KetchLeader leader,
java.lang.String name,
ReplicaConfig cfg)
Configure a local replica.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
blockingFetch(Repository repo,
ReplicaFetchRequest req)
Fetch objects from the remote using the calling thread.
|
private static void |
checkFailed(java.util.List<java.lang.String> failed,
ReceiveCommand cmd) |
protected java.lang.String |
describeForLog()
Get description of this replica for error/debug logging purposes.
|
(package private) void |
initialize(Repository repo)
Initializes local replica by reading accepted and committed references.
|
private boolean |
isOnlyTxnNamespace(java.util.Collection<ReceiveCommand> cmdList) |
protected void |
startPush(ReplicaPushRequest req)
Begin executing a single push.
|
private void |
update(Repository git,
ReplicaPushRequest req,
ProposedTimestamp ts) |
afterPush, canDelete, getCommitMethod, getCommitSpeed, getId, getLeader, getName, getParticipation, getSystem, getTxnAccepted, hasAccepted, initialize, prepareCommit, pushCommitAsync, pushTxnAcceptedAsync, shouldPushUnbatchedCommit, shutdown, snapshotpublic LocalReplica(KetchLeader leader, java.lang.String name, ReplicaConfig cfg)
leader - instance this replica follows.name - unique-ish name identifying this replica for debugging.cfg - how Ketch should treat the local system.protected java.lang.String describeForLog()
describeForLog in class KetchReplicavoid initialize(Repository repo) throws java.io.IOException
Loads accepted and committed references from the reference database of the local replica and stores their current ObjectIds in memory.
repo - repository to initialize state from.java.io.IOException - cannot read repository state.protected void startPush(ReplicaPushRequest req)
This method must move processing onto another thread. Called with
KetchLeader.lock held by caller.
startPush in class KetchReplicareq - the request to send to the replica.protected void blockingFetch(Repository repo, ReplicaFetchRequest req) throws java.io.IOException
Called without KetchLeader.lock.
blockingFetch in class KetchReplicarepo - local repository to fetch objects into.req - the request to fetch from a replica.java.io.IOException - communication with the replica was not possible.private void update(Repository git, ReplicaPushRequest req, ProposedTimestamp ts) throws java.io.IOException
java.io.IOExceptionprivate static void checkFailed(java.util.List<java.lang.String> failed,
ReceiveCommand cmd)
private boolean isOnlyTxnNamespace(java.util.Collection<ReceiveCommand> cmdList)