Skip to content

Commit

Permalink
sstable: allow for empty key_views
Browse files Browse the repository at this point in the history
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
  • Loading branch information
glommer committed May 21, 2015
1 parent 7ebfc7e commit 522b5b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions sstables/key.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion sstables/partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class mp_row_consumer : public row_consumer {

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)
{ }

Expand Down

0 comments on commit 522b5b0

Please sign in to comment.