main: add wasm engine instantiation

Once the engine is up, it can be used to execute user-defined
functions.
This commit is contained in:
Piotr Sarna
2021-08-05 11:31:46 +02:00
parent 62e8c89a9c
commit 4959136afd
2 changed files with 9 additions and 2 deletions

View File

@@ -38,13 +38,13 @@ seastar::future<> init_sharded_engine(seastar::sharded<engine>& e) {
// It's highly probable that a more generic support for yielding
// can be contributed to wasmtime.
const uint64_t initial_fuel_amount = 20*1024;
e.start(initial_fuel_amount).get();
return e.start(initial_fuel_amount);
}
#else
seastar::future<> init_sharded_engine(seastar::sharded<engine>& e) {
return seastar::make_ready_future<>();
return e.start();
}

View File

@@ -91,6 +91,7 @@
#include "service/qos/standard_service_level_distributed_data_accessor.hh"
#include "service/storage_proxy.hh"
#include "alternator/controller.hh"
#include "lang/wasm_engine.hh"
#include "service/raft/raft_group_registry.hh"
@@ -584,6 +585,9 @@ int main(int ac, char** av) {
}
gms::feature_config fcfg = gms::feature_config_from_db_config(*cfg);
static sharded<wasm::engine> wasm_engine;
wasm::init_sharded_engine(wasm_engine).get();
feature_service.start(fcfg).get();
// FIXME storage_proxy holds a reference on it and is not yet stopped.
// also the proxy leaves range_slice_read_executor-s hanging around
@@ -868,6 +872,9 @@ int main(int ac, char** av) {
});
db.start(std::ref(*cfg), dbcfg, std::ref(mm_notifier), std::ref(feature_service), std::ref(token_metadata), std::ref(stop_signal.as_sharded_abort_source()), std::ref(sst_dir_semaphore)).get();
db.invoke_on_all([] (database& db) {
db.set_wasm_engine(&wasm_engine.local());
}).get();
start_large_data_handler(db).get();
auto stop_database_and_sstables = defer_verbose_shutdown("database", [&db] {
// #293 - do not stop anything - not even db (for real)