public interface PageSwapperFactory
A PageSwapper is responsible for swapping file pages in and out of memory.
The PageSwapperFactory presumably knows about what file system to use.
To be able to create PageSwapper factory need to be configured first using appropriate configure call.
Note that this API is only intended to be used by a PageCache implementation.
It should never be used directly by user code.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close and release any resources associated with this PageSwapperFactory, that it may have opened or acquired
during its construction or use.
|
PageSwapper |
createPageSwapper(File file,
int filePageSize,
PageEvictionCallback onEviction,
boolean createIfNotExist)
Create a PageSwapper for the given file.
|
int |
getCachePageSizeHint()
Get the most optimal cache page size (in bytes) for these PageSwapper implementations.
|
FileSystemAbstraction |
getFileSystemAbstraction()
Get the
FileSystemAbstraction that represents the underlying storage for the page swapper. |
long |
getRequiredBufferAlignment()
Get the unit of alignment that the swappers require of the memory buffers.
|
String |
implementationName()
Get the name of this PageSwapperFactory implementation, for configuration purpose.
|
boolean |
isCachePageSizeHintStrict()
Gives
true if the getCachePageSizeHint() is the only cache page size that is supported for
these PageSwapper implementations, otherwise false. |
void |
open(FileSystemAbstraction fs,
org.neo4j.graphdb.config.Configuration config)
Open page swapper factory with provided filesystem and config
|
void |
syncDevice()
Forces all prior writes made through all non-closed PageSwappers that this factory has created, to all the
relevant devices, such that the writes are durable when this call returns.
|
void open(FileSystemAbstraction fs, org.neo4j.graphdb.config.Configuration config)
fs - file system to use in page swappersconfig - custom page swapper configurationFileSystemAbstraction getFileSystemAbstraction()
FileSystemAbstraction that represents the underlying storage for the page swapper.String implementationName()
int getCachePageSizeHint()
boolean isCachePageSizeHintStrict()
true if the getCachePageSizeHint() is the only cache page size that is supported for
these PageSwapper implementations, otherwise false.long getRequiredBufferAlignment()
UnsafeUtil.pageSize() can be
returned.PageSwapper createPageSwapper(File file, int filePageSize, PageEvictionCallback onEviction, boolean createIfNotExist) throws IOException
file - The file that the PageSwapper will move file pages in and
out of.filePageSize - The size of the pages in the file. Presumably a
multiple of some record size.onEviction - The PageSwapper will be told about evictions, and has
the responsibility of informing the PagedFile via this callback.createIfNotExist - When true, creates the given file if it does not exist, instead of throwing an
exception.IOException - If the PageSwapper could not be created, for
instance if the underlying file could not be opened, or the given file does not exist and createIfNotExist is
false.void syncDevice()
throws IOException
This method has no effect if the PageSwapper.force() method forces the writes for the individual file.
The PageCache.flushAndForce() method will first call force on the PageSwappers for all
mapped files, then call syncDevice on the PageSwapperFactory. This way, the writes are always made
durable regardless of which method that does the forcing.
IOExceptionvoid close()
This method cannot be called before all of the opened PageSwappers have been closed,
and it is guaranteed that no new page swappers will be created after this method has been called.
Copyright © 2002–2018 The Neo4j Graph Database Project. All rights reserved.