/** * Get the map to store the data. * * @param session the session * @return the map */ TransactionMap<Value, Value> getMap(Session session) { if (session == null) { return dataMap; } Transaction t = mvTable.getTransaction(session); return dataMap.getInstance(t, Long.MAX_VALUE); }
@Override public void remove(Session session) { TransactionMap<Value, Value> map = getMap(session); if (!map.isClosed()) { Transaction t = mvTable.getTransaction(session); t.removeMap(map); } }
public MVPrimaryIndex( Database db, MVTable table, int id, IndexColumn[] columns, IndexType indexType) { this.mvTable = table; initBaseIndex(table, id, table.getName() + "_DATA", columns, indexType); int[] sortTypes = new int[columns.length]; for (int i = 0; i < columns.length; i++) { sortTypes[i] = SortOrder.ASCENDING; } ValueDataType keyType = new ValueDataType(null, null, null); ValueDataType valueType = new ValueDataType(db.getCompareMode(), db, sortTypes); mapName = "table." + getId(); dataMap = mvTable.getTransaction(null).openMap(mapName, keyType, valueType); Value k = dataMap.lastKey(); lastKey = k == null ? 0 : k.getLong(); }