facebook / facebook/rocksdb

API request: SeekForBase

Open
#12,357 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
32.1k
Forks
6.9k
Avg merge
32m
Merged PRs (30d)
1

Description

Hello!

I'm looking for a way to find the longest key that matches a given prefix.
For example, given the keys:
```
1
12
123
```
If I look for `124` and there's no exact match, I'd like to get key `12` (the closest match with identical prefix -- not `1`).
This is useful when a tree is stored in rocksDB where each tree node is stored by its path down the tree, and I want to find the closest node in the tree for a given key.
The `SeekForPrev` API would return `123` in this example, so it's not a good fit.
Am I missing some API that supports this?
If not, could this feature be considered?

Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.