Package org.eclipse.jgit.internal.ketch
Class ReplicaPushRequest
- java.lang.Object
-
- org.eclipse.jgit.internal.ketch.ReplicaPushRequest
-
public class ReplicaPushRequest extends java.lang.Object
A push request sending objects to a replica, and its result.Implementors of
KetchReplica
must populate the command result fields,setRefs(Map)
, and call one ofsetException(Repository, Throwable)
ordone(Repository)
to finish processing.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<ReceiveCommand>
commands
private java.lang.Throwable
exception
private boolean
notified
private java.util.Map<java.lang.String,Ref>
refs
private KetchReplica
replica
-
Constructor Summary
Constructors Constructor Description ReplicaPushRequest(KetchReplica replica, java.util.Collection<ReceiveCommand> commands)
Construct a new push request for a replica.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
describe(java.lang.String heading)
void
done(Repository repo)
Mark the request as completed without exception.java.util.Collection<ReceiveCommand>
getCommands()
Get commands to be executed, and their results.java.lang.Throwable
getException()
Get exception thrown, if any.java.util.Map<java.lang.String,Ref>
getRefs()
Get remote references, usually from the advertisement.void
setException(Repository repo, java.lang.Throwable err)
Mark the request as crashing with a communication error.void
setRefs(java.util.Map<java.lang.String,Ref> refs)
Set references observed from the replica.
-
-
-
Field Detail
-
replica
private final KetchReplica replica
-
commands
private final java.util.Collection<ReceiveCommand> commands
-
refs
private java.util.Map<java.lang.String,Ref> refs
-
exception
private java.lang.Throwable exception
-
notified
private boolean notified
-
-
Constructor Detail
-
ReplicaPushRequest
public ReplicaPushRequest(KetchReplica replica, java.util.Collection<ReceiveCommand> commands)
Construct a new push request for a replica.- Parameters:
replica
- the replica being pushed to.commands
- commands to be executed.
-
-
Method Detail
-
getCommands
public java.util.Collection<ReceiveCommand> getCommands()
Get commands to be executed, and their results.- Returns:
- commands to be executed, and their results.
-
getRefs
@Nullable public java.util.Map<java.lang.String,Ref> getRefs()
Get remote references, usually from the advertisement.- Returns:
- remote references, usually from the advertisement.
-
setRefs
public void setRefs(java.util.Map<java.lang.String,Ref> refs)
Set references observed from the replica.- Parameters:
refs
- references observed from the replica.
-
getException
@Nullable public java.lang.Throwable getException()
Get exception thrown, if any.- Returns:
- exception thrown, if any.
-
setException
public void setException(@Nullable Repository repo, java.lang.Throwable err)
Mark the request as crashing with a communication error.This method may take significant time acquiring the leader lock and updating the Ketch state machine with the failure.
- Parameters:
repo
- local repository reference used by the push attempt.err
- exception thrown during communication.
-
done
public void done(Repository repo)
Mark the request as completed without exception.This method may take significant time acquiring the leader lock and updating the Ketch state machine with results from this replica.
- Parameters:
repo
- local repository reference used by the push attempt.
-
describe
private java.lang.String describe(java.lang.String heading)
-
-