0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-27 11:18:51 +02:00

ircd::db: Support future CanKeysWithDifferentByteContentsBeEqual feature.

This commit is contained in:
Jason Volk 2018-10-31 11:25:07 -07:00
parent 941b4ff8eb
commit f46886e0b8
3 changed files with 11 additions and 0 deletions

View file

@ -35,6 +35,7 @@ struct ircd::db::comparator
std::function<bool (const string_view &, const string_view &)> equal;
std::function<void (std::string &, const string_view &)> separator;
std::function<void (std::string &)> successor;
bool hashable {true};
};
struct ircd::db::cmp_string_view

View file

@ -23,6 +23,7 @@ struct ircd::db::database::comparator final
database *d;
db::comparator user;
bool CanKeysWithDifferentByteContentsBeEqual() const noexcept; //TODO: override
bool IsSameLengthImmediateSuccessor(const Slice &s, const Slice &t) const noexcept override;
void FindShortestSeparator(std::string *start, const Slice &limit) const noexcept override;
void FindShortSuccessor(std::string *key) const noexcept override;

View file

@ -1329,6 +1329,15 @@ const noexcept
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