module

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 3 Imported by: 0

README

DTO

Documentation

Index

Constants

View Source
const (
	InformerNodeID         = "_informer"
	PlatformSubjectPattern = "platform.*"
	GetManifestSubject     = "get_manifest"
	PublishModuleSubject   = "publish_manifest"
	UpdateModuleSubject    = "update_manifest"
)
View Source
const (
	SaveStatePort string = "_save-state"
	GetStatePort  string = "_get-state"
	ConfigurePort string = "_configure"
	RunPort       string = "_run"
	StopPort      string = "_stop"
	DestroyPort   string = "_destroy"
	SettingsPort  string = "_settings"
	StatusPort    string = "_status"
)

Variables

This section is empty.

Functions

func GetComponentID

func GetComponentID(moduleInfo Info, cmpInfo ComponentInfo) (string, error)

Types

type Component

type Component interface {
	GetInfo() ComponentInfo
	//Handle handles incoming requests
	Handle(ctx context.Context, output Handler, port string, message interface{}) error
	//Ports gets list of ports
	Ports() []NodePort
	//Instance creates new instance with default settings
	Instance() Component
}

type ComponentInfo

type ComponentInfo struct {
	Name        string
	Description string
	Info        string
	Tags        []string
}

type Handler

type Handler func(port string, data interface{}) error

type Info

type Info struct {
	VersionID string // if module's build is registered
	Version   string
	Name      string
}

type NodePort

type NodePort struct {
	Source   bool
	Status   bool
	Settings bool
	Position Position
	Name     string
	Label    string
	Message  interface{}
}

func GetPortByName

func GetPortByName(ports []NodePort, name string) *NodePort

type Position

type Position int
const (
	Top Position = iota
	Right
	Bottom
	Left
)

type Runnable

type Runnable interface {
	Run(ctx context.Context, handler Handler) error
}

type StatefulComponent

type StatefulComponent interface {
	GetState() ([]byte, error)
	SetState(state []byte) error
}

StatefulComponent WIP

Jump to

Keyboard shortcuts

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