public interface PageStore extends AutoCloseable
Modifier and Type | Interface and Description |
---|---|
static class |
PageStore.Metrics
Metrics.
|
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
Modifier and Type | Method and Description |
---|---|
static PageStore |
create(PageStoreOptions options)
Creates a new
PageStore . |
void |
delete(PageId pageId)
Deletes a page from the store.
|
default int |
get(PageId pageId,
byte[] buffer)
Gets a page from the store to the destination buffer.
|
int |
get(PageId pageId,
int pageOffset,
int bytesToRead,
byte[] buffer,
int bufferOffset)
Gets part of a page from the store to the destination buffer.
|
long |
getCacheSize() |
java.util.stream.Stream<PageInfo> |
getPages()
Gets a stream of all pages from the page store.
|
static Path |
getStorePath(PageStoreType storeType,
String rootDir)
Gets store path given root directory and store type.
|
static void |
initialize(PageStoreOptions options)
Initializes a page store at the configured location.
|
static PageStore |
open(PageStoreOptions options)
Opens an existing
PageStore . |
void |
put(PageId pageId,
byte[] page)
Writes a new page from a source channel to the store.
|
close
static PageStore create(PageStoreOptions options) throws IOException
PageStore
. Previous state in the samme cache dir will be overwritten.options
- the options to instantiate the page storeIOException
- if I/O error happensstatic PageStore open(PageStoreOptions options) throws IOException
PageStore
.options
- the options to instantiate the page storeIOException
- if I/O error happensstatic Path getStorePath(PageStoreType storeType, String rootDir)
storeType
- the type of the page storerootDir
- the root directory pathstatic void initialize(PageStoreOptions options) throws IOException
options
- initialize a new page store based on the optionsIOException
- when failed to clean up the specific locationvoid put(PageId pageId, byte[] page) throws ResourceExhaustedException, IOException
pageId
- page identifierpage
- page dataResourceExhaustedException
- when there is not enough space found on diskIOException
- when the store fails to write this pagedefault int get(PageId pageId, byte[] buffer) throws IOException, PageNotFoundException
pageId
- page identifierbuffer
- destination bufferIOException
- when the store fails to read this pagePageNotFoundException
- when the page isn't found in the storeint get(PageId pageId, int pageOffset, int bytesToRead, byte[] buffer, int bufferOffset) throws IOException, PageNotFoundException
pageId
- page identifierpageOffset
- offset within pagebytesToRead
- bytes to read in this pagebuffer
- destination bufferbufferOffset
- offset in bufferIOException
- when the store fails to read this pagePageNotFoundException
- when the page isn't found in the storeIllegalArgumentException
- when the page offset exceeds the page sizevoid delete(PageId pageId) throws IOException, PageNotFoundException
pageId
- page identifierIOException
- when the store fails to delete this pagePageNotFoundException
- when the page isn't found in the storejava.util.stream.Stream<PageInfo> getPages() throws IOException
IOException
- if any error occurslong getCacheSize()
Copyright © 2023. All Rights Reserved.