|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.priv.garshol.duke.InMemoryKeyValueStore
public class InMemoryKeyValueStore
A simple key value store that keeps all data in memory.
Constructor Summary | |
---|---|
InMemoryKeyValueStore()
|
Method Summary | |
---|---|
void |
close()
Stores state to disk and closes all open resources. |
void |
commit()
Flushes all changes to disk. |
Record |
findRecordById(long id)
Returns the record with the given internal ID. |
Record |
findRecordById(String extid)
Returns the record with the given external ID. |
boolean |
isInMemory()
Returns true iff the database is held entirely in memory, and thus is not persistent. |
Bucket |
lookupToken(String propname,
String token)
Returns the IDs of all records which have the given token in a value for this property. |
long |
makeNewRecordId()
Returns a new internal record ID. |
void |
registerId(long id,
String extid)
Records that this external ID refers to the given internal record ID. |
void |
registerRecord(long id,
Record record)
Stores the entire record under the given internal record ID. |
void |
registerToken(long id,
String propname,
String token)
Records that the given token occurred in the given record. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InMemoryKeyValueStore()
Method Detail |
---|
public boolean isInMemory()
KeyValueStore
isInMemory
in interface KeyValueStore
public void commit()
KeyValueStore
commit
in interface KeyValueStore
public void close()
KeyValueStore
close
in interface KeyValueStore
public long makeNewRecordId()
KeyValueStore
makeNewRecordId
in interface KeyValueStore
public void registerRecord(long id, Record record)
KeyValueStore
registerRecord
in interface KeyValueStore
public void registerId(long id, String extid)
KeyValueStore
registerId
in interface KeyValueStore
id
- the internal record IDextid
- the external IDpublic void registerToken(long id, String propname, String token)
KeyValueStore
registerToken
in interface KeyValueStore
id
- the ID of the record the token occurred inpropname
- the property the token occurred intoken
- the actual tokenpublic Record findRecordById(String extid)
KeyValueStore
findRecordById
in interface KeyValueStore
public Record findRecordById(long id)
KeyValueStore
findRecordById
in interface KeyValueStore
public Bucket lookupToken(String propname, String token)
KeyValueStore
lookupToken
in interface KeyValueStore
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |