1 /*
2 * Copyright (C) 2016, Google Inc. and others
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Distribution License v. 1.0 which is available at
6 * https://www.eclipse.org/org/documents/edl-v10.php.
7 *
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10
11 package org.eclipse.jgit.internal.ketch;
12
13 import java.util.Map;
14 import java.util.Set;
15
16 import org.eclipse.jgit.annotations.Nullable;
17 import org.eclipse.jgit.lib.ObjectId;
18 import org.eclipse.jgit.lib.Ref;
19
20 /**
21 * A fetch request to obtain objects from a replica, and its result.
22 */
23 public class ReplicaFetchRequest {
24 private final Set<String> wantRefs;
25 private final Set<ObjectId> wantObjects;
26 private Map<String, Ref> refs;
27
28 /**
29 * Construct a new fetch request for a replica.
30 *
31 * @param wantRefs
32 * named references to be fetched.
33 * @param wantObjects
34 * specific objects to be fetched.
35 */
36 public ReplicaFetchRequest(Set<String> wantRefs,
37 Set<ObjectId> wantObjects) {
38 this.wantRefs = wantRefs;
39 this.wantObjects = wantObjects;
40 }
41
42 /**
43 * Get references to be fetched.
44 *
45 * @return references to be fetched.
46 */
47 public Set<String> getWantRefs() {
48 return wantRefs;
49 }
50
51 /**
52 * Get objects to be fetched.
53 *
54 * @return objects to be fetched.
55 */
56 public Set<ObjectId> getWantObjects() {
57 return wantObjects;
58 }
59
60 /**
61 * Get remote references, usually from the advertisement.
62 *
63 * @return remote references, usually from the advertisement.
64 */
65 @Nullable
66 public Map<String, Ref> getRefs() {
67 return refs;
68 }
69
70 /**
71 * Set references observed from the replica.
72 *
73 * @param refs
74 * references observed from the replica.
75 */
76 public void setRefs(Map<String, Ref> refs) {
77 this.refs = refs;
78 }
79 }