| Modifier and Type | Class and Description |
|---|---|
static class |
LevelDB.TypeAliases
Needs to be public for Jackson.
|
| Constructor and Description |
|---|
LevelDB(java.io.File path) |
LevelDB(java.io.File path,
KVStoreSerializer serializer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
count(Class<?> type)
Returns the number of items of the given type currently in the store.
|
long |
count(Class<?> type,
String index,
Object indexedValue)
Returns the number of items of the given type which match the given indexed value.
|
void |
delete(Class<?> type,
Object naturalKey)
Removes an object and all data related to it, like index entries, from the store.
|
<T> T |
getMetadata(Class<T> klass)
Returns app-specific metadata from the store, or null if it's not currently set.
|
<T> T |
read(Class<T> klass,
Object naturalKey)
Read a specific instance of an object.
|
void |
setMetadata(Object value)
Writes the given value in the store metadata key.
|
<T> KVStoreView<T> |
view(Class<T> type)
Returns a configurable view for iterating over entities of the given type.
|
void |
write(Object value)
Writes the given object to the store, including indexed fields.
|
public LevelDB(java.io.File path)
throws Exception
Exceptionpublic LevelDB(java.io.File path,
KVStoreSerializer serializer)
throws Exception
Exceptionpublic <T> T getMetadata(Class<T> klass)
throws Exception
KVStoreThe metadata type is application-specific. This is a convenience method so that applications don't need to define their own keys for this information.
getMetadata in interface KVStoreExceptionpublic void setMetadata(Object value)
throws Exception
KVStoresetMetadata in interface KVStoreExceptionpublic <T> T read(Class<T> klass,
Object naturalKey)
throws Exception
KVStorepublic void write(Object value)
throws Exception
KVStoreWrites may be slower when the object already exists in the store, since it will involve updating existing indices.
public void delete(Class<?> type,
Object naturalKey)
throws Exception
KVStorepublic <T> KVStoreView<T> view(Class<T> type) throws Exception
KVStorepublic long count(Class<?> type)
throws Exception
KVStorepublic long count(Class<?> type,
String index,
Object indexedValue)
throws Exception
KVStorepublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface AutoCloseablejava.io.IOException