public class HawtPageFile extends Object implements PageFile
PageFile interface to a MemoryMappedFile.Paged.SliceType| Modifier and Type | Field and Description |
|---|---|
boolean |
storeFreePages |
| Constructor and Description |
|---|
HawtPageFile(MemoryMappedFile file,
short pageSize,
int headerSize,
int maxPages,
boolean storeFreePages) |
| Modifier and Type | Method and Description |
|---|---|
int |
alloc()
does the same as allocator().alloc(1)
|
SimpleAllocator |
allocator() |
<T> void |
clear(PagedAccessor<T> pagedAccessor,
int page)
Frees any pages associated with the value stored at the given page if any.
|
void |
close() |
void |
flush() |
void |
free(int page)
does the same as allocator().free(page, 1)
|
<T> T |
get(PagedAccessor<T> pagedAccessor,
int page)
Gets an object previously put at the given page.
|
MemoryMappedFile |
getFile() |
int |
getHeaderSize() |
int |
getPageSize() |
long |
offset(long pageId) |
int |
pages(int length) |
<T> void |
put(PagedAccessor<T> pagedAccessor,
int page,
T value)
Put an object at a given page.
|
void |
read(int pageId,
org.fusesource.hawtbuf.Buffer buffer)
Copies the contents of a page into the buffer space.
|
ByteBuffer |
slice(Paged.SliceType type,
int pageId,
int size)
Provides direct access to the memory associated with a page.
|
String |
toString() |
void |
unslice(ByteBuffer buffer) |
void |
write(int pageId,
org.fusesource.hawtbuf.Buffer buffer)
Copies the buffer into the page.
|
void |
write(int pageId,
ByteBuffer buffer)
Writes a byte buffer to a page location.
|
public HawtPageFile(MemoryMappedFile file, short pageSize, int headerSize, int maxPages, boolean storeFreePages) throws IOException
IOExceptionpublic void close()
throws IOException
IOExceptionpublic SimpleAllocator allocator()
public int alloc()
Pagedpublic void free(int page)
Pagedpublic void read(int pageId,
org.fusesource.hawtbuf.Buffer buffer)
Pagedpublic void write(int pageId,
org.fusesource.hawtbuf.Buffer buffer)
Pagedpublic ByteBuffer slice(Paged.SliceType type, int pageId, int size)
Pagedpublic void unslice(ByteBuffer buffer)
public int getPageSize()
getPageSize in interface Pagedpublic int pages(int length)
public <T> T get(PagedAccessor<T> pagedAccessor, int page)
Pagedpublic <T> void put(PagedAccessor<T> pagedAccessor, int page, T value)
Pagedpublic <T> void clear(PagedAccessor<T> pagedAccessor, int page)
Pagedpublic void write(int pageId,
ByteBuffer buffer)
PageFilepublic long offset(long pageId)
public int getHeaderSize()
public MemoryMappedFile getFile()
Copyright © 2009–2015 FuseSource, Corp.. All rights reserved.