mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-26 19:35:12 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user