Class RocksDBWriteBatchWrapper

  • All Implemented Interfaces:
    AutoCloseable

    public class RocksDBWriteBatchWrapper
    extends Object
    implements AutoCloseable
    It's a wrapper class around RocksDB's WriteBatch for writing in bulk.

    IMPORTANT: This class is not thread safe.

    • Constructor Detail

      • RocksDBWriteBatchWrapper

        public RocksDBWriteBatchWrapper​(@Nonnull
                                        org.rocksdb.RocksDB rocksDB,
                                        long writeBatchSize)
      • RocksDBWriteBatchWrapper

        public RocksDBWriteBatchWrapper​(@Nonnull
                                        org.rocksdb.RocksDB rocksDB,
                                        @Nullable
                                        org.rocksdb.WriteOptions options)
      • RocksDBWriteBatchWrapper

        public RocksDBWriteBatchWrapper​(@Nonnull
                                        org.rocksdb.RocksDB rocksDB,
                                        @Nullable
                                        org.rocksdb.WriteOptions options,
                                        long batchSize)
      • RocksDBWriteBatchWrapper

        public RocksDBWriteBatchWrapper​(@Nonnull
                                        org.rocksdb.RocksDB rocksDB,
                                        @Nullable
                                        org.rocksdb.WriteOptions options,
                                        int capacity,
                                        long batchSize)
      • RocksDBWriteBatchWrapper

        public RocksDBWriteBatchWrapper​(@Nonnull
                                        org.rocksdb.RocksDB rocksDB,
                                        @Nullable
                                        org.rocksdb.WriteOptions options,
                                        int capacity,
                                        long batchSize,
                                        int cancellationCheckInterval,
                                        long cancellationCheckIntervalBytes)
    • Method Detail

      • put

        public void put​(@Nonnull
                        org.rocksdb.ColumnFamilyHandle handle,
                        @Nonnull
                        byte[] key,
                        @Nonnull
                        byte[] value)
                 throws org.rocksdb.RocksDBException
        Throws:
        org.rocksdb.RocksDBException
      • remove

        public void remove​(@Nonnull
                           org.rocksdb.ColumnFamilyHandle handle,
                           @Nonnull
                           byte[] key)
                    throws org.rocksdb.RocksDBException
        Throws:
        org.rocksdb.RocksDBException
      • flush

        public void flush()
                   throws org.rocksdb.RocksDBException
        Throws:
        org.rocksdb.RocksDBException
      • markCancelled

        public void markCancelled()
      • getCancelCloseable

        public Closeable getCancelCloseable()
      • close

        public void close()
                   throws org.rocksdb.RocksDBException
        Specified by:
        close in interface AutoCloseable
        Throws:
        org.rocksdb.RocksDBException