@NotThreadSafe public class LocalPageStore extends java.lang.Object implements PageStore
LocalPageStore is an implementation of PageStore which
stores all pages in a directory somewhere on the local disk.PageStore.Metrics| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TEMP_DIR |
| Constructor and Description |
|---|
LocalPageStore(PageStoreOptions options)
Creates a new instance of
LocalPageStore. |
| Modifier and Type | Method and Description |
|---|---|
void |
abort(java.lang.String fileId)
Abort a temporary file.
|
void |
close() |
void |
commit(java.lang.String fileId,
java.lang.String newFileId)
Commit a temporary file with a new file ID.
|
void |
delete(PageId pageId)
Deletes a page from the store.
|
int |
get(PageId pageId,
int pageOffset,
int bytesToRead,
PageReadTargetBuffer target,
boolean isTemporary)
Gets part of a page from the store to the destination buffer.
|
java.nio.file.Path |
getPagePath(PageId pageId,
boolean isTemporary) |
void |
put(PageId pageId,
java.nio.ByteBuffer page,
boolean isTemporary)
Writes a new page from a source channel to the store.
|
public static final java.lang.String TEMP_DIR
public LocalPageStore(PageStoreOptions options)
LocalPageStore.options - options for the local page storepublic void put(PageId pageId, java.nio.ByteBuffer page, boolean isTemporary) throws ResourceExhaustedException, java.io.IOException
PageStoreput in interface PageStorepageId - page identifierpage - page dataisTemporary - is page data temporaryResourceExhaustedException - when there is not enough space found on diskjava.io.IOException - when the store fails to write this pagepublic int get(PageId pageId, int pageOffset, int bytesToRead, PageReadTargetBuffer target, boolean isTemporary) throws java.io.IOException, PageNotFoundException
PageStoreget in interface PageStorepageId - page identifierpageOffset - offset within pagebytesToRead - bytes to read in this pagetarget - destination bufferisTemporary - is page data temporaryjava.io.IOException - when the store fails to read this pagePageNotFoundException - when the page isn't found in the storepublic void delete(PageId pageId) throws java.io.IOException, PageNotFoundException
PageStoredelete in interface PageStorepageId - page identifierjava.io.IOException - when the store fails to delete this pagePageNotFoundException - when the page isn't found in the storepublic void commit(java.lang.String fileId,
java.lang.String newFileId)
throws java.io.IOException
PageStorepublic void abort(java.lang.String fileId)
throws java.io.IOException
PageStorepublic java.nio.file.Path getPagePath(PageId pageId, boolean isTemporary)
pageId - page IdisTemporary - public void close()
close in interface java.lang.AutoCloseableCopyright © 2022. All Rights Reserved.