| | |
| | | { |
| | | void flush(WriteableTransaction txn) throws StorageRuntimeException, DirectoryException; |
| | | |
| | | void writeTrustState(WriteableTransaction txn) throws StorageRuntimeException; |
| | | |
| | | void put(Index index, ByteString key, EntryID entryID); |
| | | |
| | | void put(VLVIndex index, ByteString sortKey); |
| | |
| | | void remove(VLVIndex index, ByteString sortKey); |
| | | |
| | | void remove(Index index, ByteString key, EntryID entryID); |
| | | |
| | | void reset(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void writeTrustState(WriteableTransaction txn) |
| | | { |
| | | // Indexes cache the index trust flag. Ensure that the cached value is written into the db. |
| | | for (Index index : bufferedIndexes.keySet()) |
| | | { |
| | | index.setTrusted(txn, index.isTrusted()); |
| | | } |
| | | |
| | | for (VLVIndex index : bufferedVLVIndexes.keySet()) |
| | | { |
| | | index.setTrusted(txn, index.isTrusted()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void put(Index index, ByteString key, EntryID entryID) |
| | | { |
| | | createOrGetBufferedIndexValues(index, key).addEntryID(entryID); |
| | |
| | | index.update(txn, entry.getKey(), values.deletedEntryIDs, values.addedEntryIDs); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void reset() |
| | | { |
| | | bufferedIndexes.clear(); |
| | | bufferedVLVIndexes.clear(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void writeTrustState(WriteableTransaction txn) |
| | | { |
| | | // Nothing to do |
| | | } |
| | | |
| | | @Override |
| | | public void remove(VLVIndex index, ByteString sortKey) |
| | | { |
| | | throw new UnsupportedOperationException(); |
| | |
| | | { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | |
| | | @Override |
| | | public void reset() |
| | | { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | | } |
| | | |
| | | private final IndexBufferImplementor impl; |
| | |
| | | impl.flush(txn); |
| | | } |
| | | |
| | | /** |
| | | * Indexes might cache their trust state. This ensure that the cached state is persisted into the database. |
| | | * |
| | | * @param txn |
| | | * a non null transaction |
| | | * @throws StorageRuntimeException |
| | | * If an error occurs in the storage. |
| | | */ |
| | | void writeTrustState(WriteableTransaction txn) |
| | | { |
| | | impl.writeTrustState(txn); |
| | | } |
| | | |
| | | void put(Index index, ByteString key, EntryID entryID) |
| | | { |
| | | impl.put(index, key, entryID); |
| | |
| | | { |
| | | impl.remove(index, key, entryID); |
| | | } |
| | | |
| | | void reset() |
| | | { |
| | | impl.reset(); |
| | | } |
| | | } |