Rename transaction methods to create/read/update/delete
| | |
| | | } |
| | | |
| | | @Override |
| | | public ByteString get(TreeName treeName, ByteSequence key) { |
| | | public ByteString read(TreeName treeName, ByteSequence key) { |
| | | try { |
| | | final Exchange ex = getExchange(treeName); |
| | | ex.getKey().clear().append(key.toByteArray()); |
| | |
| | | |
| | | @Override |
| | | public ByteString getRMW(TreeName treeName, ByteSequence key) { |
| | | return get(treeName, key); |
| | | return read(treeName, key); |
| | | } |
| | | |
| | | @Override |
| | | public void put(TreeName treeName, ByteSequence key, ByteSequence value) { |
| | | public void create(TreeName treeName, ByteSequence key, ByteSequence value) { |
| | | try { |
| | | final Exchange ex = getExchange(treeName); |
| | | ex.getKey().clear().append(key.toByteArray()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean remove(TreeName treeName, ByteSequence key) { |
| | | public boolean delete(TreeName treeName, ByteSequence key) { |
| | | try { |
| | | final Exchange ex = getExchange(treeName); |
| | | ex.getKey().clear().append(key.toByteArray()); |
| | |
| | | { |
| | | if (MemoryBudget.getRuntimeMaxMemory() < cfg.getDBCacheSize()) { |
| | | throw new ConfigException( |
| | | ERR_CONFIG_JEB_CACHE_SIZE_GREATER_THAN_JVM_HEAP.get( |
| | | ERR_CONFIG_JEB_CACHE_SIZE_GREATER_THAN_JVM_HEAP.read( |
| | | cfg.getDBCacheSize(), MemoryBudget.getRuntimeMaxMemory())); |
| | | } |
| | | if (cfg.getDBCacheSize() < MemoryBudget.MIN_MAX_MEMORY_SIZE) { |
| | | throw new ConfigException( |
| | | ERR_CONFIG_JEB_CACHE_SIZE_TOO_SMALL.get( |
| | | ERR_CONFIG_JEB_CACHE_SIZE_TOO_SMALL.read( |
| | | cfg.getDBCacheSize(), MemoryBudget.MIN_MAX_MEMORY_SIZE)); |
| | | } |
| | | } |
| | |
| | | protected void put(WriteableStorage txn, ByteSequence key, ByteSequence value) |
| | | throws StorageRuntimeException |
| | | { |
| | | txn.put(treeName, key, value); |
| | | txn.create(treeName, key, value); |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace(messageToLog(true, treeName, txn, key, value)); |
| | |
| | | */ |
| | | protected ByteString read(ReadableStorage txn, ByteSequence key, boolean isRMW) throws StorageRuntimeException |
| | | { |
| | | ByteString value = isRMW ? txn.get(treeName, key) : txn.getRMW(treeName, key); |
| | | ByteString value = isRMW ? txn.read(treeName, key) : txn.getRMW(treeName, key); |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace(messageToLog(value != null, treeName, txn, key, value)); |
| | |
| | | */ |
| | | protected boolean delete(WriteableStorage txn, ByteSequence key) throws StorageRuntimeException |
| | | { |
| | | boolean result = txn.remove(treeName, key); |
| | | boolean result = txn.delete(treeName, key); |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace(messageToLog(result, treeName, txn, key, null)); |
| | |
| | | { |
| | | ByteString key = keyForIndex(index); |
| | | |
| | | txn.put(treeName, key, trusted ? trueBytes : falseBytes); |
| | | txn.create(treeName, key, trusted ? trueBytes : falseBytes); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | private SortValuesSet getSortValuesSet(ReadableStorage txn, ByteString key, boolean isRMW) |
| | | { |
| | | ByteString value = isRMW ? txn.getRMW(treeName, key) : txn.get(treeName, key); |
| | | ByteString value = isRMW ? txn.getRMW(treeName, key) : txn.read(treeName, key); |
| | | if (value == null) |
| | | { |
| | | // There are no records in the database |
| | |
| | | |
| | | public interface ReadableStorage |
| | | { |
| | | ByteString get(TreeName name, ByteSequence key); |
| | | ByteString read(TreeName name, ByteSequence key); |
| | | |
| | | ByteString getRMW(TreeName name, ByteSequence key); |
| | | |
| | |
| | | { |
| | | void openTree(TreeName name); |
| | | |
| | | void put(TreeName name, ByteSequence key, ByteSequence value); |
| | | void create(TreeName name, ByteSequence key, ByteSequence value); |
| | | |
| | | boolean putIfAbsent(TreeName treeName, ByteSequence key, ByteSequence value); |
| | | |
| | | boolean remove(TreeName name, ByteSequence key); |
| | | boolean delete(TreeName name, ByteSequence key); |
| | | } |