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
Exception
public LevelDB(java.io.File path, KVStoreSerializer serializer) throws Exception
Exception
public <T> T getMetadata(Class<T> klass) throws Exception
KVStore
The 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 KVStore
Exception
public void setMetadata(Object value) throws Exception
KVStore
setMetadata
in interface KVStore
Exception
public <T> T read(Class<T> klass, Object naturalKey) throws Exception
KVStore
public void write(Object value) throws Exception
KVStore
Writes 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
KVStore
public <T> KVStoreView<T> view(Class<T> type) throws Exception
KVStore
public long count(Class<?> type) throws Exception
KVStore
public long count(Class<?> type, String index, Object indexedValue) throws Exception
KVStore
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface AutoCloseable
java.io.IOException