mirror of
https://github.com/matrix-construct/construct
synced 2024-12-03 04:02:47 +01:00
ircd::db: Fix workaround for reverse prefix iteration.
This commit is contained in:
parent
6e7d63ce6d
commit
ef27ae50dc
1 changed files with 10 additions and 5 deletions
15
ircd/db.cc
15
ircd/db.cc
|
@ -2358,15 +2358,20 @@ ircd::db::seek(domain::const_iterator_base &it,
|
||||||
{
|
{
|
||||||
switch(p)
|
switch(p)
|
||||||
{
|
{
|
||||||
|
// This is inefficient as per RocksDB's prefix impl.
|
||||||
case pos::BACK:
|
case pos::BACK:
|
||||||
{
|
{
|
||||||
// This is inefficient as per RocksDB's prefix impl. unknown why
|
char buf[512];
|
||||||
// a seek to NEXT is still needed after walking back one.
|
string_view key;
|
||||||
|
assert(bool(it)); do
|
||||||
|
{
|
||||||
|
assert(size(it.it->key()) <= sizeof(buf));
|
||||||
|
key = string_view(buf, copy(buf, slice(it.it->key())));
|
||||||
|
}
|
||||||
while(seek(it, pos::NEXT));
|
while(seek(it, pos::NEXT));
|
||||||
if(seek(it, pos::PREV))
|
|
||||||
seek(it, pos::NEXT);
|
|
||||||
|
|
||||||
return bool(it);
|
assert(key);
|
||||||
|
return seek(it, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue