I've been implementing the NVMeOf KV protocol and have a question about implementing
the KV list operation. Currently, I've implemented it as returning the same array of
packed keys expected by the KV protocol, but it strikes me as tying bdev too closely to
the NVME protocol.
A simple solution is to return one key for each list operation, then iteratively increment
the key and pass it back to bdev to search for the next key. Downside is that the bdev
implementation could be expensive to search for a key and that would have to be done for
each and every key.
Another solution is to return a list or array which the controller iterates over to fill
in the NVME list of keys, however this requires the controller to estimate how many keys
will be needed to fill in the results buffer. Since keys are variable length and packed
together that will pose a challenge.
And another solution would be to create bdev operations to iterate over the keys in the
bdev, but that requires at least 3 operations - open, next and close and requires
maintaining state somewhere, probably in the bdev_io itself.
What would be in keeping with the design philosphy of bdev? Keep it as is, returning an
nvme structure of packed keys or something more abstract?