|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.magnos.data.store.AbstractStore
org.magnos.data.store.MemoryStore
public class MemoryStore
A store which is kept entirely in memory and is not persisted to any medium.
Constructor Summary | |
---|---|
MemoryStore(java.lang.String name)
Instantiates a MemoryStore. |
|
MemoryStore(java.lang.String name,
int capacity)
Instantiates a MemoryStore. |
|
MemoryStore(java.lang.String name,
StoreAccess access,
int capacity)
Instantiates a MemoryStore. |
Method Summary | |
---|---|
java.nio.ByteBuffer |
getBuffer()
Returns the buffer which contains all this stores data. |
protected void |
storeClose()
Should close the store. |
protected void |
storeDelete()
Deletes the medium to which the store has been persisting to. |
protected boolean |
storeExists()
Returns whether the store exists in its probable medium. |
protected void |
storeFlush()
Should flush the contents of the store from memory to a persisted medium if the implementation supports it. |
protected void |
storeGet(int location,
byte[] bytes,
int offset,
int length)
Gets data at the given location and stores it in the given byte array. |
protected void |
storeGet(int location,
java.nio.ByteBuffer b)
Gets data at the given location and stores it in the given ByteBuffer. |
protected void |
storeLoad()
Should load contents of the store into memory from a persisted medium if the implementation supports it. |
protected int |
storeOpen(StoreAccess access)
Should open the store and return the capacity. |
protected void |
storePut(int location,
byte[] bytes,
int offset,
int length)
Puts data at the given location from the given byte array. |
protected void |
storePut(int location,
java.nio.ByteBuffer b)
Puts data at the given location from the given ByteBuffer. |
protected int |
storeResize(int bytes)
Resizes the store to the given capacity. |
Methods inherited from class org.magnos.data.store.AbstractStore |
---|
capacity, capacity, close, create, delete, equals, exists, flush, get, get, get, get, getAccess, getName, hashCode, isAutoFlush, isAutoLoad, isAutoOpen, isClosed, isOpen, load, open, put, put, put, setAccess, setAutoFlush, setAutoLoad, setAutoOpen, toString, validate |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MemoryStore(java.lang.String name)
name
- The unique name of the Store.public MemoryStore(java.lang.String name, int capacity)
name
- The unique name of the Store.capacity
- The requested capacity of the store.public MemoryStore(java.lang.String name, StoreAccess access, int capacity)
name
- The unique name of the Store.access
- The requested access to the store.capacity
- The requested capacity of the store.Method Detail |
---|
public java.nio.ByteBuffer getBuffer()
protected int storeOpen(StoreAccess access) throws java.io.IOException
storeOpen
in class AbstractStore
java.io.IOException
- An error occurred opening the store with the given access.protected void storeLoad() throws java.io.IOException
storeLoad
in class AbstractStore
java.io.IOException
- An error occurred loading the store.protected void storeFlush() throws java.io.IOException
storeFlush
in class AbstractStore
java.io.IOException
- An error occurred flushing the store.protected void storeClose() throws java.io.IOException
storeClose
in class AbstractStore
java.io.IOException
- An error occurred closing the store.protected void storeDelete()
storeDelete
in class AbstractStore
protected boolean storeExists()
storeExists
in class AbstractStore
protected int storeResize(int bytes)
storeResize
in class AbstractStore
bytes
- The new capacity of the store.protected void storeGet(int location, byte[] bytes, int offset, int length) throws java.io.IOException
storeGet
in class AbstractStore
location
- The offset to get the data, in bytes, from the beginning of the store.bytes
- The array of bytes to place the data in.offset
- The offset in the byte array to place the data.length
- The number of bytes to copy from the store and place in the array.
java.io.IOException
- An error occurred reading from the store.protected void storePut(int location, byte[] bytes, int offset, int length) throws java.io.IOException
storePut
in class AbstractStore
location
- The offset to put the data, in bytes, from the beginning of the store.bytes
- The array of bytes to take data from.offset
- The offset in the byte array to take the data.length
- The number of bytes to copy from the array and place in the store.
java.io.IOException
- An error occurred writing to the store.protected void storeGet(int location, java.nio.ByteBuffer b) throws java.io.IOException
storeGet
in class AbstractStore
location
- The offset to get the data, in bytes, from the beginning of the store.b
- The buffer to place the data in. The buffer will be filled with data
to its limit (so it has no remaining bytes).
java.io.IOException
- An error occurred reading from the store.protected void storePut(int location, java.nio.ByteBuffer b) throws java.io.IOException
storePut
in class AbstractStore
location
- The offset to put the data, in bytes, from the beginning of the store.b
- The buffer to take the data from. The buffer will be emptied of data
to its limit (so it has no remaining bytes).
java.io.IOException
- An error occurred writing to the store.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |