use of com.sleepycat.je.LockMode in project GeoGig by boundlessgeo.
the class JEObjectDatabase method getRawInternal.
@Override
protected InputStream getRawInternal(final ObjectId id, final boolean failIfNotFound) {
checkOpen();
Preconditions.checkNotNull(id, "id");
DatabaseEntry key = new DatabaseEntry(id.getRawValue());
DatabaseEntry data = new DatabaseEntry();
final LockMode lockMode = LockMode.READ_UNCOMMITTED;
Transaction transaction = null;
OperationStatus operationStatus = objectDb.get(transaction, key, data, lockMode);
if (NOTFOUND.equals(operationStatus)) {
if (failIfNotFound) {
throw new IllegalArgumentException("Object does not exist: " + id.toString() + " at " + env.getHome().getAbsolutePath());
}
return null;
}
final byte[] cData = data.getData();
return new ByteArrayInputStream(cData);
}
use of com.sleepycat.je.LockMode in project GeoGig by boundlessgeo.
the class JEObjectDatabase method exists.
/**
* @see org.locationtech.geogig.storage.ObjectDatabase#exists(org.locationtech.geogig.api.ObjectId)
*/
@Override
public boolean exists(final ObjectId id) {
checkOpen();
Preconditions.checkNotNull(id, "id");
DatabaseEntry key = new DatabaseEntry(id.getRawValue());
DatabaseEntry data = new DatabaseEntry();
// tell db not to retrieve data
data.setPartial(0, 0, true);
final LockMode lockMode = LockMode.READ_UNCOMMITTED;
Transaction transaction = null;
OperationStatus status = objectDb.get(transaction, key, data, lockMode);
return SUCCESS == status;
}
Aggregations