diff --git a/src/main/java/it/cavallium/dbengine/database/LLDatabaseConnection.java b/src/main/java/it/cavallium/dbengine/database/LLDatabaseConnection.java index 3caca79..9eb0339 100644 --- a/src/main/java/it/cavallium/dbengine/database/LLDatabaseConnection.java +++ b/src/main/java/it/cavallium/dbengine/database/LLDatabaseConnection.java @@ -4,10 +4,11 @@ import it.cavallium.dbengine.database.analyzer.TextFieldsAnalyzer; import java.io.IOException; import java.time.Duration; import java.util.List; +import reactor.core.publisher.Mono; public interface LLDatabaseConnection { - void connect() throws IOException; + Mono connect(); LLKeyValueDatabase getDatabase(String name, List columns, boolean lowMemory) throws IOException; @@ -18,9 +19,5 @@ public interface LLDatabaseConnection { Duration commitDebounceTime, boolean lowMemory) throws IOException; - void disconnect() throws IOException; - - void ping() throws IOException; - - double getMediumLatencyMillis() throws IOException; + Mono disconnect(); } diff --git a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDatabaseConnection.java b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDatabaseConnection.java index f2d42a4..034a5e3 100644 --- a/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDatabaseConnection.java +++ b/src/main/java/it/cavallium/dbengine/database/disk/LLLocalDatabaseConnection.java @@ -10,6 +10,8 @@ import it.cavallium.dbengine.database.Column; import it.cavallium.dbengine.database.LLDatabaseConnection; import it.cavallium.dbengine.database.LLLuceneIndex; import it.cavallium.dbengine.database.analyzer.TextFieldsAnalyzer; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; public class LLLocalDatabaseConnection implements LLDatabaseConnection { @@ -22,10 +24,15 @@ public class LLLocalDatabaseConnection implements LLDatabaseConnection { } @Override - public void connect() throws IOException { - if (Files.notExists(basePath)) { - Files.createDirectories(basePath); - } + public Mono connect() { + return Mono + .fromCallable(() -> { + if (Files.notExists(basePath)) { + Files.createDirectories(basePath); + } + return null; + }) + .subscribeOn(Schedulers.boundedElastic()); } @Override @@ -62,17 +69,7 @@ public class LLLocalDatabaseConnection implements LLDatabaseConnection { } @Override - public void disconnect() throws IOException { - - } - - @Override - public void ping() { - - } - - @Override - public double getMediumLatencyMillis() { - return 0; + public Mono disconnect() { + return Mono.empty(); } }