]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/RocksIterator.java
1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
9 * <p>An iterator that yields a sequence of key/value pairs from a source.
10 * Multiple implementations are provided by this library.
11 * In particular, iterators are provided
12 * to access the contents of a Table or a DB.</p>
14 * <p>Multiple threads can invoke const methods on an RocksIterator without
15 * external synchronization, but if any of the threads may call a
16 * non-const method, all threads accessing the same RocksIterator must use
17 * external synchronization.</p>
19 * @see org.rocksdb.RocksObject
21 public class RocksIterator
extends AbstractRocksIterator
<RocksDB
> {
22 protected RocksIterator(RocksDB rocksDB
, long nativeHandle
) {
23 super(rocksDB
, nativeHandle
);
27 * <p>Return the key for the current entry. The underlying storage for
28 * the returned slice is valid only until the next modification of
31 * <p>REQUIRES: {@link #isValid()}</p>
33 * @return key for the current entry.
36 assert(isOwningHandle());
37 return key0(nativeHandle_
);
41 * <p>Return the value for the current entry. The underlying storage for
42 * the returned slice is valid only until the next modification of
45 * <p>REQUIRES: !AtEnd() && !AtStart()</p>
46 * @return value for the current entry.
48 public byte[] value() {
49 assert(isOwningHandle());
50 return value0(nativeHandle_
);
53 @Override protected final native void disposeInternal(final long handle
);
54 @Override final native boolean isValid0(long handle
);
55 @Override final native void seekToFirst0(long handle
);
56 @Override final native void seekToLast0(long handle
);
57 @Override final native void next0(long handle
);
58 @Override final native void prev0(long handle
);
59 @Override final native void seek0(long handle
, byte[] target
, int targetLen
);
60 @Override final native void status0(long handle
) throws RocksDBException
;
62 private native byte[] key0(long handle
);
63 private native byte[] value0(long handle
);