The immediate motivation for introducing frozen_mutation is inability to deserialize current "mutation" object, which needs schema reference at the time it's constructed. It needs schema to initialize its internal maps with proper key comparators, which depend on schema. frozen_mutation is an immutable, compact form of a mutation. It doesn't use complex in-memory strucutres, data is stored in a linear buffer. In case of frozen_mutation schema needs to be supplied only at the time mutation partition is visited. Therefore it can be trivially deserialized without schema.
21 lines
518 B
C++
21 lines
518 B
C++
/*
|
|
* Copyright (C) 2015 Cloudius Systems, Ltd.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "database_fwd.hh"
|
|
#include "mutation_partition_visitor.hh"
|
|
|
|
// View on serialized mutation partition. See mutation_partition_serializer.
|
|
class mutation_partition_view {
|
|
bytes_view _bytes;
|
|
private:
|
|
mutation_partition_view(bytes_view v)
|
|
: _bytes(v)
|
|
{ }
|
|
public:
|
|
static mutation_partition_view from_bytes(bytes_view v) { return { v }; }
|
|
void accept(const schema& schema, mutation_partition_visitor& visitor) const;
|
|
};
|