public interface Store
Some characteristics of implementations of Store may be separately specified. For example, a file based store that is intended to persistently store objects may have robustness as a primary requirement. A main memory based store, or other type of volatile store, may not require robustness.
Modifier and Type | Method and Description |
---|---|
AreaWriter |
createArea(long size)
Allocates a block of memory in the store of the specified size and returns
an AreaWriter object that can be used to initialize the contents of the
area.
|
void |
deleteArea(long id)
Deletes an area that was previously allocated by the 'createArea' method
by the area id.
|
List |
getAllAreas()
Returns a complete list of pointers to all areas in the Store as Long
objects sorted from lowest pointer to highest.
|
Area |
getArea(long id)
Returns an object that allows for the contents of an area (represented by
the 'id' parameter) to be read.
|
InputStream |
getAreaInputStream(long id)
Returns an InputStream implementation that allows for the area with the
given identifier to be read sequentially.
|
MutableArea |
getMutableArea(long id)
Returns an object that allows for the contents of an area (represented by
the 'id' parameter) to be read and written.
|
boolean |
lastCloseClean()
Returns true if the store was closed cleanly.
|
void |
lockForWrite()
It is often useful to guarentee that a certain sequence of updates to a
store is completed and not broken in the middle.
|
void |
unlockForWrite()
See the 'lockForWrite' method description.
|
AreaWriter createArea(long size) throws IOException
size
- the amount of memory to allocate.IOException
- if not enough space available to create the area or
the store is read-only.void deleteArea(long id) throws IOException
id
- the identifier of the area to delete.IOException
- (optional) if the id is invalid or the area can not
otherwise by deleted.InputStream getAreaInputStream(long id) throws IOException
When 'id' is -1 then a fixed area (64 bytes in size) in the store is returned. The fixed area can be used to store important static static information.
id
- the identifier of the area to read, or id = -1 is a 64 byte
fixed area in the store.IOException
- (optional) if the id is invalid or the area can not
otherwise be accessed.Area getArea(long id) throws IOException
When 'id' is -1 then a fixed area (64 bytes in size) in the store is returned. The fixed area can be used to store important static static information.
id
- the identifier of the area to read, or id = -1 is a 64 byte
fixed area in the store.IOException
- (optional) if the id is invalid or the area can not
otherwise be accessed.MutableArea getMutableArea(long id) throws IOException
When 'id' is -1 then a fixed area (64 bytes in size) in the store is returned. The fixed area can be used to store important static static information.
id
- the identifier of the area to access, or id = -1 is a 64 byte
fixed area in the store.IOException
- (optional) if the id is invalid or the area can not
otherwise be accessed.void lockForWrite()
To achieve this, the 'lockForWrite' and 'unlockForWrite' methods are available. When 'lockForWrite' has been called, a check point can not created until there are no write locks obtained on the table.
void unlockForWrite()
boolean lastCloseClean()
List getAllAreas() throws IOException
IOException
Copyright © 2015. All rights reserved.