|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RecordManager
An interface to manages records, which are objects serialized to byte[] on background.
The set of record operations is simple: fetch, insert, update and delete. Each record is identified using a "rowid" and contains a byte[] data block serialized to object. Rowids are returned on inserts and you can store them someplace safe to be able to get back to them. Data blocks can be as long as you wish, and may have lengths different from the original when updating.
RecordManager is responsible for handling transactions.
JDBM2 supports only single transaction for data store.
See commit
and roolback
methods for more details.
RecordManader is also factory for primary Maps.
Field Summary | |
---|---|
static long |
NULL_RECID
Recid indicating no record (e.g. |
Method Summary | ||
---|---|---|
void |
clearCache()
Empty cache. |
|
void |
close()
Closes the record manager and release resources. |
|
void |
commit()
Commit (make persistent) all changes since beginning of transaction. |
|
void |
defrag()
Defragments storage, so it consumes less space. |
|
void |
delete(long recid)
Deletes a record. |
|
java.lang.Object |
fetch(long recid)
Fetches a record using standard java object serialization. |
|
|
fetch(long recid,
Serializer<A> serializer)
Fetches a record using a custom serializer. |
|
|
fetch(long recid,
Serializer<A> serializer,
boolean disableCache)
Fetches a record using a custom serializer and optionaly disabled cache |
|
long |
getNamedObject(java.lang.String name)
Obtain the record id of a named object. |
|
|
hashMap(java.lang.String name)
Creates or load existing Primary Hash Map which persists data into DB. |
|
|
hashMap(java.lang.String name,
Serializer<K> keySerializer)
Creates or load existing Primary Hash Map which persists data into DB. |
|
|
hashMap(java.lang.String name,
Serializer<K> keySerializer,
Serializer<V> valueSerializer)
Creates or load existing Primary Hash Map which persists data into DB. |
|
|
insert(A obj,
Serializer<A> serializer)
Inserts a new record using a custom serializer. |
|
long |
insert(java.lang.Object obj)
Inserts a new record using standard java object serialization. |
|
void |
rollback()
Rollback (cancel) all changes since beginning of transaction. |
|
void |
setNamedObject(java.lang.String name,
long recid)
Set the record id of a named object. |
|
|
storeMap(java.lang.String name)
Creates or load existing Primary StoreMap which persists data into DB. |
|
|
storeMap(java.lang.String name,
Serializer<V> valueSerializer)
Creates or load existing StoreMap which persists data into DB. |
|
|
treeMap(java.lang.String name)
Creates or load existing Primary TreeMap which persists data into DB. |
|
|
treeMap(java.lang.String name,
java.util.Comparator<K> keyComparator)
Creates or load existing TreeMap which persists data into DB. |
|
|
treeMap(java.lang.String name,
java.util.Comparator<K> keyComparator,
Serializer<V> valueSerializer)
Creates or load existing TreeMap which persists data into DB. |
|
|
treeMap(java.lang.String name,
java.util.Comparator<K> keyComparator,
Serializer<V> valueSerializer,
Serializer<K> keySerializer)
Creates or load existing TreeMap which persists data into DB. |
|
|
treeMap(java.lang.String name,
Serializer<V> valueSerializer)
Creates or load existing TreeMap which persists data into DB. |
|
|
treeMap(java.lang.String name,
Serializer<V> valueSerializer,
Serializer<K> keySerializer)
Creates or load existing TreeMap which persists data into DB. |
|
|
update(long recid,
A obj,
Serializer<A> serializer)
Updates a record using a custom serializer. |
|
void |
update(long recid,
java.lang.Object obj)
Updates a record using standard java object serialization. |
Field Detail |
---|
static final long NULL_RECID
Method Detail |
---|
long insert(java.lang.Object obj) throws java.io.IOException
obj
- the object for the new record.
java.io.IOException
- when one of the underlying I/O operations fails.<A> long insert(A obj, Serializer<A> serializer) throws java.io.IOException
obj
- the object for the new record.serializer
- a custom serializer
java.io.IOException
- when one of the underlying I/O operations fails.void delete(long recid) throws java.io.IOException
recid
- the rowid for the record that should be deleted.
java.io.IOException
- when one of the underlying I/O operations fails.void update(long recid, java.lang.Object obj) throws java.io.IOException
recid
- the recid for the record that is to be updated.obj
- the new object for the record.
java.io.IOException
- when one of the underlying I/O operations fails or given recid does not exists.<A> void update(long recid, A obj, Serializer<A> serializer) throws java.io.IOException
recid
- the recid for the record that is to be updated.obj
- the new object for the record.serializer
- a custom serializer
java.io.IOException
- when one of the underlying I/O operations failsjava.lang.Object fetch(long recid) throws java.io.IOException
recid
- the recid for the record that must be fetched.
java.io.IOException
- when one of the underlying I/O operations fails.<A> A fetch(long recid, Serializer<A> serializer) throws java.io.IOException
recid
- the recid for the record that must be fetched.serializer
- a custom serializer
java.io.IOException
- when one of the underlying I/O operations fails.<A> A fetch(long recid, Serializer<A> serializer, boolean disableCache) throws java.io.IOException
recid
- the recid for the record that must be fetched.serializer
- a custom serializerdisableCache
- true to disable any caching mechanism
java.io.IOException
- when one of the underlying I/O operations fails.void close() throws java.io.IOException
java.io.IOException
- when one of the underlying I/O operations fails.void clearCache() throws java.io.IOException
java.io.IOException
void defrag() throws java.io.IOException
java.io.IOException
void commit() throws java.io.IOException
java.io.IOException
void rollback() throws java.io.IOException
java.io.IOException
long getNamedObject(java.lang.String name) throws java.io.IOException
java.io.IOException
void setNamedObject(java.lang.String name, long recid) throws java.io.IOException
java.io.IOException
<K,V> PrimaryHashMap<K,V> hashMap(java.lang.String name)
K
- Key typeV
- Value typename
- record name
<K,V> PrimaryHashMap<K,V> hashMap(java.lang.String name, Serializer<K> keySerializer)
K
- Key typeV
- Value typename
- record namekeySerializer
- serializer to be used for Keys
<K,V> PrimaryHashMap<K,V> hashMap(java.lang.String name, Serializer<K> keySerializer, Serializer<V> valueSerializer)
K
- Key typeV
- Value typename
- record namekeySerializer
- serializer to be used for Keys, leave null to use default serializervalueSerializer
- serializer to be used for Values
<K extends java.lang.Comparable,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name)
K
- Key typeV
- Value typename
- record name
<K extends java.lang.Comparable,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name, Serializer<V> valueSerializer)
K
- Key typeV
- Value typename
- record namevalueSerializer
- Serializer used for values. This may reduce disk space usage.
<K extends java.lang.Comparable,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name, Serializer<V> valueSerializer, Serializer<K> keySerializer)
K
- Key typeV
- Value typename
- record namevalueSerializer
- Serializer used for values. This may reduce disk space usage.keySerializer
- Serializer used for keys. This may reduce disk space usage.
<K,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name, java.util.Comparator<K> keyComparator)
K
- Key typeV
- Value typename
- record namekeyComparator
- Comparator used to sort keys
<K,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name, java.util.Comparator<K> keyComparator, Serializer<V> valueSerializer)
K
- Key typeV
- Value typename
- record namekeyComparator
- Comparator used to sort keysvalueSerializer
- Serializer used for values. This may reduce disk space usage
<K,V> PrimaryTreeMap<K,V> treeMap(java.lang.String name, java.util.Comparator<K> keyComparator, Serializer<V> valueSerializer, Serializer<K> keySerializer)
K
- Key typeV
- Value typename
- record namekeyComparator
- Comparator used to sort keysvalueSerializer
- Serializer used for values. This may reduce disk space usagekeySerializer
- Serializer used for keys. This may reduce disk space usage *
<V> PrimaryStoreMap<java.lang.Long,V> storeMap(java.lang.String name, Serializer<V> valueSerializer)
V
- Value typename
- record namevalueSerializer
- Serializer used for values. This may reduce disk space usage
<V> PrimaryStoreMap<java.lang.Long,V> storeMap(java.lang.String name)
V
- Value typename
- record name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |