mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-06 00:17:58 +01:00
commit
22eb5c6bcd
@ -19,6 +19,8 @@ import java.nio.file.Paths;
|
|||||||
*/
|
*/
|
||||||
public class FileStorageSystem implements StorageSystem {
|
public class FileStorageSystem implements StorageSystem {
|
||||||
|
|
||||||
|
private Options options;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
RocksDB.loadLibrary();
|
RocksDB.loadLibrary();
|
||||||
}
|
}
|
||||||
@ -32,11 +34,11 @@ public class FileStorageSystem implements StorageSystem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open(@NotNull String location, @NotNull StorageOptions storageOptions) {
|
public void open(@NotNull String location, @NotNull StorageOptions storageOptions) {
|
||||||
Options options = new Options().setCreateIfMissing(true);
|
options = new Options().setCreateIfMissing(true);
|
||||||
|
|
||||||
if (storageOptions.hasCompression()) {
|
if (storageOptions.hasCompression()) {
|
||||||
options.setCompressionType(CompressionType.ZSTD_COMPRESSION);
|
options.setCompressionType(CompressionType.ZSTD_COMPRESSION);
|
||||||
options.setCompressionOptions(new CompressionOptions().setLevel(1));
|
options.setCompressionOptions(new CompressionOptions().setLevel(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -77,6 +79,9 @@ public class FileStorageSystem implements StorageSystem {
|
|||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
try {
|
try {
|
||||||
|
if (options != null)
|
||||||
|
this.options.close();
|
||||||
|
|
||||||
this.rocksDB.closeE();
|
this.rocksDB.closeE();
|
||||||
} catch (RocksDBException e) {
|
} catch (RocksDBException e) {
|
||||||
MinecraftServer.getExceptionManager().handleException(e);
|
MinecraftServer.getExceptionManager().handleException(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user