sstable: allow for empty key_views

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This commit is contained in:
Glauber Costa
2015-05-20 15:43:30 -04:00
parent 7ebfc7ef99
commit 522b5b0302
2 changed files with 4 additions and 1 deletions

View File

@@ -16,12 +16,15 @@ class key_view {
bytes_view _bytes;
public:
key_view(bytes_view b) : _bytes(b) {}
key_view() : _bytes() {}
std::vector<bytes> explode(const schema& s) const;
bool operator==(const key_view& k) const { return k._bytes == _bytes; }
bool operator!=(const key_view& k) const { return !(k == *this); }
bool empty() { return _bytes.empty(); }
explicit operator bytes_view() const {
return _bytes;
}

View File

@@ -224,7 +224,7 @@ public:
mp_row_consumer(const key& key, const schema_ptr _schema)
: _schema(_schema)
, _key(key)
, _key(key_view(key))
, mut(partition_key::from_exploded(*_schema, key.explode(*_schema)), _schema)
{ }