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.KetchLeaderwill 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 classRemoteGitReplica.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 RemoteConfigremoteConfigprivate URIishuri-
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 voidabort(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 voidblockingFetch(Repository repo, ReplicaFetchRequest req)Fetch objects from the remote using the calling thread.protected java.lang.StringdescribeForLog()Get description of this replica for error/debug logging purposes.private voidfetch(Transport transport, ReplicaFetchRequest req)protected RemoteConfiggetRemoteConfig()Get optional configuration describing how to contact the peer.URIishgetURI()Get URI to contact the remote peer repository.private static booleanisExpectedValue(java.util.Map<java.lang.String,Ref> adv, RemoteRefUpdate u)private voidprepareCommit(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 voidpush(Repository repo, ReplicaPushRequest req)private java.util.Map<java.lang.String,Ref>push(Repository git, Transport transport, java.util.List<RemoteGitReplica.RemoteCommand> cmds)protected voidstartPush(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:
describeForLogin 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.lockheld by caller.- Specified by:
startPushin 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:
NotSupportedExceptionTransportExceptionjava.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:
blockingFetchin classKetchReplica- Parameters:
repo- local repository to fetch objects into.req- the request to fetch from a replica.- Throws:
NotSupportedExceptionTransportException
-
fetch
private void fetch(Transport transport, ReplicaFetchRequest req) throws NotSupportedException, TransportException
-
-