/** * @return Returns current instance of read cache and initializes local reference if such one is not initialized yet. */ private O2QCache gerReadCache() { if (readCacheInitialized) return readCache; final OReadCache cache = storage.getReadCache(); if (cache instanceof O2QCache) { this.readCache = (O2QCache) cache; } else { this.readCache = null; } readCacheInitialized = true; return readCache; }
public OAtomicOperationsManager(OAbstractPaginatedStorage storage) { this.storage = storage; this.writeAheadLog = storage.getWALInstance(); this.readCache = storage.getReadCache(); this.writeCache = storage.getWriteCache(); }
public ODurableComponent(final OAbstractPaginatedStorage storage, final String name, final String extension, final String lockName) { super(true); assert name != null; this.extension = extension; this.storage = storage; this.fullName = name + extension; this.name = name; this.atomicOperationsManager = storage.getAtomicOperationsManager(); this.readCache = storage.getReadCache(); this.writeCache = storage.getWriteCache(); this.lockName = lockName; }
private void removeValuesContainer() { if (valueContainerAlgorithm.equals(ODefaultIndexFactory.SBTREE_BONSAI_VALUE_CONTAINER)) { final OAtomicOperation atomicOperation = OAtomicOperationsManager.getCurrentOperation(); final OReadCache readCache = storage.getReadCache(); final OWriteCache writeCache = storage.getWriteCache(); if (atomicOperation == null) { try { final String fileName = getName() + OIndexRIDContainer.INDEX_FILE_EXTENSION; if (writeCache.exists(fileName)) { final long fileId = writeCache.loadFile(fileName); readCache.deleteFile(fileId, writeCache); } } catch (IOException e) { OLogManager.instance().error(this, "Cannot delete file for value containers", e); } } else { try { final String fileName = getName() + OIndexRIDContainer.INDEX_FILE_EXTENSION; if (atomicOperation.isFileExists(fileName)) { final long fileId = atomicOperation.loadFile(fileName); atomicOperation.deleteFile(fileId); } } catch (IOException e) { OLogManager.instance().error(this, "Cannot delete file for value containers", e); } } } }