@NotThreadSafe public class LocalPageStore extends Object implements PageStore
LocalPageStore
is an implementation of PageStore
which
stores all pages in a directory somewhere on the local disk.PageStore.Metrics
Constructor and Description |
---|
LocalPageStore(PageStoreOptions options)
Creates a new instance of
LocalPageStore . |
Modifier and Type | Method and Description |
---|---|
void |
abort(String fileId)
Abort a temporary file.
|
void |
close() |
void |
commit(String fileId,
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.
|
Path |
getPagePath(PageId pageId,
boolean isTemporary) |
void |
put(PageId pageId,
ByteBuffer page,
boolean isTemporary)
Writes a new page from a source channel to the store.
|
public static final String TEMP_DIR
public LocalPageStore(PageStoreOptions options)
LocalPageStore
.options
- options for the local page storepublic void put(PageId pageId, ByteBuffer page, boolean isTemporary) throws ResourceExhaustedException, IOException
PageStore
put
in interface PageStore
pageId
- page identifierpage
- page dataisTemporary
- is page data temporaryResourceExhaustedException
- when there is not enough space found on diskIOException
- when the store fails to write this pagepublic int get(PageId pageId, int pageOffset, int bytesToRead, PageReadTargetBuffer target, boolean isTemporary) throws IOException, PageNotFoundException
PageStore
get
in interface PageStore
pageId
- page identifierpageOffset
- offset within pagebytesToRead
- bytes to read in this pagetarget
- destination bufferisTemporary
- is page data temporaryIOException
- when the store fails to read this pagePageNotFoundException
- when the page isn't found in the storepublic void delete(PageId pageId) throws IOException, PageNotFoundException
PageStore
delete
in interface PageStore
pageId
- page identifierIOException
- when the store fails to delete this pagePageNotFoundException
- when the page isn't found in the storepublic void commit(String fileId, String newFileId) throws IOException
PageStore
commit
in interface PageStore
IOException
public void abort(String fileId) throws IOException
PageStore
abort
in interface PageStore
IOException
public Path getPagePath(PageId pageId, boolean isTemporary)
pageId
- page IdisTemporary
- public void close()
close
in interface AutoCloseable
Copyright © 2023. All Rights Reserved.