|
|
@ -71,7 +71,7 @@ public final class FetchV2Request { |
|
|
|
|
|
|
|
|
|
|
|
private final int shallowSince; |
|
|
|
private final int shallowSince; |
|
|
|
|
|
|
|
|
|
|
|
private final List<String> shallowExcludeRefs; |
|
|
|
private final List<String> deepenNotRefs; |
|
|
|
|
|
|
|
|
|
|
|
private final int depth; |
|
|
|
private final int depth; |
|
|
|
|
|
|
|
|
|
|
@ -79,19 +79,22 @@ public final class FetchV2Request { |
|
|
|
|
|
|
|
|
|
|
|
private final Set<String> options; |
|
|
|
private final Set<String> options; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final boolean doneReceived; |
|
|
|
|
|
|
|
|
|
|
|
private FetchV2Request(List<ObjectId> peerHas, |
|
|
|
private FetchV2Request(List<ObjectId> peerHas, |
|
|
|
TreeMap<String, ObjectId> wantedRefs, Set<ObjectId> wantsIds, |
|
|
|
TreeMap<String, ObjectId> wantedRefs, Set<ObjectId> wantsIds, |
|
|
|
Set<ObjectId> clientShallowCommits, int shallowSince, |
|
|
|
Set<ObjectId> clientShallowCommits, int shallowSince, |
|
|
|
List<String> shallowExcludeRefs, int depth, long filterBlobLimit, |
|
|
|
List<String> deependNotRefs, int depth, long filterBlobLimit, |
|
|
|
Set<String> options) { |
|
|
|
boolean doneReceived, Set<String> options) { |
|
|
|
this.peerHas = peerHas; |
|
|
|
this.peerHas = peerHas; |
|
|
|
this.wantedRefs = wantedRefs; |
|
|
|
this.wantedRefs = wantedRefs; |
|
|
|
this.wantsIds = wantsIds; |
|
|
|
this.wantsIds = wantsIds; |
|
|
|
this.clientShallowCommits = clientShallowCommits; |
|
|
|
this.clientShallowCommits = clientShallowCommits; |
|
|
|
this.shallowSince = shallowSince; |
|
|
|
this.shallowSince = shallowSince; |
|
|
|
this.shallowExcludeRefs = shallowExcludeRefs; |
|
|
|
this.deepenNotRefs = deependNotRefs; |
|
|
|
this.depth = depth; |
|
|
|
this.depth = depth; |
|
|
|
this.filterBlobLimit = filterBlobLimit; |
|
|
|
this.filterBlobLimit = filterBlobLimit; |
|
|
|
|
|
|
|
this.doneReceived = doneReceived; |
|
|
|
this.options = options; |
|
|
|
this.options = options; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -135,8 +138,8 @@ public final class FetchV2Request { |
|
|
|
* The value in a "deepen-since" line in the request, indicating the |
|
|
|
* The value in a "deepen-since" line in the request, indicating the |
|
|
|
* timestamp where to stop fetching/cloning. |
|
|
|
* timestamp where to stop fetching/cloning. |
|
|
|
* |
|
|
|
* |
|
|
|
* @return timestamp where to stop the shallow fetch/clone. Defaults to 0 if |
|
|
|
* @return timestamp in seconds since the epoch, where to stop the shallow |
|
|
|
* not set in the request |
|
|
|
* fetch/clone. Defaults to 0 if not set in the request. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
int getShallowSince() { |
|
|
|
int getShallowSince() { |
|
|
|
return shallowSince; |
|
|
|
return shallowSince; |
|
|
@ -146,8 +149,8 @@ public final class FetchV2Request { |
|
|
|
* @return the refs in "deepen-not" lines in the request. |
|
|
|
* @return the refs in "deepen-not" lines in the request. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@NonNull |
|
|
|
@NonNull |
|
|
|
List<String> getShallowExcludeRefs() { |
|
|
|
List<String> getDeepenNotRefs() { |
|
|
|
return shallowExcludeRefs; |
|
|
|
return deepenNotRefs; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -164,6 +167,13 @@ public final class FetchV2Request { |
|
|
|
return filterBlobLimit; |
|
|
|
return filterBlobLimit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @return true if the request had a "done" line |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
boolean wasDoneReceived() { |
|
|
|
|
|
|
|
return doneReceived; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Options that tune the expected response from the server, like |
|
|
|
* Options that tune the expected response from the server, like |
|
|
|
* "thin-pack", "no-progress" or "ofs-delta" |
|
|
|
* "thin-pack", "no-progress" or "ofs-delta" |
|
|
@ -194,7 +204,7 @@ public final class FetchV2Request { |
|
|
|
|
|
|
|
|
|
|
|
Set<ObjectId> clientShallowCommits = new HashSet<>(); |
|
|
|
Set<ObjectId> clientShallowCommits = new HashSet<>(); |
|
|
|
|
|
|
|
|
|
|
|
List<String> shallowExcludeRefs = new ArrayList<>(); |
|
|
|
List<String> deepenNotRefs = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
Set<String> options = new HashSet<>(); |
|
|
|
Set<String> options = new HashSet<>(); |
|
|
|
|
|
|
|
|
|
|
@ -204,6 +214,8 @@ public final class FetchV2Request { |
|
|
|
|
|
|
|
|
|
|
|
long filterBlobLimit = -1; |
|
|
|
long filterBlobLimit = -1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean doneReceived; |
|
|
|
|
|
|
|
|
|
|
|
private Builder() { |
|
|
|
private Builder() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -282,16 +294,16 @@ public final class FetchV2Request { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @return if there has been any "deepen not" line in the request |
|
|
|
* @return if there has been any "deepen not" line in the request |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
boolean hasShallowExcludeRefs() { |
|
|
|
boolean hasDeepenNotRefs() { |
|
|
|
return shallowExcludeRefs.size() > 0; |
|
|
|
return !deepenNotRefs.isEmpty(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param shallowExcludeRef reference in a "deepen not" line |
|
|
|
* @param deepenNotRef reference in a "deepen not" line |
|
|
|
* @return the builder |
|
|
|
* @return the builder |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
Builder addShallowExcludeRefs(String shallowExcludeRef) { |
|
|
|
Builder addDeepenNotRef(String deepenNotRef) { |
|
|
|
this.shallowExcludeRefs.add(shallowExcludeRef); |
|
|
|
this.deepenNotRefs.add(deepenNotRef); |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -323,13 +335,22 @@ public final class FetchV2Request { |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Mark that the "done" line has been received. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return the builder |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
Builder setDoneReceived() { |
|
|
|
|
|
|
|
this.doneReceived = true; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* @return Initialized fetch request |
|
|
|
* @return Initialized fetch request |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
FetchV2Request build() { |
|
|
|
FetchV2Request build() { |
|
|
|
return new FetchV2Request(peerHas, wantedRefs, wantsIds, |
|
|
|
return new FetchV2Request(peerHas, wantedRefs, wantsIds, |
|
|
|
clientShallowCommits, shallowSince, shallowExcludeRefs, |
|
|
|
clientShallowCommits, shallowSince, deepenNotRefs, |
|
|
|
depth, filterBlobLimit, options); |
|
|
|
depth, filterBlobLimit, doneReceived, options); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|