@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.Constructor and Description |
---|
LocalPageStore(LocalPageStoreOptions options)
Creates a new instance of
LocalPageStore . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
delete(PageId pageId,
long pageSize)
Deletes a page from the store.
|
ReadableByteChannel |
get(PageId pageId,
int pageOffset)
Gets part of a page from the store to the destination channel.
|
long |
getCacheSize() |
java.util.stream.Stream<PageInfo> |
getPages()
Gets a stream of all pages from the page store.
|
void |
put(PageId pageId,
byte[] page)
Writes a new page from a source channel to the store.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
create, get, getStorePath, initialize
public LocalPageStore(LocalPageStoreOptions options)
LocalPageStore
.options
- options for the local page storepublic void put(PageId pageId, byte[] page) throws IOException
PageStore
put
in interface PageStore
pageId
- page identifierpage
- page dataIOException
public ReadableByteChannel get(PageId pageId, int pageOffset) throws IOException, PageNotFoundException
PageStore
get
in interface PageStore
pageId
- page identifierpageOffset
- offset within pageIOException
- when the store fails to read this pagePageNotFoundException
- when the page isn't found in the storepublic void delete(PageId pageId, long pageSize) throws IOException, PageNotFoundException
PageStore
delete
in interface PageStore
pageId
- page identifierpageSize
- page size in bytesIOException
- when the store fails to delete this pagePageNotFoundException
- when the page isn't found in the storepublic void close()
close
in interface AutoCloseable
public java.util.stream.Stream<PageInfo> getPages() throws IOException
PageStore
getPages
in interface PageStore
IOException
- if any error occurspublic long getCacheSize()
getCacheSize
in interface PageStore
Copyright © 2023. All Rights Reserved.