tools/sstable: introduce the Lua sstable consumer

The Lua sstable consumer loads a script from the specified path then
feeds the mutation fragment stream to the script via the
sstable_consumer methods, each method of which the script is allowed to
define, effectively overloading the virtual method in Lua.
This allows for very wide and flexible customization opportunities for
what to extract from sstables and how to process and present them,
without the need to recompile the scylla-sstable tool.
This commit is contained in:
Botond Dénes
2022-09-12 16:18:27 +03:00
parent 50b155e706
commit 9dd5107919
3 changed files with 1490 additions and 1 deletions

View File

@@ -1175,7 +1175,7 @@ scylla_tests_dependencies = scylla_core + idls + scylla_tests_generic_dependenci
scylla_raft_dependencies = scylla_raft_core + ['utils/uuid.cc', 'utils/error_injection.cc']
scylla_tools = ['tools/scylla-types.cc', 'tools/scylla-sstable.cc', 'tools/schema_loader.cc', 'tools/utils.cc']
scylla_tools = ['tools/scylla-types.cc', 'tools/scylla-sstable.cc', 'tools/schema_loader.cc', 'tools/utils.cc', 'tools/lua_sstable_consumer.cc']
deps = {
'scylla': idls + ['main.cc'] + scylla_core + api + alternator + redis + scylla_tools,

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2022-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include <seastar/util/program-options.hh>
#include "schema_fwd.hh"
#include "tools/sstable_consumer.hh"
class reader_permit;
/// Sstable consumer consuming the content via a lua script
///
/// Loads the script from /p script_path and feeds the consumed content to the
/// script.
/// See the help section for the script operation in ./scylla-sstable.cc for more
/// details on the Lua API.
future<std::unique_ptr<sstable_consumer>> make_lua_sstable_consumer(schema_ptr s, reader_permit p, std::string_view script_path,
program_options::string_map script_args);