use of org.apache.jena.tdb2.params.StoreParams in project jena by apache.
the class DatabaseConnection method build.
private static DatabaseConnection build(Location location, StoreParams params) {
if (location.isMemUnique()) {
throw new TDBException("Can't buildForCache a memory-unique location");
}
ProcessFileLock lock = null;
if (SystemTDB.DiskLocationMultiJvmUsagePrevention && !location.isMem()) {
// Take the lock for the swithable.
// StoreConnection will take a lock for the storage.
lock = lockForLocation(location);
// Take the lock. This is atomic and non-reentrant.
lock.lockEx();
}
// c.f. StoreConnection.make
DatasetGraph dsg = DatabaseOps.create(location, params);
return new DatabaseConnection(dsg, location, lock);
}
use of org.apache.jena.tdb2.params.StoreParams in project jena by apache.
the class SpotTDB2 method checkStorageArea.
/**
* Check all files exist for a TDB2 database, or the area is empty (and so a new
* database can be created in the location). Throw {@link TDBException} is a file
* is missing.
*/
private static void checkStorageArea(Location location) {
if (location.isMem())
return;
if (isEmpty(location))
return;
// Journal, fixed name.
validate(location, Names.journalFileBase, Names.extJournal);
// Places for StoreParams: location or default
StoreParams params = getStoreParams(location);
// Check for indexes
containsIndex(params.getPrimaryIndexTriples(), params.getTripleIndexes());
validateBPT(location, params.getTripleIndexes());
containsIndex(params.getPrimaryIndexQuads(), params.getTripleIndexes());
validateBPT(location, params.getQuadIndexes());
// prefixes. GPU
containsIndex(params.getPrimaryIndexPrefix(), params.getPrefixIndexes());
// GPU is not in files "GPU"
// Filename of GPU.
validateBPT(location, params.getPrefixIndexes());
// ---- Node tables.
/*
* nodes.bpt
* nodes.dat
* nodes-data.bdf
* nodes-data.obj
*/
validateBPT(location, params.getNodeTableBaseName());
validateDAT(location, params.getNodeTableBaseName() + "-data");
/*
* prefixes...
*/
// XXX validateBPT(location, params.getPrefixTableBaseName());
validateBPT(location, params.getPrefixTableBaseName());
validateDAT(location, params.getPrefixTableBaseName() + "-data");
}
use of org.apache.jena.tdb2.params.StoreParams in project jena by apache.
the class ProcIngestDataX method getDatasetGraph.
private static DatasetGraph getDatasetGraph(String location) {
Location loc = Location.create(location);
// Ensure reset
DatasetGraph dsg0 = DatabaseMgr.connectDatasetGraph(location);
TDBInternal.expel(dsg0);
StoreParams storeParams = StoreParams.getDftStoreParams();
if (true) {
storeParams = StoreParams.builder(storeParams).node2NodeIdCacheSize(10_000_000).build();
}
DatasetGraph dsg = DatabaseConnection.connectCreate(loc, storeParams).getDatasetGraph();
StoreParams storeParamsActual = TDBInternal.getDatasetGraphTDB(dsg).getStoreParams();
// FmtLog.info(LOG, "NodeId to Node cache size: %,d", storeParamsActual.getNodeId2NodeCacheSize());
return dsg;
}
use of org.apache.jena.tdb2.params.StoreParams in project jena by apache.
the class TestStoreParams method store_params_03.
@Test
public void store_params_03() {
StoreParams sp = StoreParams.builder().build();
assertEqualsStoreParams(StoreParams.getDftStoreParams(), sp);
}
use of org.apache.jena.tdb2.params.StoreParams in project jena by apache.
the class TestStoreParams method store_params_12.
@Test
public void store_params_12() {
String xs = "{ \"tdb.file_mode\": \"direct\" , \"tdb.block_size\": 2048 }";
JsonObject x = JSON.parse(xs);
StoreParams paramsExpected = StoreParams.builder().blockSize(2048).fileMode(FileMode.direct).build();
StoreParams paramsActual = StoreParamsCodec.decode(x);
assertEqualsStoreParams(paramsExpected, paramsActual);
}
Aggregations