aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/internal/ketch/ReplicaFetchRequest.java
blob: f50ad62c8080e3e6b99eb87f9198232ee070a74a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * Copyright (C) 2016, Google Inc. and others
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0 which is available at
 * https://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

package org.eclipse.jgit.internal.ketch;

import java.util.Map;
import java.util.Set;

import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;

/**
 * A fetch request to obtain objects from a replica, and its result.
 */
public class ReplicaFetchRequest {
	private final Set<String> wantRefs;
	private final Set<ObjectId> wantObjects;
	private Map<String, Ref> refs;

	/**
	 * Construct a new fetch request for a replica.
	 *
	 * @param wantRefs
	 *            named references to be fetched.
	 * @param wantObjects
	 *            specific objects to be fetched.
	 */
	public ReplicaFetchRequest(Set<String> wantRefs,
			Set<ObjectId> wantObjects) {
		this.wantRefs = wantRefs;
		this.wantObjects = wantObjects;
	}

	/**
	 * Get references to be fetched.
	 *
	 * @return references to be fetched.
	 */
	public Set<String> getWantRefs() {
		return wantRefs;
	}

	/**
	 * Get objects to be fetched.
	 *
	 * @return objects to be fetched.
	 */
	public Set<ObjectId> getWantObjects() {
		return wantObjects;
	}

	/**
	 * Get remote references, usually from the advertisement.
	 *
	 * @return remote references, usually from the advertisement.
	 */
	@Nullable
	public Map<String, Ref> getRefs() {
		return refs;
	}

	/**
	 * Set references observed from the replica.
	 *
	 * @param refs
	 *            references observed from the replica.
	 */
	public void setRefs(Map<String, Ref> refs) {
		this.refs = refs;
	}
}