Search in sources :

Example 1 with NetworkOptions

use of com.apple.foundationdb.NetworkOptions in project fdb-record-layer by FoundationDB.

the class RankedSetTest method setUp.

@BeforeEach
public void setUp() throws Exception {
    FDB fdb = FDB.instance();
    if (TRACE) {
        NetworkOptions options = fdb.options();
        options.setTraceEnable("/tmp");
        options.setTraceLogGroup("RankedSetTest");
    }
    this.db = fdb.open();
    this.rsSubspace = DirectoryLayer.getDefault().createOrOpen(db, PathUtil.from(getClass().getSimpleName())).get();
    db.run(tr -> {
        tr.clear(rsSubspace.range());
        return null;
    });
}
Also used : NetworkOptions(com.apple.foundationdb.NetworkOptions) FDB(com.apple.foundationdb.FDB) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with NetworkOptions

use of com.apple.foundationdb.NetworkOptions in project fdb-record-layer by FoundationDB.

the class FDBDatabaseFactoryImpl method initFDB.

protected synchronized FDB initFDB() {
    if (!inited) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug(KeyValueLogMessage.of("Starting FDB"));
        }
        fdb = FDB.selectAPIVersion(API_VERSION);
        fdb.setUnclosedWarning(unclosedWarning);
        setStaticOptions(fdb);
        NetworkOptions options = fdb.options();
        if (!traceFormat.isDefaultValue()) {
            options.setTraceFormat(traceFormat.getOptionValue());
        }
        if (traceDirectory != null) {
            options.setTraceEnable(traceDirectory);
        }
        if (traceLogGroup != null) {
            options.setTraceLogGroup(traceLogGroup);
        }
        if (runLoopProfilingEnabled) {
            options.setEnableRunLoopProfiling();
        }
        if (networkExecutor == null) {
            fdb.startNetwork();
        } else {
            fdb.startNetwork(networkExecutor);
        }
        inited = true;
    }
    return fdb;
}
Also used : NetworkOptions(com.apple.foundationdb.NetworkOptions)

Aggregations

NetworkOptions (com.apple.foundationdb.NetworkOptions)2 FDB (com.apple.foundationdb.FDB)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1