
public final class ODirectMemoryOnlyDiskCache extends OAbstractWriteCache implements OReadCache, OWriteCache
| Modifier and Type | Method and Description |
|---|---|
void |
addBackgroundExceptionListener(OBackgroundExceptionListener listener)
Adds listener which is triggered if exception is cast inside background flush data thread.
|
long |
addFile(String fileName) |
long |
addFile(String fileName,
long fileId) |
long |
addFile(String fileName,
long fileId,
OWriteCache writeCache) |
long |
addFile(String fileName,
OWriteCache writeCache) |
void |
addLowDiskSpaceListener(OLowDiskSpaceListener listener) |
void |
addPageIsBrokenListener(OPageIsBrokenListener listener)
Not implemented because has no sense
|
int |
allocateNewPage(long fileId) |
OCacheEntry |
allocateNewPage(long fileId,
OWriteCache writeCache,
OLogSequenceNumber startLSN) |
long |
bookFileId(String fileName) |
void |
changeMaximumAmountOfMemory(long calculateReadCacheMaxMemory) |
void |
checkCacheOverflow() |
boolean |
checkLowDiskSpace() |
OPageDataVerificationError[] |
checkStoredPages(OCommandOutputListener commandOutputListener) |
void |
clear() |
long[] |
close() |
void |
close(long fileId,
boolean flush) |
void |
closeFile(long fileId,
boolean flush,
OWriteCache writeCache) |
void |
closeStorage(OWriteCache writeCache)
Closes all files inside of write cache and flushes all associated data.
|
long[] |
delete() |
void |
deleteFile(long fileId) |
void |
deleteFile(long fileId,
OWriteCache writeCache) |
void |
deleteStorage(OWriteCache writeCache) |
boolean |
exists(long fileId) |
boolean |
exists(String name) |
long |
externalFileId(int fileId)
Converts unique internal file id to external one.
|
long |
fileIdByName(String fileName)
Returns id associated with given file or value < 0 if such file does not exist.
|
boolean |
fileIdsAreEqual(long firsId,
long secondId)
DO NOT DELETE THIS METHOD IT IS USED IN ENTERPRISE STORAGE
|
String |
fileNameById(long fileId) |
Map<String,Long> |
files() |
void |
flush() |
void |
flush(long fileId) |
void |
flushTillSegment(long segmentId) |
long |
getExclusiveWriteCachePagesSize() |
long |
getFilledUpTo(long fileId) |
int |
getId() |
Long |
getMinimalNotFlushedSegment() |
Path |
getRootDirectory()
Directory which contains all files managed by write cache.
|
long |
getUsedMemory() |
int |
internalFileId(long fileId)
Returns internal file id which is unique and always the same for given file
in contrary to external id which changes over close/open cycle of cache.
|
OCachePointer[] |
load(long fileId,
long startPageIndex,
int pageCount,
OModifiableBoolean cacheHit,
boolean verifyChecksums) |
void |
loadCacheState(OWriteCache writeCache)
Load state of cache from file system if possible.
|
long |
loadFile(String fileName)
Registers new file in write cache and returns file id assigned to this file.
|
OCacheEntry |
loadForRead(long fileId,
long pageIndex,
boolean checkPinnedPages,
OWriteCache writeCache,
int pageCount,
boolean verifyChecksums) |
OCacheEntry |
loadForWrite(long fileId,
long pageIndex,
boolean checkPinnedPages,
OWriteCache writeCache,
int pageCount,
boolean verifyChecksums,
OLogSequenceNumber startLSN) |
void |
makeFuzzyCheckpoint(long segmentId) |
String |
nativeFileNameById(long fileId)
Obtains native file name by the given file id.
|
int |
pageSize()
DO NOT DELETE THIS METHOD IT IS USED IN ENTERPRISE STORAGE
|
void |
pinPage(OCacheEntry cacheEntry,
OWriteCache writeCache) |
void |
releaseFromRead(OCacheEntry cacheEntry,
OWriteCache writeCache) |
void |
releaseFromWrite(OCacheEntry cacheEntry,
OWriteCache writeCache) |
void |
removeBackgroundExceptionListener(OBackgroundExceptionListener listener)
Removes listener which is triggered if exception is cast inside background flush data thread.
|
void |
removeLowDiskSpaceListener(OLowDiskSpaceListener listener) |
void |
removePageIsBrokenListener(OPageIsBrokenListener listener)
Not implemented because has no sense
|
void |
renameFile(long fileId,
String newFileName) |
void |
replaceFileContentWith(long fileId,
Path newContentFile)
Replaces the file content with the content of the provided file.
|
String |
restoreFileById(long fileId)
Finds if there was file in write cache with given id which is deleted right now.
|
OCacheEntry |
silentLoadForRead(long fileId,
int pageIndex,
OWriteCache writeCache,
boolean verifyChecksums)
Loads page from the disk cache if it is already loaded otherwise loads it from disk but does
not put it the disk cache.
|
void |
store(long fileId,
long pageIndex,
OCachePointer dataPointer) |
void |
storeCacheState(OWriteCache writeCache)
Stores state of cache inside file if possible.
|
void |
truncateFile(long fileId) |
void |
truncateFile(long fileId,
OWriteCache writeCache) |
void |
updateDirtyPagesTable(OCachePointer pointer,
OLogSequenceNumber startLSN) |
checkFileIdCompatibility, composeFileId, extractFileId, extractStorageIdpublic final Path getRootDirectory()
getRootDirectory in interface OWriteCachenull in case of in memory database.public final long addFile(String fileName, OWriteCache writeCache)
addFile in interface OReadCachepublic final long fileIdByName(String fileName)
OWriteCachefileIdByName in interface OWriteCachefileName - File name id of which has to be returned.public final int internalFileId(long fileId)
OWriteCacheinternalFileId in interface OWriteCachefileId - External file id.public final long externalFileId(int fileId)
OWriteCacheexternalFileId in interface OWriteCachefileId - Internal file id.OWriteCache.internalFileId(long),
OWriteCache.getId()public final long bookFileId(String fileName)
bookFileId in interface OWriteCachepublic final void addBackgroundExceptionListener(OBackgroundExceptionListener listener)
OWriteCacheaddBackgroundExceptionListener in interface OWriteCachelistener - Listener to triggerpublic final void removeBackgroundExceptionListener(OBackgroundExceptionListener listener)
OWriteCacheremoveBackgroundExceptionListener in interface OWriteCachelistener - Listener to removepublic final void checkCacheOverflow()
checkCacheOverflow in interface OWriteCachepublic final long addFile(String fileName, long fileId, OWriteCache writeCache)
addFile in interface OReadCachepublic final OCacheEntry loadForWrite(long fileId, long pageIndex, boolean checkPinnedPages, OWriteCache writeCache, int pageCount, boolean verifyChecksums, OLogSequenceNumber startLSN)
loadForWrite in interface OReadCachepublic OCacheEntry silentLoadForRead(long fileId, int pageIndex, OWriteCache writeCache, boolean verifyChecksums)
OReadCachesilentLoadForRead in interface OReadCachepublic final OCacheEntry loadForRead(long fileId, long pageIndex, boolean checkPinnedPages, OWriteCache writeCache, int pageCount, boolean verifyChecksums)
loadForRead in interface OReadCachepublic final void pinPage(OCacheEntry cacheEntry, OWriteCache writeCache)
pinPage in interface OReadCachepublic final OCacheEntry allocateNewPage(long fileId, OWriteCache writeCache, OLogSequenceNumber startLSN)
allocateNewPage in interface OReadCachepublic int allocateNewPage(long fileId)
allocateNewPage in interface OWriteCachepublic final void releaseFromWrite(OCacheEntry cacheEntry, OWriteCache writeCache)
releaseFromWrite in interface OReadCachepublic final void releaseFromRead(OCacheEntry cacheEntry, OWriteCache writeCache)
releaseFromRead in interface OReadCachepublic final long getFilledUpTo(long fileId)
getFilledUpTo in interface OWriteCachepublic final void flush(long fileId)
flush in interface OWriteCachepublic final void close(long fileId,
boolean flush)
close in interface OWriteCachepublic final void deleteFile(long fileId)
deleteFile in interface OWriteCachepublic final void renameFile(long fileId,
String newFileName)
renameFile in interface OWriteCachepublic final void replaceFileContentWith(long fileId,
Path newContentFile)
OWriteCachereplaceFileContentWith in interface OWriteCachefileId - the file id of the file to replace the content of.newContentFile - the new content file to replace the current content with.public final void truncateFile(long fileId)
truncateFile in interface OWriteCachepublic final void flush()
flush in interface OWriteCachepublic final long[] close()
close in interface OWriteCachepublic final void clear()
clear in interface OReadCachepublic final long[] delete()
delete in interface OWriteCachepublic final void deleteStorage(OWriteCache writeCache)
deleteStorage in interface OReadCachepublic final void closeStorage(OWriteCache writeCache)
closeStorage in interface OReadCachewriteCache - Write cache to close.public final void loadCacheState(OWriteCache writeCache)
loadCacheState in interface OReadCachewriteCache - Write cache is used to load pages back into cache if possible.public final void storeCacheState(OWriteCache writeCache)
storeCacheState in interface OReadCachewriteCache - Write cache which manages files cache state of which is going to be stored.public void changeMaximumAmountOfMemory(long calculateReadCacheMaxMemory)
changeMaximumAmountOfMemory in interface OReadCachepublic final OPageDataVerificationError[] checkStoredPages(OCommandOutputListener commandOutputListener)
checkStoredPages in interface OWriteCachepublic final boolean exists(String name)
exists in interface OWriteCachepublic final boolean exists(long fileId)
exists in interface OWriteCachepublic final String fileNameById(long fileId)
fileNameById in interface OWriteCachepublic final String nativeFileNameById(long fileId)
OWriteCacheNative file name is a file name of a "physical" on-disk file, it may differ from the "virtual" logical file name.
nativeFileNameById in interface OWriteCachefileId - the file id to obtain the native file name of.null if the passed file id doesn't correspond to any file.public final long getUsedMemory()
getUsedMemory in interface OReadCachepublic final boolean checkLowDiskSpace()
checkLowDiskSpace in interface OWriteCachepublic final void addPageIsBrokenListener(OPageIsBrokenListener listener)
addPageIsBrokenListener in interface OWriteCachepublic final void removePageIsBrokenListener(OPageIsBrokenListener listener)
removePageIsBrokenListener in interface OWriteCachepublic final void addLowDiskSpaceListener(OLowDiskSpaceListener listener)
addLowDiskSpaceListener in interface OWriteCachepublic final void removeLowDiskSpaceListener(OLowDiskSpaceListener listener)
removeLowDiskSpaceListener in interface OWriteCachepublic final long loadFile(String fileName)
OWriteCacheFile id consist of two parts:
OWriteCache.internalFileId(long)If file with the same name is deleted and then new file is created this file with have the same internal id.
loadFile in interface OWriteCachefileName - Name of file to register inside storage.public final long addFile(String fileName)
addFile in interface OWriteCachepublic final long addFile(String fileName, long fileId)
addFile in interface OWriteCachepublic final void store(long fileId,
long pageIndex,
OCachePointer dataPointer)
store in interface OWriteCachepublic final void makeFuzzyCheckpoint(long segmentId)
makeFuzzyCheckpoint in interface OWriteCachepublic final void flushTillSegment(long segmentId)
flushTillSegment in interface OWriteCachepublic final Long getMinimalNotFlushedSegment()
getMinimalNotFlushedSegment in interface OWriteCachepublic final void updateDirtyPagesTable(OCachePointer pointer, OLogSequenceNumber startLSN)
updateDirtyPagesTable in interface OWriteCachepublic final OCachePointer[] load(long fileId, long startPageIndex, int pageCount, OModifiableBoolean cacheHit, boolean verifyChecksums)
load in interface OWriteCachepublic final long getExclusiveWriteCachePagesSize()
getExclusiveWriteCachePagesSize in interface OWriteCachepublic final void truncateFile(long fileId,
OWriteCache writeCache)
truncateFile in interface OReadCachepublic final int getId()
getId in interface OWriteCachepublic final Map<String,Long> files()
files in interface OWriteCachepublic final int pageSize()
OWriteCachepageSize in interface OWriteCachepublic final boolean fileIdsAreEqual(long firsId,
long secondId)
OWriteCacheTakes two ids and checks whether they are equal from point of view of write cache. In other words methods checks whether two ids in reality contain the same internal ids.
fileIdsAreEqual in interface OWriteCachepublic final String restoreFileById(long fileId)
OWriteCacherestoreFileById in interface OWriteCachefileId - If of file which should be restorednull if such name does not existpublic final void closeFile(long fileId,
boolean flush,
OWriteCache writeCache)
closeFile in interface OReadCachepublic final void deleteFile(long fileId,
OWriteCache writeCache)
deleteFile in interface OReadCacheCopyright © 2009–2025 OrientDB. All rights reserved.