/** * Search for a specific row or a set of rows. * * @param session the session * @param first the key of the first row * @param last the key of the last row * @return the cursor */ Cursor find(Session session, ValueLong first, ValueLong last) { TransactionMap<Value, Value> map = getMap(session); return new MVStoreCursor(session, map.entryIterator(first, last)); }
/** * Roll the transaction back. Afterwards, this transaction is closed. */ public void rollback() { checkNotClosed(); store.rollbackTo(this, logId, 0); store.endTransaction(this, status); }
/** * Roll back to the given savepoint. This is only allowed if the * transaction is open. * * @param savepointId the savepoint id */ public void rollbackToSavepoint(long savepointId) { checkNotClosed(); store.rollbackTo(this, logId, savepointId); logId = savepointId; }
private Cursor find(Session session) { Iterator<SpatialKey> cursor = spatialMap.keyIterator(null); TransactionMap<SpatialKey, Value> map = getMap(session); Iterator<SpatialKey> it = map.wrapIterator(cursor, false); return new MVStoreCursor(session, it); }
public void setName(String name) { checkNotClosed(); this.name = name; store.storeTransaction(this); }
@Override public long getRowCount(Session session) { TransactionMap<Value, Value> map = getMap(session); return map.sizeAsLong(); }
@Override public long getRowCount(Session session) { TransactionMap<SpatialKey, Value> map = getMap(session); return map.sizeAsLong(); }
/** * Commit the transaction. Afterwards, this transaction is closed. */ public void commit() { checkNotClosed(); store.commit(this, logId); }
@Override public long getRowCount(Session session) { TransactionMap<Value, Value> map = getMap(session); return map.sizeAsLong(); }
@Override public double getCost(Session session, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, HashSet<Column> allColumnsSet) { return 10 * getCostRangeIndex(masks, mainIndex.getRowCountApproximation(), filters, filter, sortOrder, true, allColumnsSet); }
/** * Get a new transaction. * * @return the transaction */ Transaction getTransactionBegin() { // TODO need to commit/rollback the transaction return transactionStore.begin(); }
/** * Get the most recent value for the given key. * * @param key the key * @return the value or null */ public V getLatest(K key) { return get(key, Long.MAX_VALUE); }
/** * Iterate over keys. * * @param from the first key to return * @return the iterator */ public Iterator<K> keyIterator(K from) { return keyIterator(from, false); }
/** * Add a log entry. * * @param mapId the map id * @param key the key * @param oldValue the old value */ void log(int mapId, Object key, Object oldValue) { store.log(this, logId, mapId, key, oldValue); // only increment the log id if logging was successful logId++; }
/** * Prepare the transaction. Afterwards, the transaction can only be * committed or rolled back. */ public void prepare() { checkNotClosed(); status = STATUS_PREPARED; store.storeTransaction(this); }