Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import org.rocksdb.ColumnFamilyDescriptor;
import org.rocksdb.ColumnFamilyHandle;
import org.rocksdb.DBOptions;
import org.rocksdb.Holder;
import org.rocksdb.LiveFileMetaData;
import org.rocksdb.Options;
import org.rocksdb.RocksDB;
import org.rocksdb.RocksDBException;
import org.slf4j.Logger;
Expand Down Expand Up @@ -87,6 +89,11 @@ public static ManagedRocksDB open(
);
}

public static ManagedRocksDB open(final String path) throws RocksDBException {
return new ManagedRocksDB(RocksDB.open(path));
}


/**
* Delete liveMetaDataFile from rocks db using RocksDB#deleteFile Api.
* This function makes the RocksDB#deleteFile Api synchronized by waiting
Expand All @@ -102,4 +109,39 @@ public void deleteFile(LiveFileMetaData fileToBeDeleted)
File file = new File(fileToBeDeleted.path(), fileToBeDeleted.fileName());
ManagedRocksObjectUtils.waitForFileDelete(file, Duration.ofSeconds(60));
}

public void put(ColumnFamilyHandle columnFamilyHandle,
byte[] key, byte[] value) throws RocksDBException {
this.get().put(columnFamilyHandle, key, value);
}

public byte[] get(ColumnFamilyHandle columnFamilyHandle,
byte[] key) throws RocksDBException {
return this.get().get(columnFamilyHandle, key);
}

public ColumnFamilyHandle createColumnFamily(
ColumnFamilyDescriptor columnFamilyDescriptor)
throws RocksDBException {
return this.get().createColumnFamily(columnFamilyDescriptor);
}

public void dropColumnFamily(ColumnFamilyHandle columnFamilyHandle)
throws RocksDBException {
this.get().dropColumnFamily(columnFamilyHandle);
}

public boolean keyMayExist(ColumnFamilyHandle columnFamilyHandle, byte[] key, Holder<byte[]> valueHolder) {
return this.get().keyMayExist(columnFamilyHandle, key, valueHolder);
}

public void close() {
this.get().close();
}

public static List<byte[]> listColumnFamilies(Options options,
String path) throws RocksDBException {
return RocksDB.listColumnFamilies(options, path);
}

}
Loading