frozen_mutation: avoid buffer linearization and copy
Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
This commit is contained in:
@@ -80,11 +80,10 @@ frozen_mutation::frozen_mutation(bytes_ostream&& b)
|
||||
, _pk(deserialize_key())
|
||||
{ }
|
||||
|
||||
frozen_mutation::frozen_mutation(bytes_view bv, partition_key pk)
|
||||
: _pk(std::move(pk))
|
||||
{
|
||||
_bytes.write(bv);
|
||||
}
|
||||
frozen_mutation::frozen_mutation(bytes_ostream&& b, partition_key pk)
|
||||
: _bytes(std::move(b))
|
||||
, _pk(std::move(pk))
|
||||
{ }
|
||||
|
||||
frozen_mutation::frozen_mutation(const mutation& m)
|
||||
: _pk(m.key())
|
||||
@@ -162,7 +161,7 @@ frozen_mutation streamed_mutation_freezer::consume_end_of_stream() {
|
||||
std::move(_sr), std::move(_rts),
|
||||
std::move(_crs), std::move(wr));
|
||||
}).end_mutation();
|
||||
return frozen_mutation(out.linearize(), std::move(_key));
|
||||
return frozen_mutation(std::move(out), std::move(_key));
|
||||
}
|
||||
|
||||
future<frozen_mutation> freeze(streamed_mutation sm) {
|
||||
@@ -202,7 +201,7 @@ private:
|
||||
_rts.clear();
|
||||
_crs.clear();
|
||||
_dirty_size = 0;
|
||||
return _consumer(frozen_mutation(out.linearize(), _key), _fragmented);
|
||||
return _consumer(frozen_mutation(std::move(out), _key), _fragmented);
|
||||
}
|
||||
|
||||
future<stop_iteration> maybe_flush() {
|
||||
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
public:
|
||||
frozen_mutation(const mutation& m);
|
||||
explicit frozen_mutation(bytes_ostream&& b);
|
||||
frozen_mutation(bytes_view bv, partition_key key);
|
||||
frozen_mutation(bytes_ostream&& b, partition_key key);
|
||||
frozen_mutation(frozen_mutation&& m) = default;
|
||||
frozen_mutation(const frozen_mutation& m) = default;
|
||||
frozen_mutation& operator=(frozen_mutation&&) = default;
|
||||
|
||||
Reference in New Issue
Block a user