In the following patch we plan to remove the base schema from the base_info to make the base_info immutable. To do that, we first prepare the schema registry for the change; we need to be able to create view schemas from frozen schemas there and frozen schemas have no information about the base table. Unless we do this change, after base schemas are removed from the base info, we'll no longer be able to load a view schema to the schema registry without looking up the base schema in the database. This change also required some updates to schema building: * we add a method for unfreezing a view schema with base info instead of a base schema * we make it possible to use schema_builder with a base info instead of a base schema * we add a method for creating a view schema from mutations with a base info instead of a base schema * we add a view_info constructor withat base info instead of a base schema * we update the naming in schema_registry to reflect the usage of base info instead of base schema
34 lines
930 B
C++
34 lines
930 B
C++
/*
|
|
* Copyright 2015-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "schema/schema_fwd.hh"
|
|
#include "mutation/frozen_mutation.hh"
|
|
#include "bytes_ostream.hh"
|
|
#include "db/view/base_info.hh"
|
|
|
|
namespace db {
|
|
class schema_ctxt;
|
|
}
|
|
|
|
// Transport for schema_ptr across shards/nodes.
|
|
// It's safe to access from another shard by const&.
|
|
class frozen_schema {
|
|
bytes_ostream _data;
|
|
public:
|
|
explicit frozen_schema(bytes_ostream);
|
|
frozen_schema(const schema_ptr&);
|
|
frozen_schema(frozen_schema&&) = default;
|
|
frozen_schema(const frozen_schema&) = default;
|
|
frozen_schema& operator=(const frozen_schema&) = default;
|
|
frozen_schema& operator=(frozen_schema&&) = default;
|
|
schema_ptr unfreeze(const db::schema_ctxt&, std::optional<db::view::base_dependent_view_info> base_info = {}) const;
|
|
const bytes_ostream& representation() const;
|
|
};
|