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
IOException
public void close() throws IOException
IOException
public SimpleAllocator allocator()
public int alloc()
Paged
public void free(int page)
Paged
public void read(int pageId, org.fusesource.hawtbuf.Buffer buffer)
Paged
public void write(int pageId, org.fusesource.hawtbuf.Buffer buffer)
Paged
public ByteBuffer slice(Paged.SliceType type, int pageId, int size)
Paged
public void unslice(ByteBuffer buffer)
public int getPageSize()
getPageSize
in interface Paged
public int pages(int length)
public <T> T get(PagedAccessor<T> pagedAccessor, int page)
Paged
public <T> void put(PagedAccessor<T> pagedAccessor, int page, T value)
Paged
public <T> void clear(PagedAccessor<T> pagedAccessor, int page)
Paged
public void write(int pageId, ByteBuffer buffer)
PageFile
public long offset(long pageId)
public int getHeaderSize()
public MemoryMappedFile getFile()
Copyright © 2009–2016 FuseSource, Corp.. All rights reserved.