telem icon indicating copy to clipboard operation
telem copied to clipboard

Split core API from integrations

Open cyberbit opened this issue 10 months ago • 0 comments

This will provide a more scalable architecture and better support external integrations.

Excluded modules will be broken out into opt-in modules from the installer. Default will install everything. Support will be included for a custom Luz encapsulation to save significant disk space. Module loader will be fully documented to allow third-party modules outside of the standard offerings.

Need to design methodology for first-party modules to be loaded into installer. Maybe a telem-modules repository that publishes to a CDN for installer use, and to GH releases as a changelog and backup release target.

Need to figure out how to appropriate split the documentation as well. Anything module-related should be split out similarly.

Need to decide how dependencies will work. Leaning toward keeping a default set of dependencies and exposing them to modules that wish to use them. Anything outside of that set will need to be packaged with the module. Maybe there can be opt-in vendor modules that adapter modules can depend on and share? Uh oh, am I accidentally designing a package repo...

Core API components:

  • Backplane
  • Metric
  • MetricCollection
  • InputAdapter
  • OutputAdapter
  • Middleware

Included modules:

  • Generic input adapters: item/fluid storage, secure modem, custom
  • Generic output adapters: secure modem, custom
  • Generic middleware: sort, average, delta, custom

Tentative modules:

  • Plotter charts

Excluded modules:

  • Mod-specific integrations: Advanced Peripherals (includes AE, RS, Powah), Bigger Reactors, Mekanism
  • Vendor-specific outputs: Grafana, Basalt

Some very loose implementation notes (not final at all):

Example module:

-- parameters provide core API to the module
return function (telem)
    -- inline definition, can modify minted adapter with appropriate behaviors
    local itemStorageInput = telem.module.mintInput("itemStorage")

    return {
        input = {
            itemStorage = itemStorageInput,

            -- can also require externals that follow API spec
            requiredItemStorage = require('myModule/myItemStorageInput')
        },
        output = {},
        middleware = {}
    }
end

Example usage:

local telem = require 'telem'

-- core API may autoload modules in a standard location. otherwise:
local myModule = telem.module.load('myModule')

local backplane = telem.backplane()

    -- autoloaded example
    :addInput('myAutoloadedItemStorage', telem.input.myModule.itemStorage('top'))

    -- require example
    :addInput('myItemStorage', myModule.input.itemStorage('top'))

cyberbit avatar Mar 12 '25 16:03 cyberbit