class PlaceOS::Core::ModuleManager

Included Modules

Defined in:

placeos-core/module_manager.cr

Constant Summary

REDIS_VERSION_CHANNEL = "cluster/cluster_version"

Redis channel that cluster leader publishes stable cluster versions to

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.instance : ModuleManager #

Singleton configured from environment


[View source]
def self.new(uri : String | URI, clustering : Clustering | Nil = nil) #

Start up process is as follows..

  • registered
  • consist hash all modules to determine loadable modules
  • lazily start the driver processes
  • launch the modules on those processes etc
  • once load complete, mark in etcd that load is complete

[View source]

Class Method Detail

def self.core_uri(mod : Model::Module | String, rendezvous_hash : RendezvousHash) #

[View source]
def self.execute_payload(method : String | Symbol, args : Enumerable | Nil = nil, named_args : Hash | NamedTuple | Nil = nil) #

[View source]
def self.hash_id(mod : String | Model::Module) #

Route via edge_id if the Module is on an Edge, otherwise the Module's id


[View source]
def self.needs_restart?(mod : Model::Module) : Bool #

[View source]
def self.start_payload(mod : Model::Module) #

[View source]
def self.uri : URI #

[View source]
def self.uri=(uri : URI) #

[View source]

Instance Method Detail

def clustering : Clustering #

[View source]
def discovery : Clustering::Discovery #

[View source]
def edge_processes : Edge::Server #

Manager for remote edge module processes


[View source]
def load_module(mod : Model::Module, rendezvous_hash : RendezvousHash = discovery.rendezvous) #

Load the module if current node is responsible


[View source]
def local_processes : ProcessManager::Local #

Manager for local module processes


[View source]
def manage_edge(*args, **options) #

[View source]
def manage_edge(*args, **options, &) #

[View source]
def on_managed_edge?(mod : Model::Module) #

Determine if a module is an edge module and allocated to the current core node.


[View source]
def own_node?(*args, **options) #

[View source]
def own_node?(*args, **options, &) #

[View source]
def path_for?(*args, **options) #

[View source]
def path_for?(*args, **options, &) #

[View source]
def process_manager(mod : Model::Module | String, & : ProcessManager -> ) #

Delegate Model::Module to a ProcessManager, either local or on an edge


[View source]
def process_manager(driver_key : String, edge_id : String | Nil) : ProcessManager | Nil #

[View source]
def process_resource(action : Resource::Action, resource mod : Model::Module) : Resource::Result #

[View source]
def publish_version(cluster_version : String) #

Publish cluster version to redis


[View source]
def refresh_module(mod : Model::Module) #

Update/start modules with new configuration


[View source]
def reload_modules(driver : Model::Driver) : Path | Nil #

Stops modules on stale driver and starts them on the new driver

Returns the stale driver path


[View source]
def restart_module(mod : Model::Module) #

[View source]
def stabilize(rendezvous_hash : RendezvousHash) : Bool #

Run through modules and load to a stable state.

Uses a semaphore to ensure intermediary cluster events don't trigger stabilization.


[View source]
def start(timeout : Time::Span = LOAD_TIMEOUT) #

[View source]
def start_module(mod : Model::Module) #

[View source]
def started? : Bool #

[View source]
def stop #

[View source]
def stop_module(mod : Model::Module) #

Stop module on node


[View source]
def unload_module(mod : Model::Module) #

Stop and unload the module from node


[View source]