MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
jit_executor::JitExecutorComponent Class Reference

Registry of graal contexts to be used by each service. More...

#include <jit_executor_component.h>

Public Member Functions

 ~JitExecutorComponent ()
 
 JitExecutorComponent (JitExecutorComponent const &)=delete
 
void operator= (JitExecutorComponent const &)=delete
 
 JitExecutorComponent (JitExecutorComponent &&)=delete
 
void operator= (JitExecutorComponent &&)=delete
 
void stop_debug_context (const std::string &service_id)
 
std::shared_ptr< IContextHandleget_context (const std::string &service_id, const ServiceHandlerConfig &config, const std::string &debug_port="", bool reset_context=false)
 
void update_global_config (const std::string &options)
 

Static Public Member Functions

static JitExecutorComponentget_instance ()
 

Private Member Functions

 JitExecutorComponent ()=default
 
void update_active_contexts (const std::pair< std::string, std::shared_ptr< IServiceHandlers > > &replacement={})
 

Private Attributes

std::mutex m_context_creation
 
GlobalConfig m_global_config
 
std::unordered_map< std::string, std::shared_ptr< IServiceHandlers > > m_service_context_handlers
 
std::vector< std::shared_ptr< IServiceHandlers > > m_inactive_context_handlers
 

Detailed Description

Registry of graal contexts to be used by each service.

NOTE: The original idea, was to have a pool of contexts on which the service module files would be loaded once and then shared across the contexts in the pool. The script end points would be getting a context from the pool use it and the release it. However, the main pre-requisite for that is that the context could be reset to the original state, which is NOT possible in Graal.

Suggestion from the Graal Team

By default, each context would internally create an engine which would hold the resources used in the context. However, it is possible to use a common engine to enable the sharing of the resources across contexts (i.e. including parsed source code). Following this approach the context pool is not needed since we would simply create/release the context on demand and it would use the shared resources from the engine.

Even this is the current implementation, expectation was that the module files would be loaded only ONCE but that's not the case, they get reloaded on every created context, even the shared engine is used.

This class holds a registry of service ids vs ContextHandlers (who keep the shared engine) and allows creating a context using the shared engine.

Constructor & Destructor Documentation

◆ ~JitExecutorComponent()

jit_executor::JitExecutorComponent::~JitExecutorComponent ( )

◆ JitExecutorComponent() [1/3]

jit_executor::JitExecutorComponent::JitExecutorComponent ( JitExecutorComponent const &  )
delete

◆ JitExecutorComponent() [2/3]

jit_executor::JitExecutorComponent::JitExecutorComponent ( JitExecutorComponent &&  )
delete

◆ JitExecutorComponent() [3/3]

jit_executor::JitExecutorComponent::JitExecutorComponent ( )
privatedefault

Member Function Documentation

◆ get_context()

std::shared_ptr< IContextHandle > jit_executor::JitExecutorComponent::get_context ( const std::string &  service_id,
const ServiceHandlerConfig config,
const std::string &  debug_port = "",
bool  reset_context = false 
)

◆ get_instance()

JitExecutorComponent & jit_executor::JitExecutorComponent::get_instance ( )
static

◆ operator=() [1/2]

void jit_executor::JitExecutorComponent::operator= ( JitExecutorComponent &&  )
delete

◆ operator=() [2/2]

void jit_executor::JitExecutorComponent::operator= ( JitExecutorComponent const &  )
delete

◆ stop_debug_context()

void jit_executor::JitExecutorComponent::stop_debug_context ( const std::string &  service_id)

◆ update_active_contexts()

void jit_executor::JitExecutorComponent::update_active_contexts ( const std::pair< std::string, std::shared_ptr< IServiceHandlers > > &  replacement = {})
private

◆ update_global_config()

void jit_executor::JitExecutorComponent::update_global_config ( const std::string &  options)

Member Data Documentation

◆ m_context_creation

std::mutex jit_executor::JitExecutorComponent::m_context_creation
private

◆ m_global_config

GlobalConfig jit_executor::JitExecutorComponent::m_global_config
private

◆ m_inactive_context_handlers

std::vector<std::shared_ptr<IServiceHandlers> > jit_executor::JitExecutorComponent::m_inactive_context_handlers
private

◆ m_service_context_handlers

std::unordered_map<std::string, std::shared_ptr<IServiceHandlers> > jit_executor::JitExecutorComponent::m_service_context_handlers
private

The documentation for this class was generated from the following files: