aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport/ConnectivityChecker.java
blob: dcffe48be895f58752d8a4f4fa3aac901ba75a12 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
 * Copyright (c) 2019, Google LLC  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
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

package org.eclipse.jgit.transport;

import java.io.IOException;
import java.util.List;
import java.util.Set;

import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevWalk;

/**
 * Checks that a received pack only depends on objects which are reachable from
 * a defined set of references.
 *
 * @since 5.7
 */
public interface ConnectivityChecker {

	/**
	 * Checks connectivity of the commit graph after pack uploading.
	 *
	 * @param connectivityCheckInfo
	 *            Input for the connectivity check.
	 * @param haves
	 *            Set of references known for client.
	 * @param pm
	 *            Monitor to publish progress to.
	 * @throws IOException
	 *             an error occurred during connectivity checking.
	 *
	 */
	void checkConnectivity(ConnectivityCheckInfo connectivityCheckInfo,
			Set<ObjectId> haves, ProgressMonitor pm)
			throws IOException;

	/**
	 * POJO which is used to pass all information which is needed to perform
	 * connectivity check.
	 */
	public static class ConnectivityCheckInfo {
		private Repository repository;

		private PackParser parser;

		private boolean checkObjects;

		private List<ReceiveCommand> commands;

		private RevWalk walk;

		/**
		 * @return database we write the stored objects into.
		 */
		public Repository getRepository() {
			return repository;
		}

		/**
		 * @param repository
		 *            set database we write the stored objects into.
		 */
		public void setRepository(Repository repository) {
			this.repository = repository;
		}

		/**
		 * @return the parser used to parse pack.
		 */
		public PackParser getParser() {
			return parser;
		}

		/**
		 * @param parser
		 *            the parser to set
		 */
		public void setParser(PackParser parser) {
			this.parser = parser;
		}

		/**
		 * @return if checker should check objects.
		 */
		public boolean isCheckObjects() {
			return checkObjects;
		}

		/**
		 * @param checkObjects
		 *            set if checker should check referenced objects outside of
		 *            the received pack are reachable.
		 */
		public void setCheckObjects(boolean checkObjects) {
			this.checkObjects = checkObjects;
		}

		/**
		 * @return command received by the current request.
		 */
		public List<ReceiveCommand> getCommands() {
			return commands;
		}

		/**
		 * @param commands
		 *            set command received by the current request.
		 */
		public void setCommands(List<ReceiveCommand> commands) {
			this.commands = commands;
		}

		/**
		 * @param walk
		 *            the walk to parse commits
		 */
		public void setWalk(RevWalk walk) {
			this.walk = walk;
		}

		/**
		 * @return the walk to parse commits
		 */
		public RevWalk getWalk() {
			return walk;
		}
	}
}