Package com.mckoi.store
Interface JournalledResource
-
- All Known Implementing Classes:
JournalledSystem.AbstractResource,JournalledSystem.NonLoggingResource,JournalledSystem.Resource
interface JournalledResourceAn interface that allows for the reading and writing of pages to/from a journalled.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes the resource.voiddelete()Deletes the resource.booleanexists()Returns true if the resource currently exists.longgetID()Returns a unique id for this resource.intgetPageSize()Returns the page size.longgetSize()Returns the current size of this resource.voidopen(boolean read_only)Opens the resource.voidread(long page_number, byte[] buf, int off)Reads a page of some previously specified size into the byte array.voidsetSize(long size)Sets the new size of the resource.voidwrite(long page_number, byte[] buf, int off, int len)Writes a page of some previously specified size to the top log.
-
-
-
Method Detail
-
getPageSize
int getPageSize()
Returns the page size.
-
getID
long getID()
Returns a unique id for this resource.
-
read
void read(long page_number, byte[] buf, int off) throws java.io.IOExceptionReads a page of some previously specified size into the byte array.- Throws:
java.io.IOException
-
write
void write(long page_number, byte[] buf, int off, int len) throws java.io.IOExceptionWrites a page of some previously specified size to the top log. This will add a single entry to the log and any 'read' operations after will contain the written data.- Throws:
java.io.IOException
-
setSize
void setSize(long size) throws java.io.IOExceptionSets the new size of the resource. This will add a single entry to the log.- Throws:
java.io.IOException
-
getSize
long getSize() throws java.io.IOExceptionReturns the current size of this resource.- Throws:
java.io.IOException
-
open
void open(boolean read_only) throws java.io.IOException
Opens the resource.- Throws:
java.io.IOException
-
close
void close() throws java.io.IOExceptionCloses the resource. This will actually simply log that the resource has been closed.- Throws:
java.io.IOException
-
delete
void delete() throws java.io.IOExceptionDeletes the resource. This will actually simply log that the resource has been deleted.- Throws:
java.io.IOException
-
exists
boolean exists()
Returns true if the resource currently exists.
-
-