mirror of
https://github.com/matrix-construct/construct
synced 2024-11-15 14:31:11 +01:00
ircd::db: Support future CanKeysWithDifferentByteContentsBeEqual feature.
This commit is contained in:
parent
941b4ff8eb
commit
f46886e0b8
3 changed files with 11 additions and 0 deletions
|
@ -35,6 +35,7 @@ struct ircd::db::comparator
|
||||||
std::function<bool (const string_view &, const string_view &)> equal;
|
std::function<bool (const string_view &, const string_view &)> equal;
|
||||||
std::function<void (std::string &, const string_view &)> separator;
|
std::function<void (std::string &, const string_view &)> separator;
|
||||||
std::function<void (std::string &)> successor;
|
std::function<void (std::string &)> successor;
|
||||||
|
bool hashable {true};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ircd::db::cmp_string_view
|
struct ircd::db::cmp_string_view
|
||||||
|
|
|
@ -23,6 +23,7 @@ struct ircd::db::database::comparator final
|
||||||
database *d;
|
database *d;
|
||||||
db::comparator user;
|
db::comparator user;
|
||||||
|
|
||||||
|
bool CanKeysWithDifferentByteContentsBeEqual() const noexcept; //TODO: override
|
||||||
bool IsSameLengthImmediateSuccessor(const Slice &s, const Slice &t) const noexcept override;
|
bool IsSameLengthImmediateSuccessor(const Slice &s, const Slice &t) const noexcept override;
|
||||||
void FindShortestSeparator(std::string *start, const Slice &limit) const noexcept override;
|
void FindShortestSeparator(std::string *start, const Slice &limit) const noexcept override;
|
||||||
void FindShortSuccessor(std::string *key) const noexcept override;
|
void FindShortSuccessor(std::string *key) const noexcept override;
|
||||||
|
|
|
@ -1329,6 +1329,15 @@ const noexcept
|
||||||
return rocksdb::Comparator::IsSameLengthImmediateSuccessor(s, t);
|
return rocksdb::Comparator::IsSameLengthImmediateSuccessor(s, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ircd::db::database::comparator::CanKeysWithDifferentByteContentsBeEqual()
|
||||||
|
const noexcept
|
||||||
|
{
|
||||||
|
// When keys with different byte contents can be equal the keys are
|
||||||
|
// not hashable.
|
||||||
|
return !user.hashable;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// database::prefix_transform
|
// database::prefix_transform
|
||||||
|
|
Loading…
Reference in a new issue