feat(lsm): store iterators

This commit is contained in:
Jef Roosens 2023-12-23 14:29:33 +01:00
parent f4d711365d
commit 222b277eef
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
4 changed files with 100 additions and 0 deletions

View file

@ -228,4 +228,40 @@ lsm_error lsm_entry_data_read(uint64_t *out, char *buf,
*/
uint64_t lsm_entry_data_len(lsm_entry_handle *handle);
/**
* Represents an in-flight iterator over an LSM store.
*/
typedef struct lsm_store_iterator lsm_store_iterator;
/**
* Initialize an iterator to iterate over all entries with keys starting
* with the given prefix.
*
* @param out pointer to store iterator pointer in
* @param trie trie to iterate
* @param prefix prefix of the keys; a zero-length string means iterating over
* the entire trie; NULL is interpreted as a zero-length string
*/
lsm_error lsm_store_iter(lsm_store_iterator **out, lsm_store *store,
const lsm_str *prefix);
/**
* Advance the iterator, returning a read handle to the next entry. The caller
* is responsible for closing this handle.
*/
lsm_error lsm_store_iter_next_read(lsm_entry_handle **out,
lsm_store_iterator *iter);
/**
* Advance the iterator, returning a write handle to the next entry. The caller
* is responsible for closing this handle.
*/
/* lsm_error lsm_store_iter_next_write(lsm_entry_handle **out,
* lsm_store_iterator *iter); */
/**
* Free the given iterator.
*/
void lsm_store_iter_free(lsm_store_iterator *iter);
#endif