All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.rocksdb.TransactionLogIterator Maven / Gradle / Ivy

Go to download

RocksDB fat jar that contains .so files for linux64, jnilib files for Mac OSX, and a .dll for Windows x64. It contains the Yamcs merge operator for the Parameter Archive

There is a newer version: 9.4.0.10
Show newest version
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
package org.rocksdb;

/**
 * 

A TransactionLogIterator is used to iterate over the transactions in a db. * One run of the iterator is continuous, i.e. the iterator will stop at the * beginning of any gap in sequences.

*/ public class TransactionLogIterator extends RocksObject { /** *

An iterator is either positioned at a WriteBatch * or not valid. This method returns true if the iterator * is valid. Can read data from a valid iterator.

* * @return true if iterator position is valid. */ public boolean isValid() { return isValid(nativeHandle_); } /** *

Moves the iterator to the next WriteBatch. * REQUIRES: Valid() to be true.

*/ public void next() { next(nativeHandle_); } /** *

Throws RocksDBException if something went wrong.

* * @throws org.rocksdb.RocksDBException if something went * wrong in the underlying C++ code. */ public void status() throws RocksDBException { status(nativeHandle_); } /** *

If iterator position is valid, return the current * write_batch and the sequence number of the earliest * transaction contained in the batch.

* *

ONLY use if Valid() is true and status() is OK.

* * @return {@link org.rocksdb.TransactionLogIterator.BatchResult} * instance. */ public BatchResult getBatch() { assert(isValid()); return getBatch(nativeHandle_); } /** *

TransactionLogIterator constructor.

* * @param nativeHandle address to native address. */ TransactionLogIterator(final long nativeHandle) { super(nativeHandle); } /** *

BatchResult represents a data structure returned * by a TransactionLogIterator containing a sequence * number and a {@link WriteBatch} instance.

*/ public static final class BatchResult { /** *

Constructor of BatchResult class.

* * @param sequenceNumber related to this BatchResult instance. * @param nativeHandle to {@link org.rocksdb.WriteBatch} * native instance. */ public BatchResult(final long sequenceNumber, final long nativeHandle) { sequenceNumber_ = sequenceNumber; writeBatch_ = new WriteBatch(nativeHandle, true); } /** *

Return sequence number related to this BatchResult.

* * @return Sequence number. */ public long sequenceNumber() { return sequenceNumber_; } /** *

Return contained {@link org.rocksdb.WriteBatch} * instance

* * @return {@link org.rocksdb.WriteBatch} instance. */ public WriteBatch writeBatch() { return writeBatch_; } private final long sequenceNumber_; private final WriteBatch writeBatch_; } @Override protected final void disposeInternal(final long handle) { disposeInternalJni(handle); } private static native void disposeInternalJni(final long handle); private static native boolean isValid(long handle); private static native void next(long handle); private static native void status(long handle) throws RocksDBException; private static native BatchResult getBatch(long handle); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy