Update LLDatabaseConnection.java and LLLocalDatabaseConnection.java
This commit is contained in:
parent
a1d4731ae3
commit
490d15413e
@ -4,10 +4,11 @@ import it.cavallium.dbengine.database.analyzer.TextFieldsAnalyzer;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
public interface LLDatabaseConnection {
|
public interface LLDatabaseConnection {
|
||||||
|
|
||||||
void connect() throws IOException;
|
Mono<Void> connect();
|
||||||
|
|
||||||
LLKeyValueDatabase getDatabase(String name, List<Column> columns, boolean lowMemory) throws IOException;
|
LLKeyValueDatabase getDatabase(String name, List<Column> columns, boolean lowMemory) throws IOException;
|
||||||
|
|
||||||
@ -18,9 +19,5 @@ public interface LLDatabaseConnection {
|
|||||||
Duration commitDebounceTime,
|
Duration commitDebounceTime,
|
||||||
boolean lowMemory) throws IOException;
|
boolean lowMemory) throws IOException;
|
||||||
|
|
||||||
void disconnect() throws IOException;
|
Mono<Void> disconnect();
|
||||||
|
|
||||||
void ping() throws IOException;
|
|
||||||
|
|
||||||
double getMediumLatencyMillis() throws IOException;
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@ import it.cavallium.dbengine.database.Column;
|
|||||||
import it.cavallium.dbengine.database.LLDatabaseConnection;
|
import it.cavallium.dbengine.database.LLDatabaseConnection;
|
||||||
import it.cavallium.dbengine.database.LLLuceneIndex;
|
import it.cavallium.dbengine.database.LLLuceneIndex;
|
||||||
import it.cavallium.dbengine.database.analyzer.TextFieldsAnalyzer;
|
import it.cavallium.dbengine.database.analyzer.TextFieldsAnalyzer;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
import reactor.core.scheduler.Schedulers;
|
||||||
|
|
||||||
public class LLLocalDatabaseConnection implements LLDatabaseConnection {
|
public class LLLocalDatabaseConnection implements LLDatabaseConnection {
|
||||||
|
|
||||||
@ -22,10 +24,15 @@ public class LLLocalDatabaseConnection implements LLDatabaseConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connect() throws IOException {
|
public Mono<Void> connect() {
|
||||||
if (Files.notExists(basePath)) {
|
return Mono
|
||||||
Files.createDirectories(basePath);
|
.<Void>fromCallable(() -> {
|
||||||
}
|
if (Files.notExists(basePath)) {
|
||||||
|
Files.createDirectories(basePath);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.subscribeOn(Schedulers.boundedElastic());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -62,17 +69,7 @@ public class LLLocalDatabaseConnection implements LLDatabaseConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnect() throws IOException {
|
public Mono<Void> disconnect() {
|
||||||
|
return Mono.empty();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ping() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMediumLatencyMillis() {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user