Update LocalKeyValueDatabase
This commit is contained in:
parent
9a4e0d53d3
commit
8926916f67
@ -1,5 +1,7 @@
|
|||||||
package it.cavallium.dbengine.database.disk;
|
package it.cavallium.dbengine.database.disk;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
|
import com.google.common.base.Suppliers;
|
||||||
import it.cavallium.dbengine.database.Column;
|
import it.cavallium.dbengine.database.Column;
|
||||||
import it.cavallium.dbengine.database.LLKeyValueDatabase;
|
import it.cavallium.dbengine.database.LLKeyValueDatabase;
|
||||||
import it.cavallium.dbengine.database.LLSnapshot;
|
import it.cavallium.dbengine.database.LLSnapshot;
|
||||||
@ -47,6 +49,7 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
|
|||||||
|
|
||||||
private static final ColumnFamilyDescriptor DEFAULT_COLUMN_FAMILY = new ColumnFamilyDescriptor(
|
private static final ColumnFamilyDescriptor DEFAULT_COLUMN_FAMILY = new ColumnFamilyDescriptor(
|
||||||
RocksDB.DEFAULT_COLUMN_FAMILY);
|
RocksDB.DEFAULT_COLUMN_FAMILY);
|
||||||
|
private static Supplier<Scheduler> lowMemorySupplier = Suppliers.memoize(() -> Schedulers.newSingle("db-low-memory"));
|
||||||
|
|
||||||
private final Scheduler dbScheduler;
|
private final Scheduler dbScheduler;
|
||||||
private final Path dbPath;
|
private final Path dbPath;
|
||||||
@ -75,12 +78,16 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
|
|||||||
Path dbPath = Paths.get(dbPathString);
|
Path dbPath = Paths.get(dbPathString);
|
||||||
this.dbPath = dbPath;
|
this.dbPath = dbPath;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.dbScheduler = Schedulers.newBoundedElastic(Runtime.getRuntime().availableProcessors(),
|
if (lowMemory) {
|
||||||
Schedulers.DEFAULT_BOUNDED_ELASTIC_QUEUESIZE,
|
this.dbScheduler = lowMemorySupplier.get();
|
||||||
"db-" + name,
|
} else {
|
||||||
60,
|
this.dbScheduler = Schedulers.newBoundedElastic(Runtime.getRuntime().availableProcessors(),
|
||||||
true
|
Schedulers.DEFAULT_BOUNDED_ELASTIC_QUEUESIZE,
|
||||||
);
|
"db-" + name,
|
||||||
|
60,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
createIfNotExists(descriptors, options, dbPath, dbPathString);
|
createIfNotExists(descriptors, options, dbPath, dbPathString);
|
||||||
// Create all column families that don't exist
|
// Create all column families that don't exist
|
||||||
|
Loading…
x
Reference in New Issue
Block a user