Package org.ldk.structs
Interface KVStore.KVStoreInterface
-
- Enclosing class:
- KVStore
public static interface KVStore.KVStoreInterface
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Result_CVec_StrZIOErrorZlist(String primary_namespace, String secondary_namespace)Returns a list of keys that are stored under the given `secondary_namespace` in `primary_namespace`.Result_CVec_u8ZIOErrorZread(String primary_namespace, String secondary_namespace, String key)Returns the data stored for the given `primary_namespace`, `secondary_namespace`, and `key`.Result_NoneIOErrorZremove(String primary_namespace, String secondary_namespace, String key, boolean lazy)Removes any data that had previously been persisted under the given `key`.Result_NoneIOErrorZwrite(String primary_namespace, String secondary_namespace, String key, byte[] buf)Persists the given data under the given `key`.
-
-
-
Method Detail
-
read
Result_CVec_u8ZIOErrorZ read(String primary_namespace, String secondary_namespace, String key)
Returns the data stored for the given `primary_namespace`, `secondary_namespace`, and `key`. Returns an [`ErrorKind::NotFound`] if the given `key` could not be found in the given `primary_namespace` and `secondary_namespace`. [`ErrorKind::NotFound`]: io::ErrorKind::NotFound
-
write
Result_NoneIOErrorZ write(String primary_namespace, String secondary_namespace, String key, byte[] buf)
Persists the given data under the given `key`. Will create the given `primary_namespace` and `secondary_namespace` if not already present in the store.
-
remove
Result_NoneIOErrorZ remove(String primary_namespace, String secondary_namespace, String key, boolean lazy)
Removes any data that had previously been persisted under the given `key`. If the `lazy` flag is set to `true`, the backend implementation might choose to lazily remove the given `key` at some point in time after the method returns, e.g., as part of an eventual batch deletion of multiple keys. As a consequence, subsequent calls to [`KVStore::list`] might include the removed key until the changes are actually persisted. Note that while setting the `lazy` flag reduces the I/O burden of multiple subsequent `remove` calls, it also influences the atomicity guarantees as lazy `remove`s could potentially get lost on crash after the method returns. Therefore, this flag should only be set for `remove` operations that can be safely replayed at a later time. Returns successfully if no data will be stored for the given `primary_namespace`, `secondary_namespace`, and `key`, independently of whether it was present before its invokation or not.
-
list
Result_CVec_StrZIOErrorZ list(String primary_namespace, String secondary_namespace)
Returns a list of keys that are stored under the given `secondary_namespace` in `primary_namespace`. Returns the keys in arbitrary order, so users requiring a particular order need to sort the returned keys. Returns an empty list if `primary_namespace` or `secondary_namespace` is unknown.
-
-