public interface PageStore extends Closeable
Modifier and Type | Field and Description |
---|---|
static byte |
TYPE_DATA
Type for regular affinity partitions.
|
static byte |
TYPE_IDX
Type for index partition.
|
Modifier and Type | Method and Description |
---|---|
void |
addWriteListener(PageWriteListener lsnr) |
long |
allocatePage()
Allocates next page index.
|
void |
beginRecover()
Starts recover process.
|
void |
ensure() |
boolean |
exists()
Checks if page exists.
|
void |
finishRecover()
Ends recover process.
|
int |
getBlockSize() |
int |
getPageSize() |
long |
getSparseSize() |
long |
pageOffset(long pageId)
Gets page offset within the store file.
|
int |
pages()
Gets number of allocated pages.
|
void |
punchHole(long pageId,
int usefulBytes)
Should free all the extra storage space after the given number of useful bytes in the given page.
|
boolean |
read(long pageId,
ByteBuffer pageBuf,
boolean keepCrc)
Reads a page.
|
void |
readHeader(ByteBuffer buf)
Reads a header.
|
void |
removeWriteListener(PageWriteListener lsnr) |
long |
size() |
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)
Truncates and deletes partition file.
|
int |
version() |
void |
write(long pageId,
ByteBuffer pageBuf,
int tag,
boolean calculateCrc)
Writes a page.
|
static final byte TYPE_DATA
static final byte TYPE_IDX
void addWriteListener(PageWriteListener lsnr)
lsnr
- Page write listener to set.void removeWriteListener(PageWriteListener lsnr)
lsnr
- Page write listener to remove.boolean exists()
True
if page exists.long allocatePage() throws IgniteCheckedException
IgniteCheckedException
- If failed to allocate.int pages()
boolean read(long pageId, ByteBuffer pageBuf, boolean keepCrc) throws IgniteCheckedException
pageId
- 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 keepCrctrue
if page has been read successfully, false
if page hasn't been written yet.IgniteCheckedException
- If reading failed (IO error occurred).void readHeader(ByteBuffer buf) throws IgniteCheckedException
buf
- Buffer to write to.IgniteCheckedException
- If failed.void write(long pageId, ByteBuffer pageBuf, int tag, boolean calculateCrc) throws IgniteCheckedException
pageId
- 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).long pageOffset(long pageId)
pageId
- Page ID.void sync() throws IgniteCheckedException
IgniteCheckedException
- If sync failed (IO error occurred).void ensure() throws IgniteCheckedException
IgniteCheckedException
- If sync failed (IO error occurred).int version()
void stop(boolean cleanFile) throws StorageException
cleanFile
- True
to delete file.StorageException
- If failed.void beginRecover()
void finishRecover() throws StorageException
StorageException
- If failed.void truncate(int tag) throws StorageException
tag
- New partition tag.StorageException
- If failed.int getPageSize()
int getBlockSize()
long size()
pages()
* getPageSize()
due to delayed writes or due to other implementation specific details.long getSparseSize()
size()
.punchHole(long, int)
void punchHole(long pageId, int usefulBytes)
pageId
- Page id.usefulBytes
- Number of meaningful bytes from the beginning of the page.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021