applications

package
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 15 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApplicationCache = xcore.NewXCache("applications", 0, 0)
View Source
var ApplicationPlugin = map[string]*plugin.Plugin{}
View Source
var Applications = map[string]Application{}

Functions

func GetApplicationPlugin

func GetApplicationPlugin(appid string) *plugin.Plugin
func Link()

func LinkCalls

func LinkCalls()

Types

type Application

type Application interface {
	// standard APPs function
	StartHost(h config.Host)
	StartContext(ctx *context.Context)
	GetDatasourcesConfigFile() string
	GetDatasourceSet() DatasourceSet
	GetCompiledModules() ModuleSet
}

Application must be compliant with the interface Application Applications ARE plugins

func GetApplication

func GetApplication(appid string) Application

type Datasource

type Datasource interface {
	// general needed funcion
	GetName() string
	GetConfig() *xconfig.XConfig
	AddLanguage(lang language.Tag)
	GetLanguages() []language.Tag
	SetLog(id string, logger *log.Logger)
	GetLog(id string) *log.Logger
	GetLogs() map[string]*log.Logger
	Log(id string, messages ...interface{})
	SetDatabase(db *xdominion.XBase)
	GetDatabase() *xdominion.XBase
	SetTable(id string, table *xdominion.XTable)
	GetTable(id string) *xdominion.XTable
	GetTables() map[string]*xdominion.XTable
	SetCache(id string, cache *xcore.XCache)
	GetCache(id string) *xcore.XCache
	GetCaches() map[string]*xcore.XCache
	SetModule(moduleid string, moduleversion string)
	RegisterModule(mod Module)
	GetModule(moduleid string) string
	GetModules() map[string]string
	IsModuleAuthorized(id string) bool
	// Functions to clone the shell and build transactions
	CloneShell() Datasource
	StartTransaction() (*xdominion.XTransaction, error)
	GetTransaction() *xdominion.XTransaction
	Commit() error
	Rollback() error
}

Datasource is a portable structure interface containing pointer to usefull functions used in any datasources of applications Since it's thread safe and based on maps and slices, it must be accessed through Get/Set functions with mutexes to avoid race conditions The is only ONE database by datasource, with a set of modules and tables into this database.

type DatasourceSet

type DatasourceSet interface {
	SetDatasource(id string, ctx Datasource)
	GetDatasource(id string) Datasource
	GetDatasources() map[string]Datasource
	CreateDatasource(name string, config *xconfig.XConfig) (Datasource, error)
	TryDatasource(ctx *context.Context, defaultdatasourcename string) Datasource
}

type Module

type Module interface {
	GetID() string
	GetVersion() string
	GetLanguages() map[language.Tag]string
	GetNeeds() []string // module[.version[+]]

	GetInstalledVersion(Datasource) string
	Setup(Datasource, string) ([]string, error)       // setup the module in the datasource (link tables definitions and others for first time)
	Synchronize(Datasource, string) ([]string, error) // build anything missing into the datasource (tables, logs, files, etc)
	StartContext(Datasource, *context.Context) error  // Called at any start of a new context
}

type ModuleSet

type ModuleSet interface {
	Register(m Module)
	Get(id string) Module
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL