
public class OWOWCache extends OAbstractWriteCache implements OWriteCache, OCachePointer.WritersListener
| Modifier and Type | Field and Description |
|---|---|
static long |
MAGIC_NUMBER_WITH_CHECKSUM
Marks pages which have a checksum stored.
|
static long |
MAGIC_NUMBER_WITHOUT_CHECKSUM
Marks pages which have no checksum stored.
|
static int |
MIN_CACHE_SIZE |
static String |
NAME_ID_MAP_EXTENSION |
| Constructor and Description |
|---|
OWOWCache(boolean syncOnPageFlush,
int pageSize,
OByteBufferPool bufferPool,
long groupTTL,
OWriteAheadLog writeAheadLog,
long pageFlushInterval,
long writeCacheMaxSize,
long cacheMaxSize,
OLocalPaginatedStorage storageLocal,
boolean checkMinSize,
OClosableLinkedContainer<Long,OFileClassic> files,
int id,
OChecksumMode checksumMode) |
| 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) |
void |
addLowDiskSpaceListener(OLowDiskSpaceListener listener) |
void |
addOnlyWriters(long fileId,
long pageIndex) |
void |
addPageIsBrokenListener(OPageIsBrokenListener listener)
Adds listener which is called by cache if corruption of file page is detected.
|
long |
bookFileId(String fileName) |
boolean |
checkLowDiskSpace() |
OPageDataVerificationError[] |
checkStoredPages(OCommandOutputListener commandOutputListener) |
long[] |
close() |
void |
close(long fileId,
boolean flush) |
long[] |
delete() |
void |
deleteFile(long fileId) |
boolean |
exists(long fileId) |
boolean |
exists(String fileName) |
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) |
String |
fileNameById(long fileId) |
Map<String,Long> |
files() |
void |
flush() |
void |
flush(long fileId) |
long |
getCacheOverflowCount() |
long |
getExclusiveWriteCachePagesSize() |
long |
getExclusiveWriteCacheSize() |
long |
getFilledUpTo(long fileId) |
int |
getId() |
OPerformanceStatisticManager |
getPerformanceStatisticManager() |
File |
getRootDirectory()
Directory which contains all files managed by write cache.
|
long |
getWriteCacheSize() |
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,
boolean addNewPages,
OModifiableBoolean cacheHit,
boolean verifyChecksums) |
long |
loadFile(String fileName)
Registers new file in write cache and returns file id assigned to this file.
|
void |
loadRegisteredFiles()
Loads files already registered in storage.
|
void |
makeFuzzyCheckpoint() |
int |
pageSize() |
void |
removeBackgroundExceptionListener(OBackgroundExceptionListener listener)
Removes listener which is triggered if exception is cast inside background flush data thread.
|
void |
removeLowDiskSpaceListener(OLowDiskSpaceListener listener) |
void |
removeOnlyWriters(long fileId,
long pageIndex) |
void |
removePageIsBrokenListener(OPageIsBrokenListener listener)
Removes listener which is called by cache if corruption of file page is detected.
|
void |
renameFile(long fileId,
String oldFileName,
String newFileName) |
String |
restoreFileById(long fileId)
Finds if there was file in write cache with given id which is deleted right now.
|
void |
setChecksumMode(OChecksumMode checksumMode) |
void |
startFuzzyCheckpoints() |
Future |
store(long fileId,
long pageIndex,
OCachePointer dataPointer) |
void |
truncateFile(long fileId) |
boolean |
verifyPage(long fileId,
long pageIndex) |
checkFileIdCompatibility, composeFileId, extractFileId, extractStorageIdpublic static final String NAME_ID_MAP_EXTENSION
public static final int MIN_CACHE_SIZE
public static final long MAGIC_NUMBER_WITH_CHECKSUM
public static final long MAGIC_NUMBER_WITHOUT_CHECKSUM
public OWOWCache(boolean syncOnPageFlush,
int pageSize,
OByteBufferPool bufferPool,
long groupTTL,
OWriteAheadLog writeAheadLog,
long pageFlushInterval,
long writeCacheMaxSize,
long cacheMaxSize,
OLocalPaginatedStorage storageLocal,
boolean checkMinSize,
OClosableLinkedContainer<Long,OFileClassic> files,
int id,
OChecksumMode checksumMode)
public void loadRegisteredFiles()
throws IOException
IOExceptionpublic void addBackgroundExceptionListener(OBackgroundExceptionListener listener)
addBackgroundExceptionListener in interface OWriteCachelistener - Listener to triggerpublic void removeBackgroundExceptionListener(OBackgroundExceptionListener listener)
removeBackgroundExceptionListener in interface OWriteCachelistener - Listener to removepublic File getRootDirectory()
getRootDirectory in interface OWriteCachenull in case of in memory database.public OPerformanceStatisticManager getPerformanceStatisticManager()
getPerformanceStatisticManager in interface OWriteCachepublic void startFuzzyCheckpoints()
startFuzzyCheckpoints in interface OWriteCachepublic void addLowDiskSpaceListener(OLowDiskSpaceListener listener)
addLowDiskSpaceListener in interface OWriteCachepublic void removeLowDiskSpaceListener(OLowDiskSpaceListener listener)
removeLowDiskSpaceListener in interface OWriteCachepublic void addPageIsBrokenListener(OPageIsBrokenListener listener)
OWriteCacheaddPageIsBrokenListener in interface OWriteCachepublic void removePageIsBrokenListener(OPageIsBrokenListener listener)
OWriteCacheremovePageIsBrokenListener in interface OWriteCachepublic long bookFileId(String fileName) throws IOException
bookFileId in interface OWriteCacheIOExceptionpublic int pageSize()
pageSize in interface OWriteCachepublic boolean fileIdsAreEqual(long firsId,
long secondId)
fileIdsAreEqual in interface OWriteCachepublic long loadFile(String fileName) throws IOException
OWriteCacheOWriteCache.internalFileId(long)loadFile in interface OWriteCachefileName - Name of file to register inside storage.IOExceptionpublic long addFile(String fileName) throws IOException
addFile in interface OWriteCacheIOExceptionpublic long fileIdByName(String fileName)
OWriteCachefileIdByName in interface OWriteCachefileName - File name id of which has to be returned.public int internalFileId(long fileId)
OWriteCacheinternalFileId in interface OWriteCachefileId - External file id.public long externalFileId(int fileId)
OWriteCacheexternalFileId in interface OWriteCachefileId - Internal file id.OWriteCache.internalFileId(long),
OWriteCache.getId()public long addFile(String fileName, long fileId) throws IOException
addFile in interface OWriteCacheIOExceptionpublic boolean checkLowDiskSpace()
checkLowDiskSpace in interface OWriteCachepublic void makeFuzzyCheckpoint()
makeFuzzyCheckpoint in interface OWriteCachepublic boolean exists(String fileName)
exists in interface OWriteCachepublic boolean exists(long fileId)
exists in interface OWriteCachepublic Future store(long fileId, long pageIndex, OCachePointer dataPointer)
store in interface OWriteCachepublic Map<String,Long> files()
files in interface OWriteCachepublic OCachePointer[] load(long fileId, long startPageIndex, int pageCount, boolean addNewPages, OModifiableBoolean cacheHit, boolean verifyChecksums) throws IOException
load in interface OWriteCacheIOExceptionpublic boolean verifyPage(long fileId,
long pageIndex)
throws IOException
verifyPage in interface OWriteCacheIOExceptionpublic void addOnlyWriters(long fileId,
long pageIndex)
addOnlyWriters in interface OCachePointer.WritersListenerpublic void removeOnlyWriters(long fileId,
long pageIndex)
removeOnlyWriters in interface OCachePointer.WritersListenerpublic void flush(long fileId)
flush in interface OWriteCachepublic void flush()
flush in interface OWriteCachepublic long getFilledUpTo(long fileId)
throws IOException
getFilledUpTo in interface OWriteCacheIOExceptionpublic long getExclusiveWriteCachePagesSize()
getExclusiveWriteCachePagesSize in interface OWriteCachepublic void deleteFile(long fileId)
throws IOException
deleteFile in interface OWriteCacheIOExceptionpublic void truncateFile(long fileId)
throws IOException
truncateFile in interface OWriteCacheIOExceptionpublic void renameFile(long fileId,
String oldFileName,
String newFileName)
throws IOException
renameFile in interface OWriteCacheIOExceptionpublic long[] close()
throws IOException
close in interface OWriteCacheIOExceptionpublic void close(long fileId,
boolean flush)
throws IOException
close in interface OWriteCacheIOExceptionpublic String restoreFileById(long fileId) throws IOException
OWriteCacherestoreFileById in interface OWriteCachefileId - If of file which should be restorednull if such name does not existIOExceptionpublic OPageDataVerificationError[] checkStoredPages(OCommandOutputListener commandOutputListener)
checkStoredPages in interface OWriteCachepublic long[] delete()
throws IOException
delete in interface OWriteCacheIOExceptionpublic String fileNameById(long fileId)
fileNameById in interface OWriteCachepublic int getId()
getId in interface OWriteCachepublic long getCacheOverflowCount()
public long getWriteCacheSize()
public long getExclusiveWriteCacheSize()
public void setChecksumMode(OChecksumMode checksumMode)
Copyright © 2009–2025 OrientDB. All rights reserved.