Package org.eclipse.jgit.internal.ketch
Class RemoteGitReplica
- java.lang.Object
-
- org.eclipse.jgit.internal.ketch.KetchReplica
-
- org.eclipse.jgit.internal.ketch.RemoteGitReplica
-
public class RemoteGitReplica extends KetchReplica
Representation of a Git repository on a remote replica system.KetchLeader
will contact the replica using the Git wire protocol.The remote replica may be fully Ketch-aware, or a standard Git server.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
RemoteGitReplica.RemoteCommand
-
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 Modifier and Type Field Description private RemoteConfig
remoteConfig
private URIish
uri
-
Fields inherited from class org.eclipse.jgit.internal.ketch.KetchReplica
log
-
-
Constructor Summary
Constructors Constructor Description RemoteGitReplica(KetchLeader leader, java.lang.String name, URIish uri, ReplicaConfig cfg, RemoteConfig rc)
Configure a new remote.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
abort(java.util.List<RemoteGitReplica.RemoteCommand> cmds)
private static java.util.List<RemoteGitReplica.RemoteCommand>
asUpdateList(java.util.Collection<ReceiveCommand> cmds)
private static java.util.Map<java.lang.String,RemoteRefUpdate>
asUpdateMap(java.util.List<RemoteGitReplica.RemoteCommand> cmds)
protected void
blockingFetch(Repository repo, ReplicaFetchRequest req)
Fetch objects from the remote using the calling thread.protected java.lang.String
describeForLog()
Get description of this replica for error/debug logging purposes.private void
fetch(Transport transport, ReplicaFetchRequest req)
protected RemoteConfig
getRemoteConfig()
Get optional configuration describing how to contact the peer.URIish
getURI()
Get URI to contact the remote peer repository.private static boolean
isExpectedValue(java.util.Map<java.lang.String,Ref> adv, RemoteRefUpdate u)
private void
prepareCommit(Repository git, java.util.List<RemoteGitReplica.RemoteCommand> cmds, java.util.Map<java.lang.String,RemoteRefUpdate> updates, java.util.Map<java.lang.String,Ref> adv, ObjectId committed)
private void
push(Repository repo, ReplicaPushRequest req)
private java.util.Map<java.lang.String,Ref>
push(Repository git, Transport transport, java.util.List<RemoteGitReplica.RemoteCommand> cmds)
protected void
startPush(ReplicaPushRequest req)
Begin executing a single push.-
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
-
-
-
-
Field Detail
-
uri
private final URIish uri
-
remoteConfig
private final RemoteConfig remoteConfig
-
-
Constructor Detail
-
RemoteGitReplica
public RemoteGitReplica(KetchLeader leader, java.lang.String name, URIish uri, ReplicaConfig cfg, @Nullable RemoteConfig rc)
Configure a new remote.- Parameters:
leader
- instance this replica follows.name
- unique-ish name identifying this remote for debugging.uri
- URI to connect to the follower's repository.cfg
- how Ketch should treat the remote system.rc
- optional remote configuration describing how to contact the peer repository.
-
-
Method Detail
-
getURI
public URIish getURI()
Get URI to contact the remote peer repository.- Returns:
- URI to contact the remote peer repository.
-
getRemoteConfig
@Nullable protected RemoteConfig getRemoteConfig()
Get optional configuration describing how to contact the peer.- Returns:
- optional configuration describing how to contact the peer.
-
describeForLog
protected java.lang.String describeForLog()
Get description of this replica for error/debug logging purposes.- Overrides:
describeForLog
in classKetchReplica
- Returns:
- description of this replica for error/debug logging purposes.
-
startPush
protected void startPush(ReplicaPushRequest req)
Begin executing a single push.This method must move processing onto another thread. Called with
KetchLeader.lock
held by caller.- Specified by:
startPush
in classKetchReplica
- Parameters:
req
- the request to send to the replica.
-
push
private void push(Repository repo, ReplicaPushRequest req) throws NotSupportedException, TransportException, java.io.IOException
- Throws:
NotSupportedException
TransportException
java.io.IOException
-
push
private java.util.Map<java.lang.String,Ref> push(Repository git, Transport transport, java.util.List<RemoteGitReplica.RemoteCommand> cmds) throws java.io.IOException
- Throws:
java.io.IOException
-
isExpectedValue
private static boolean isExpectedValue(java.util.Map<java.lang.String,Ref> adv, RemoteRefUpdate u)
-
prepareCommit
private void prepareCommit(Repository git, java.util.List<RemoteGitReplica.RemoteCommand> cmds, java.util.Map<java.lang.String,RemoteRefUpdate> updates, java.util.Map<java.lang.String,Ref> adv, ObjectId committed) throws java.io.IOException
- Throws:
java.io.IOException
-
asUpdateList
private static java.util.List<RemoteGitReplica.RemoteCommand> asUpdateList(java.util.Collection<ReceiveCommand> cmds)
-
asUpdateMap
private static java.util.Map<java.lang.String,RemoteRefUpdate> asUpdateMap(java.util.List<RemoteGitReplica.RemoteCommand> cmds)
-
abort
private static void abort(java.util.List<RemoteGitReplica.RemoteCommand> cmds)
-
blockingFetch
protected void blockingFetch(Repository repo, ReplicaFetchRequest req) throws NotSupportedException, TransportException
Fetch objects from the remote using the calling thread.Called without
KetchLeader.lock
.- Specified by:
blockingFetch
in classKetchReplica
- Parameters:
repo
- local repository to fetch objects into.req
- the request to fetch from a replica.- Throws:
NotSupportedException
TransportException
-
fetch
private void fetch(Transport transport, ReplicaFetchRequest req) throws NotSupportedException, TransportException
-
-