| | |
| | | |
| | | /** Common interface for internal WriteableTransaction implementations. */ |
| | | private interface StorageImpl extends WriteableTransaction, Closeable { |
| | | |
| | | } |
| | | |
| | | /** PersistIt implementation of the {@link WriteableTransaction} interface. */ |
| | |
| | | |
| | | /** PersistIt read-only implementation of {@link StorageImpl} interface. */ |
| | | private final class ReadOnlyStorageImpl implements StorageImpl { |
| | | |
| | | private final WriteableStorageImpl delegate; |
| | | |
| | | ReadOnlyStorageImpl(WriteableStorageImpl delegate) |
| | |
| | | return dbCfg; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() |
| | | { |
| | |
| | | return dbCfg.getBufferPoolMap().get(BUFFER_SIZE); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void open(AccessMode accessMode) throws ConfigException, StorageRuntimeException |
| | | { |
| | |
| | | this); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <T> T read(final ReadOperation<T> operation) throws Exception |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Importer startImport() throws ConfigException, StorageRuntimeException |
| | | { |
| | |
| | | return mangled.toString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void write(final WriteOperation operation) throws Exception |
| | | { |
| | |
| | | public boolean accept(File file) |
| | | { |
| | | String name = file.getName(); |
| | | return name.equals(VOLUME_NAME) || name.matches(JOURNAL_NAME + "\\.\\d+$"); |
| | | return VOLUME_NAME.equals(name) || name.matches(JOURNAL_NAME + "\\.\\d+$"); |
| | | } |
| | | }; |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable(PDBBackendCfg newCfg, |
| | | List<LocalizableMessage> unacceptableReasons) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(PDBBackendCfg cfg) |
| | | { |
| | |
| | | logger.traceException(e); |
| | | throw new StorageRuntimeException(ERR_REMOVE_FAIL.get(e.getMessage()).toString(), e); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | return storageStatus; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void diskFullThresholdReached(File directory, long thresholdInBytes) { |
| | | storageStatus = StorageStatus.unusable( |
| | |
| | | thresholdInBytes, config.getBackendId())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void diskLowThresholdReached(File directory, long thresholdInBytes) { |
| | | storageStatus = StorageStatus.lockedDown( |
| | |
| | | thresholdInBytes, config.getBackendId())); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void diskSpaceRestored(File directory, long lowThresholdInBytes, long fullThresholdInBytes) { |
| | | storageStatus = StorageStatus.working(); |
| | | } |
| | | } |
| | | |