@Override
public void doSetRecord(byte[] key, byte[] value) throws DataStoreFatalException {
// db.put = returns true if value put in and didn't replace anything
// returns false if it failed OR if it had to replace a value
if (!db.set(key, value)) {
Error error = db.error();
// this code may be 0 if the value was replaced
if (error.code() == Error.DUPREC) {
// value replaced, ignoring
} else {
throw new DataStoreFatalException("Unable to set value and key [0x" + HexUtil.toHexString(key) + "] [code=" + error.code() + ", message=" + error.message() + "]");
}
}
Error error = db.error();
if (error != null && error.code() != 0) logger.trace("Error on set {}=>{} {} {}", HexUtil.toHexString(key), value.length, error.code(), error);
// if synchronize interval is zero, sync() on every put() and take()
if (this.synchronizeInterval == 0) {
// syncing the b-tree database
db.synchronize(false, null);