Move frozen_schema to idl

This commit is contained in:
Gleb Natapov
2016-01-28 11:26:00 +02:00
parent b95c15f040
commit 60e3637efc
5 changed files with 45 additions and 2 deletions

View File

@@ -471,6 +471,7 @@ idls = ['idl/gossip_digest.idl.hh',
'idl/reconcilable_result.idl.hh',
'idl/streaming.idl.hh',
'idl/paging_state.idl.hh',
'idl/frozen_schema.idl.hh',
]
scylla_tests_dependencies = scylla_core + api + idls + [

View File

@@ -46,6 +46,11 @@ frozen_schema::frozen_schema(bytes b)
: _data(std::move(b))
{ }
bytes_view frozen_schema::representation() const
{
return _data;
}
template<>
db::serializer<frozen_schema>::serializer(const frozen_schema& v)
: _item(v)

View File

@@ -30,9 +30,8 @@
// It's safe to access from another shard by const&.
class frozen_schema {
bytes _data;
private:
frozen_schema(bytes);
public:
explicit frozen_schema(bytes);
frozen_schema(const schema_ptr&);
frozen_schema(frozen_schema&&) = default;
frozen_schema(const frozen_schema&) = default;
@@ -40,6 +39,7 @@ public:
frozen_schema& operator=(frozen_schema&&) = default;
schema_ptr unfreeze() const;
friend class db::serializer<frozen_schema>;
bytes_view representation() const;
};
namespace db {

24
idl/frozen_schema.idl.hh Normal file
View File

@@ -0,0 +1,24 @@
/*
* Copyright 2016 ScyllaDB
*/
/*
* This file is part of Scylla.
*
* Scylla is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Scylla is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
*/
class frozen_schema final {
bytes representation();
};

View File

@@ -41,6 +41,7 @@
#include "idl/keys.dist.hh"
#include "idl/uuid.dist.hh"
#include "idl/frozen_mutation.dist.hh"
#include "idl/frozen_schema.dist.hh"
#include "idl/streaming.dist.hh"
#include "idl/token.dist.hh"
#include "idl/gossip_digest.dist.hh"
@@ -53,6 +54,7 @@
#include "idl/keys.dist.impl.hh"
#include "idl/uuid.dist.impl.hh"
#include "idl/frozen_mutation.dist.impl.hh"
#include "idl/frozen_schema.dist.impl.hh"
#include "idl/streaming.dist.impl.hh"
#include "idl/token.dist.impl.hh"
#include "idl/gossip_digest.dist.impl.hh"
@@ -217,6 +219,17 @@ read(serializer, Input& in, boost::type<frozen_mutation> type) {
return ser::deserialize(in, type);
}
template<typename Output>
void write(serializer, Output& out, const frozen_schema& data) {
ser::serialize(out, data);
}
template <typename Input>
frozen_schema
read(serializer, Input& in, boost::type<frozen_schema> type) {
return ser::deserialize(in, type);
}
template<typename Output>
void write(serializer, Output& out, const reconcilable_result& data) {
ser::serialize(out, data);