ABI function for iterating over all the keys in the lookup data
This may be useful for use cases in which the code is trying to find the best (e.g. closest) item in the list of items.
@conradgrobler you had some ideas related to the leveldb, perhaps we could "emulate" (a subset of) its API, do you have any pointers to that? I think @mariaschett could help with this once we get more details.
A general overview of leveldb is at https://github.com/google/leveldb/blob/master/doc/index.md
The idea is to extened the lookup data feature to support a read-only version of the leveldb features. We already have a key-based lookup of data, so the main missing part is support for iterators (https://github.com/google/leveldb/blob/master/include/leveldb/iterator.h).
To implement this iteratively, I think the following steps could be a good approach:
- Make the lookup data feature optional/pluggable similar to the ML and metrics features
- Add a new lookup data feature that internally uses a tree map to support sorted data
- Add iterator support to the ABI (e.g. create, seek, seek_to_first, seek_to_last, next, previous)
- Add iterator support to the SDK
Possibly relevant: https://doc.rust-lang.org/std/collections/struct.BTreeMap.html#
As first step, I wonder whether just switching from a hash map to a b-tree map may be a good stand-alone PR, so that we can check there are no regressions. Once that is submitted, then we can think about the additional API changes to expose to Wasm modules.
Also https://github.com/project-oak/oak/issues/2050 may be a prerequisite for this change.
As first step, I wonder whether just switching from a hash map to a b-tree map may be a good stand-alone PR, so that we can check there are no regressions. Once that is submitted, then we can think about the additional API changes to expose to Wasm modules.
Agreed: #2317