1 /*
2 * Copyright (C) 2015, 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.transport;
12
13 import java.io.OutputStream;
14
15 import org.eclipse.jgit.lib.ProgressMonitor;
16
17 /**
18 * A callback to tell caller the count of objects ASAP.
19 *
20 * @since 4.1
21 */
22 public interface ObjectCountCallback {
23 /**
24 * Invoked when the
25 * {@link org.eclipse.jgit.internal.storage.pack.PackWriter} has counted the
26 * objects to be written to pack.
27 * <p>
28 * An {@code ObjectCountCallback} can use this information to decide whether
29 * the
30 * {@link org.eclipse.jgit.internal.storage.pack.PackWriter#writePack(ProgressMonitor, ProgressMonitor, OutputStream)}
31 * operation should be aborted.
32 * <p>
33 * This callback will be called exactly once.
34 *
35 * @param objectCount
36 * the count of the objects.
37 * @throws org.eclipse.jgit.transport.WriteAbortedException
38 * to indicate that the write operation should be aborted.
39 */
40 void setObjectCount(long objectCount) throws WriteAbortedException;
41 }