From 4b7e5d05652c0203a139bb901604f0043b9de394 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Tue, 26 May 2015 15:21:25 -0400 Subject: [PATCH] sstable: describe composite type This way, we don't need to rely on an external byte_view conversion to write this element. Note that because we don't have a writer to const byte&, we will cast away the qualifier. Signed-off-by: Glauber Costa --- sstables/key.hh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sstables/key.hh b/sstables/key.hh index 000bda3090..c2af2c68e2 100644 --- a/sstables/key.hh +++ b/sstables/key.hh @@ -6,6 +6,7 @@ #include "bytes.hh" #include "schema.hh" #include +#include "core/future.hh" class partition_key; class clustering_key; @@ -112,10 +113,14 @@ class composite { bytes _bytes; public: composite (bytes&& b) : _bytes(std::move(b)) {} + template + future<> describe_type(Describer f) const { return f(const_cast(_bytes)); } + static composite from_bytes(bytes b) { return composite(std::move(b)); } static composite from_clustering_key(const schema& s, const clustering_key& ck); static composite from_exploded(const std::vector& v); static composite static_prefix(const schema& s); + size_t size() const { return _bytes.size(); } explicit operator bytes_view() const { return _bytes; }