LogCursor.java

  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. package org.eclipse.jgit.internal.storage.reftable;

  11. import java.io.IOException;

  12. import org.eclipse.jgit.annotations.Nullable;
  13. import org.eclipse.jgit.lib.ReflogEntry;

  14. /**
  15.  * Iterator over logs inside a
  16.  * {@link org.eclipse.jgit.internal.storage.reftable.Reftable}.
  17.  */
  18. public abstract class LogCursor implements AutoCloseable {
  19.     /**
  20.      * Check if another log record is available.
  21.      *
  22.      * @return {@code true} if there is another result.
  23.      * @throws java.io.IOException
  24.      *             logs cannot be read.
  25.      */
  26.     public abstract boolean next() throws IOException;

  27.     /**
  28.      * Get name of the current reference.
  29.      *
  30.      * @return name of the current reference.
  31.      */
  32.     public abstract String getRefName();

  33.     /**
  34.      * Get identifier of the transaction that created the log record.
  35.      *
  36.      * @return identifier of the transaction that created the log record.
  37.      */
  38.     public abstract long getUpdateIndex();

  39.     /**
  40.      * Get current log entry.
  41.      *
  42.      * @return current log entry. Maybe null if we are producing deletions.
  43.      */
  44.     @Nullable
  45.     public abstract ReflogEntry getReflogEntry();

  46.     /** {@inheritDoc} */
  47.     @Override
  48.     public abstract void close();
  49. }