sstable: convenient view for types

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
This commit is contained in:
Glauber Costa
2015-04-21 20:33:29 -04:00
parent 7c7da26347
commit 8508a246bb

View File

@@ -18,6 +18,9 @@ namespace sstables {
template <typename Size>
struct disk_string {
bytes value;
explicit operator bytes_view() const {
return value;
}
};
template <typename Size, typename Members>
@@ -51,12 +54,20 @@ struct index_entry {
disk_string<uint16_t> key;
uint64_t position;
disk_string<uint32_t> promoted_index;
explicit operator bytes_view() const {
return bytes_view(key);
}
};
struct summary_entry {
bytes key;
uint64_t position;
explicit operator bytes_view() const {
return key;
}
bool operator==(const summary_entry& x) const {
return position == x.position && key == x.key;
}