Package com.mckoi.store
Interface JournalledResource
-
- All Known Implementing Classes:
JournalledSystem.AbstractResource
,JournalledSystem.NonLoggingResource
,JournalledSystem.Resource
interface JournalledResource
An 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 void
close()
Closes the resource.void
delete()
Deletes the resource.boolean
exists()
Returns true if the resource currently exists.long
getID()
Returns a unique id for this resource.int
getPageSize()
Returns the page size.long
getSize()
Returns the current size of this resource.void
open(boolean read_only)
Opens the resource.void
read(long page_number, byte[] buf, int off)
Reads a page of some previously specified size into the byte array.void
setSize(long size)
Sets the new size of the resource.void
write(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.IOException
Reads 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.IOException
Writes 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.IOException
Sets 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.IOException
Returns 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.IOException
Closes the resource. This will actually simply log that the resource has been closed.- Throws:
java.io.IOException
-
delete
void delete() throws java.io.IOException
Deletes 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.
-
-