<commit_before>/*
 * Copyright 2019 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 Affero General Public License
 * along with Scylla.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include <seastar/core/future.hh>
#include <seastar/http/httpd.hh>
#include "seastarx.hh"
#include <seastar/json/json_elements.hh>

#include "service/storage_proxy.hh"
#include "service/migration_manager.hh"
#include "service/client_state.hh"

#include "stats.hh"

namespace alternator {

class executor {
    service::storage_proxy& _proxy;
    service::migration_manager& _mm;

public:
    using client_state = service::client_state;
    stats _stats;
    static constexpr auto ATTRS_COLUMN_NAME = ":attrs";
    static constexpr auto KEYSPACE_NAME = "alternator";

    executor(service::storage_proxy& proxy, service::migration_manager& mm) : _proxy(proxy), _mm(mm) {}

    future<json::json_return_type> create_table(client_state& client_state, std::string content);
    future<json::json_return_type> describe_table(client_state& client_state, std::string content);
    future<json::json_return_type> delete_table(client_state& client_state, std::string content);
    future<json::json_return_type> put_item(client_state& client_state, std::string content);
    future<json::json_return_type> get_item(client_state& client_state, std::string content);
    future<json::json_return_type> delete_item(client_state& client_state, std::string content);
    future<json::json_return_type> update_item(client_state& client_state, std::string content);<commit_msg>alternator: make "executor" a peering_sharded_service<commit_after>/*
 * Copyright 2019 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 Affero General Public License
 * along with Scylla.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include <seastar/core/future.hh>
#include <seastar/http/httpd.hh>
#include "seastarx.hh"
#include <seastar/json/json_elements.hh>
#include <seastar/core/sharded.hh>

#include "service/storage_proxy.hh"
#include "service/migration_manager.hh"
#include "service/client_state.hh"

#include "stats.hh"

namespace alternator {

class executor : public peering_sharded_service<executor> {
    service::storage_proxy& _proxy;
    service::migration_manager& _mm;

public:
    using client_state = service::client_state;
    stats _stats;
    static constexpr auto ATTRS_COLUMN_NAME = ":attrs";
    static constexpr auto KEYSPACE_NAME = "alternator";

    executor(service::storage_proxy& proxy, service::migration_manager& mm) : _proxy(proxy), _mm(mm) {}

    future<json::json_return_type> create_table(client_state& client_state, std::string content);
    future<json::json_return_type> describe_table(client_state& client_state, std::string content);
    future<json::json_return_type> delete_table(client_state& client_state, std::string content);
    future<json::json_return_type> put_item(client_state& client_state, std::string content);
    future<json::json_return_type> get_item(client_state& client_state, std::string content);
    future<json::json_return_type> delete_item(client_state& client_state, std::string content);
    future<json::json_return_type> update_item(client_state& client_state, std::string content);
{'fraction_non_alphanumeric': 0.1000461041954818, 'fraction_numerical': 0.002305209774089442, 'mean_word_length': 5.37151248164464, 'pattern_counts': {'":': 2, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5357844', 'n_tokens_mistral': 1320, 'n_tokens_neox': 1303, 'n_words': 389}