1 /*
2 * Copyright (C) 2017, 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.storage.reftable;
12
13 import java.io.IOException;
14
15 import org.eclipse.jgit.annotations.Nullable;
16 import org.eclipse.jgit.lib.ReflogEntry;
17
18 /**
19 * Iterator over logs inside a
20 * {@link org.eclipse.jgit.internal.storage.reftable.Reftable}.
21 */
22 public abstract class LogCursor implements AutoCloseable {
23 /**
24 * Check if another log record is available.
25 *
26 * @return {@code true} if there is another result.
27 * @throws java.io.IOException
28 * logs cannot be read.
29 */
30 public abstract boolean next() throws IOException;
31
32 /**
33 * Get name of the current reference.
34 *
35 * @return name of the current reference.
36 */
37 public abstract String getRefName();
38
39 /**
40 * Get identifier of the transaction that created the log record.
41 *
42 * @return identifier of the transaction that created the log record.
43 */
44 public abstract long getUpdateIndex();
45
46 /**
47 * Get current log entry.
48 *
49 * @return current log entry. Maybe null if we are producing deletions.
50 */
51 @Nullable
52 public abstract ReflogEntry getReflogEntry();
53
54 /** {@inheritDoc} */
55 @Override
56 public abstract void close();
57 }