Package org.eclipse.jgit.internal.ketch
Class StageBuilder
- java.lang.Object
-
- org.eclipse.jgit.internal.ketch.StageBuilder
-
public class StageBuilder extends Object
Constructs a set of commands to stage content during a proposal.
-
-
Constructor Summary
Constructors Constructor Description StageBuilder(String txnStageNamespace, ObjectId txnId)
Construct a stage builder for a transaction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ReceiveCommand>
makeStageList(Set<ObjectId> newObjs, Repository git, ObjectInserter inserter)
Construct a set of commands to stage objects on a replica.List<ReceiveCommand>
makeStageList(Repository git, ObjectId oldTree, ObjectId newTree)
Compare two RefTrees and return commands to stage new objects.
-
-
-
Method Detail
-
makeStageList
public List<ReceiveCommand> makeStageList(Repository git, ObjectId oldTree, ObjectId newTree) throws IOException
Compare two RefTrees and return commands to stage new objects.This method ignores the lineage between the two RefTrees and does a straight diff on the two trees. New objects will be staged. The diff strategy is useful to catch-up a lagging replica, without sending every intermediate step. This may mean the replica does not have the same object set as other replicas if there are rewinds or branch deletes.
- Parameters:
git
- source repository to readoldTree
andnewTree
from.oldTree
- accepted RefTree on the replica (refs/txn/accepted
). UseObjectId.zeroId()
if the remote does not have any ref tree, e.g. a new replica catching up.newTree
- RefTree being sent to the replica. The trees will be compared.- Returns:
- list of commands to create
"refs/txn/stage/..."
references on replicas anchoring new objects into the repository while a transaction gains consensus. - Throws:
IOException
-git
cannot be accessed to compareoldTree
andnewTree
to build the object set.
-
makeStageList
public List<ReceiveCommand> makeStageList(Set<ObjectId> newObjs, @Nullable Repository git, @Nullable ObjectInserter inserter) throws IOException
Construct a set of commands to stage objects on a replica.- Parameters:
newObjs
- objects to send to a replica.git
- local repository to read source objects from. Required to perform minification ofnewObjs
.inserter
- inserter to write temporary commit objects during minification if many new branches are created bynewObjs
.- Returns:
- list of commands to create
"refs/txn/stage/..."
references on replicas anchoringnewObjs
into the repository while a transaction gains consensus. - Throws:
IOException
-git
cannot be accessed to perform minification ofnewObjs
.
-
-