public interface DataStore
Provides methods for storing, retrieving, and managing database entries including RouterInfo and LeaseSet objects with optional persistence control.
| Modifier and Type | Method and Description |
|---|---|
int |
countLeaseSets()
Count the number of LeaseSet entries in the store.
|
boolean |
forcePut(Hash key,
DatabaseEntry data) |
DatabaseEntry |
get(Hash key)
Retrieve the database entry for the given key.
|
DatabaseEntry |
get(Hash key,
boolean persist)
Retrieve the database entry for the given key with optional persistence control.
|
Collection<DatabaseEntry> |
getEntries() |
Set<Hash> |
getKeys()
Get all keys stored in the data store.
|
Set<Map.Entry<Hash,DatabaseEntry>> |
getMapEntries() |
boolean |
isInitialized()
Check if the data store has been initialized.
|
boolean |
isKnown(Hash key)
Check if the given key exists in the data store.
|
boolean |
put(Hash key,
DatabaseEntry data)
Store a database entry with the given key.
|
boolean |
put(Hash key,
DatabaseEntry data,
boolean persist)
Store a database entry with the given key and persistence control.
|
DatabaseEntry |
remove(Hash key)
Remove the entry for the given key.
|
DatabaseEntry |
remove(Hash key,
boolean persist)
Remove the entry for the given key with optional persistence control.
|
void |
rescan()
Rescan the storage for any changes.
|
int |
size() |
void |
stop()
Stop the data store and release resources.
|
int countLeaseSets()
boolean forcePut(Hash key, DatabaseEntry data)
DatabaseEntry get(Hash key)
key - the hash key to look upDatabaseEntry get(Hash key, boolean persist)
key - the hash key to look uppersist - if true, keep the entry in persistent storageCollection<DatabaseEntry> getEntries()
Set<Map.Entry<Hash,DatabaseEntry>> getMapEntries()
boolean isInitialized()
boolean isKnown(Hash key)
key - the hash key to look upboolean put(Hash key, DatabaseEntry data)
key - the hash key to store underdata - the database entry to storeboolean put(Hash key, DatabaseEntry data, boolean persist)
key - the hash key to store underdata - the database entry to storepersist - if true, keep the entry in persistent storageDatabaseEntry remove(Hash key)
key - the hash key to removeDatabaseEntry remove(Hash key, boolean persist)
key - the hash key to removepersist - if true, also remove from persistent storagevoid rescan()
int size()
void stop()