View Javadoc
1   /*
2    * Copyright (C) 2010, 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.lib;
12  
13  import java.io.IOException;
14  
15  import org.eclipse.jgit.errors.MissingObjectException;
16  
17  /**
18   * Queue to examine object sizes asynchronously.
19   *
20   * A queue may perform background lookup of object sizes and supply them
21   * (possibly out-of-order) to the application.
22   *
23   * @param <T>
24   *            type of identifier supplied to the call that made the queue.
25   */
26  public interface AsyncObjectSizeQueue<T extends ObjectId> extends
27  		AsyncOperation {
28  
29  	/**
30  	 * Position this queue onto the next available result.
31  	 *
32  	 * @return true if there is a result available; false if the queue has
33  	 *         finished its input iteration.
34  	 * @throws org.eclipse.jgit.errors.MissingObjectException
35  	 *             the object does not exist. If the implementation is retaining
36  	 *             the application's objects {@link #getCurrent()} will be the
37  	 *             current object that is missing. There may be more results
38  	 *             still available, so the caller should continue invoking next
39  	 *             to examine another result.
40  	 * @throws java.io.IOException
41  	 *             the object store cannot be accessed.
42  	 */
43  	boolean next() throws MissingObjectException, IOException;
44  
45  	/**
46  	 * <p>getCurrent.</p>
47  	 *
48  	 * @return the current object, null if the implementation lost track.
49  	 *         Implementations may for performance reasons discard the caller's
50  	 *         ObjectId and provider their own through {@link #getObjectId()}.
51  	 */
52  	T getCurrent();
53  
54  	/**
55  	 * Get the ObjectId of the current object. Never null.
56  	 *
57  	 * @return the ObjectId of the current object. Never null.
58  	 */
59  	ObjectId getObjectId();
60  
61  	/**
62  	 * Get the size of the current object.
63  	 *
64  	 * @return the size of the current object.
65  	 */
66  	long getSize();
67  }