CCF
Loading...
Searching...
No Matches
include
ccf
js
samples
governance_driven_registry.h
Go to the documentation of this file.
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
// Licensed under the Apache 2.0 License.
3
#pragma once
4
5
#include "
ccf/js/registry.h
"
6
#include "
ccf/service/tables/jsengine.h
"
7
#include "
ccf/service/tables/modules.h
"
8
9
namespace
ccf::js
10
{
11
// This sample extends the generic BaseDynamicJSEndpointRegistry to read JS
12
// endpoints (code, metadata, options) from governance tables. Specifically,
13
// tables populated by actions in the default sample CCF constitution
14
// (set_js_app). This can be sub-classed to modify the dispatch or execution
15
// behaviour, or to provide further JS extension APIs via get_extensions().
16
//
17
// An application running this registry with no further extensions is shipped
18
// with the CCF releases as `js_generic`.
19
class
GovernanceDrivenJSRegistry
20
:
public
ccf::js::BaseDynamicJSEndpointRegistry
21
{
22
public
:
23
GovernanceDrivenJSRegistry
(
AbstractNodeContext
&
context
) :
24
// Note: We do not pass a kv_prefix here, instead we explicitly, manually
25
// construct each map name to match previously used values
26
ccf
::js::
BaseDynamicJSEndpointRegistry
(
context
)
27
{
28
modules_map
= ccf::Tables::MODULES;
29
metadata_map
= ccf::endpoints::Tables::ENDPOINTS;
30
interpreter_flush_map
= ccf::Tables::INTERPRETER_FLUSH;
31
modules_quickjs_version_map
= ccf::Tables::MODULES_QUICKJS_VERSION;
32
modules_quickjs_bytecode_map
= ccf::Tables::MODULES_QUICKJS_BYTECODE;
33
runtime_options_map
= ccf::Tables::JSENGINE;
34
}
35
};
36
}
// namespace ccf::js
ccf::BaseEndpointRegistry::context
ccf::AbstractNodeContext & context
Definition
base_endpoint_registry.h:123
ccf::js::BaseDynamicJSEndpointRegistry
Definition
registry.h:41
ccf::js::BaseDynamicJSEndpointRegistry::interpreter_flush_map
std::string interpreter_flush_map
Definition
registry.h:67
ccf::js::BaseDynamicJSEndpointRegistry::modules_quickjs_bytecode_map
std::string modules_quickjs_bytecode_map
Definition
registry.h:69
ccf::js::BaseDynamicJSEndpointRegistry::runtime_options_map
std::string runtime_options_map
Definition
registry.h:70
ccf::js::BaseDynamicJSEndpointRegistry::modules_map
std::string modules_map
Definition
registry.h:65
ccf::js::BaseDynamicJSEndpointRegistry::metadata_map
std::string metadata_map
Definition
registry.h:66
ccf::js::BaseDynamicJSEndpointRegistry::modules_quickjs_version_map
std::string modules_quickjs_version_map
Definition
registry.h:68
ccf::js::GovernanceDrivenJSRegistry
Definition
governance_driven_registry.h:21
ccf::js::GovernanceDrivenJSRegistry::GovernanceDrivenJSRegistry
GovernanceDrivenJSRegistry(AbstractNodeContext &context)
Definition
governance_driven_registry.h:23
jsengine.h
modules.h
ccf::js
Definition
bundle.h:12
ccf
Definition
app_interface.h:14
registry.h
ccf::AbstractNodeContext
Definition
node_context.h:12
Generated by
1.9.8