public class FilePageStore extends Object implements PageStore
| Modifier and Type | Field and Description |
|---|---|
protected DataStorageConfiguration |
dbCfg
Database configuration.
|
static int |
HEADER_SIZE
Allocated field offset.
|
static int |
VERSION
File version.
|
| Constructor and Description |
|---|
FilePageStore(byte type,
File file,
FileIOFactory factory,
DataStorageConfiguration cfg,
AllocatedPageTracker allocatedTracker) |
| Modifier and Type | Method and Description |
|---|---|
long |
allocatePage()
Allocates next page index.
|
void |
beginRecover() |
void |
ensure() |
boolean |
exists()
Checks if page exists.
|
void |
finishRecover() |
ByteBuffer |
header(byte type,
int pageSize)
Creates header for current version file store.
|
int |
headerSize()
Size of page store header.
|
long |
pageOffset(long pageId)
Gets page offset within the store file.
|
int |
pages()
Gets number of allocated pages.
|
void |
read(long pageId,
ByteBuffer pageBuf,
boolean keepCrc)
Reads a page.
|
void |
readHeader(ByteBuffer buf)
Reads a header.
|
void |
stop(boolean cleanFile) |
void |
sync()
Sync method used to ensure that the given pages are guaranteed to be written to the store.
|
void |
truncate(int tag) |
int |
version()
Page store version.
|
void |
write(long pageId,
ByteBuffer pageBuf,
int tag,
boolean calculateCrc)
Writes a page.
|
public static final int VERSION
public static final int HEADER_SIZE
protected final DataStorageConfiguration dbCfg
public FilePageStore(byte type,
File file,
FileIOFactory factory,
DataStorageConfiguration cfg,
AllocatedPageTracker allocatedTracker)
file - File.public boolean exists()
public int headerSize()
public int version()
public ByteBuffer header(byte type, int pageSize)
type - Type.pageSize - Page size.public void stop(boolean cleanFile)
throws PersistentStorageIOException
cleanFile - True to delete file.PersistentStorageIOException - If failed.public void truncate(int tag)
throws PersistentStorageIOException
PersistentStorageIOExceptionpublic void beginRecover()
public void finishRecover()
throws PersistentStorageIOException
PersistentStorageIOExceptionpublic void read(long pageId,
ByteBuffer pageBuf,
boolean keepCrc)
throws IgniteCheckedException
read in interface PageStorepageId - Page ID.pageBuf - Page buffer to read into.keepCrc - by default reading zeroes CRC which was on file, but you can keep it in pageBuf if set keepCrcIgniteCheckedException - If reading failed (IO error occurred).public void readHeader(ByteBuffer buf) throws IgniteCheckedException
readHeader in interface PageStorebuf - Buffer to write to.IgniteCheckedException - If failed.public void write(long pageId,
ByteBuffer pageBuf,
int tag,
boolean calculateCrc)
throws IgniteCheckedException
write in interface PageStorepageId - Page ID.pageBuf - Page buffer to write.tag - Partition file version, 1-based incrementing counter. For outdated pages tag has lower value,
and write does nothing.calculateCrc - if False crc calculation will be forcibly skipped.IgniteCheckedException - If page writing failed (IO error occurred).public long pageOffset(long pageId)
pageOffset in interface PageStorepageId - Page ID.public void sync()
throws IgniteCheckedException
sync in interface PageStoreIgniteCheckedException - If sync failed (IO error occurred).public void ensure()
throws IgniteCheckedException
ensure in interface PageStoreIgniteCheckedException - If sync failed (IO error occurred).public long allocatePage()
throws IgniteCheckedException
allocatePage in interface PageStoreIgniteCheckedException - If failed to allocate.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.4.0 Release Date : March 5 2018