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 <glommer@cloudius-systems.com>
This commit is contained in:
Glauber Costa
2015-05-26 15:21:25 -04:00
parent 414502fe21
commit 4b7e5d0565

View File

@@ -6,6 +6,7 @@
#include "bytes.hh"
#include "schema.hh"
#include <boost/any.hpp>
#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 <typename Describer>
future<> describe_type(Describer f) const { return f(const_cast<bytes&>(_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<bytes_view>& v);
static composite static_prefix(const schema& s);
size_t size() const { return _bytes.size(); }
explicit operator bytes_view() const {
return _bytes;
}