astiflow

package module
v0.0.0-...-3a39f3c Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

View Source
const (
	EventNameFlowClosed        astikit.EventName = "astiflow.flow.closed"
	EventNameFlowDone          astikit.EventName = "astiflow.flow.done"
	EventNameFlowRunning       astikit.EventName = "astiflow.flow.running"
	EventNameFlowStarting      astikit.EventName = "astiflow.flow.starting"
	EventNameFlowStopping      astikit.EventName = "astiflow.flow.stopping"
	EventNameGroupClosed       astikit.EventName = "astiflow.group.closed"
	EventNameGroupCreated      astikit.EventName = "astiflow.group.created"
	EventNameGroupDone         astikit.EventName = "astiflow.group.done"
	EventNameGroupRunning      astikit.EventName = "astiflow.group.running"
	EventNameGroupStarting     astikit.EventName = "astiflow.group.starting"
	EventNameGroupStopping     astikit.EventName = "astiflow.group.stopping"
	EventNameNodeChildAdded    astikit.EventName = "astiflow.node.child.added"
	EventNameNodeChildRemoved  astikit.EventName = "astiflow.node.child.removed"
	EventNameNodeClosed        astikit.EventName = "astiflow.node.closed"
	EventNameNodeCreated       astikit.EventName = "astiflow.node.created"
	EventNameNodeDone          astikit.EventName = "astiflow.node.done"
	EventNameNodeParentAdded   astikit.EventName = "astiflow.node.parent.added"
	EventNameNodeParentRemoved astikit.EventName = "astiflow.node.parent.removed"
	EventNameNodeRunning       astikit.EventName = "astiflow.node.running"
	EventNameNodeStarting      astikit.EventName = "astiflow.node.starting"
	EventNameNodeStopping      astikit.EventName = "astiflow.node.stopping"
)
View Source
const (
	DeltaStatNameHostUsage string = "astiflow.host.usage"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DeltaStatHostCPUUsageValue

type DeltaStatHostCPUUsageValue struct {
	Individual []float64 `json:"individual"`
	Process    *float64  `json:"process,omitempty"`
	Total      float64   `json:"total"`
}

type DeltaStatHostMemoryUsageValue

type DeltaStatHostMemoryUsageValue struct {
	Resident uint64 `json:"resident"`
	Total    uint64 `json:"total"`
	Used     uint64 `json:"used"`
	Virtual  uint64 `json:"virtual"`
}

type DeltaStatHostUsageValue

type DeltaStatHostUsageValue struct {
	CPU    DeltaStatHostCPUUsageValue    `json:"cpu"`
	Memory DeltaStatHostMemoryUsageValue `json:"memory"`
}

type Flow

type Flow struct {
	// contains filtered or unexported fields
}

func NewFlow

func NewFlow(o FlowOptions) (f *Flow, err error)

func (*Flow) Close

func (f *Flow) Close() error

func (*Flow) DeltaStats

func (f *Flow) DeltaStats() []astikit.DeltaStat

func (*Flow) Emit

func (f *Flow) Emit(n astikit.EventName, payload interface{})

func (*Flow) Groups

func (f *Flow) Groups() (groups []*Group)

func (*Flow) ID

func (f *Flow) ID() uint64

func (*Flow) Logger

func (f *Flow) Logger() astikit.CompleteLogger

func (*Flow) Metadata

func (f *Flow) Metadata() Metadata

func (*Flow) NewGroup

func (f *Flow) NewGroup(o GroupOptions) (g *Group, err error)

func (*Flow) On

func (f *Flow) On(n astikit.EventName, h astikit.EventHandler) astikit.EventRemover

func (*Flow) Start

func (f *Flow) Start(ctx context.Context) error

func (*Flow) Status

func (f *Flow) Status() Status

func (*Flow) Stop

func (f *Flow) Stop() error

func (*Flow) String

func (f *Flow) String() string

type FlowOptions

type FlowOptions struct {
	DeltaStats []astikit.DeltaStat
	Logger     astikit.StdLogger
	Metadata   Metadata
	Plugins    []Plugin
	Worker     *astikit.Worker
}

type Group

type Group struct {
	// contains filtered or unexported fields
}

func (*Group) Close

func (g *Group) Close() error

func (*Group) Context

func (g *Group) Context() context.Context

func (*Group) DisconnectNodes

func (g *Group) DisconnectNodes()

func (*Group) Emit

func (g *Group) Emit(nm astikit.EventName, payload interface{})

func (*Group) ID

func (g *Group) ID() uint64

func (*Group) Metadata

func (g *Group) Metadata() Metadata

func (*Group) NewNode

func (g *Group) NewNode(o NodeOptions) (n *Node, c *astikit.Closer, err error)

func (*Group) Nodes

func (g *Group) Nodes() (nodes []*Node)

func (*Group) On

func (g *Group) On(nm astikit.EventName, h astikit.EventHandler) astikit.EventRemover

func (*Group) Start

func (g *Group) Start() error

func (*Group) Status

func (g *Group) Status() Status

func (*Group) Stop

func (g *Group) Stop() error

func (*Group) String

func (g *Group) String() string

type GroupOptions

type GroupOptions struct {
	Metadata Metadata
}

type Metadata

type Metadata struct {
	Description string   `json:"description,omitempty"`
	Name        string   `json:"name,omitempty"`
	Tags        []string `json:"tags,omitempty"`
}

func (*Metadata) Merge

func (m *Metadata) Merge(i Metadata) Metadata

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node is purposefuly not an interface

func (*Node) Children

func (n *Node) Children() []*Node

func (*Node) Connector

func (n *Node) Connector() *NodeConnector

func (*Node) Emit

func (n *Node) Emit(nm astikit.EventName, payload interface{})

func (*Node) ID

func (n *Node) ID() uint64

func (*Node) Metadata

func (n *Node) Metadata() Metadata

func (*Node) Noder

func (n *Node) Noder() Noder

func (*Node) On

func (n *Node) On(nm astikit.EventName, h astikit.EventHandler) astikit.EventRemover

func (*Node) Parents

func (n *Node) Parents() []*Node

func (*Node) Status

func (n *Node) Status() Status

func (*Node) String

func (n *Node) String() string

type NodeConnector

type NodeConnector struct {
	// contains filtered or unexported fields
}

NodeConnector's purpose is to provide a way to connect noders belonging to different external packages without exposing the node itself

func (*NodeConnector) Connect

func (src *NodeConnector) Connect(dst *NodeConnector)

func (*NodeConnector) Disconnect

func (src *NodeConnector) Disconnect(dst *NodeConnector)

type NodeOptions

type NodeOptions struct {
	Metadata    Metadata
	Noder       Noder
	StopOptions *NodeStopOptions
}

type NodeStopOptions

type NodeStopOptions struct {
	WhenAllChildrenAreDone bool // Default is false
	WhenGroupStops         bool // Default is true
	WhenAllParentsAreDone  bool // Default is false
}

type Noder

type Noder interface {
	DeltaStats() []astikit.DeltaStat
	Start(ctx context.Context, tc astikit.TaskCreator)
}

Noder should be the simplest interface possible, hopefuly only describing the action a node can do Internal node shouldn't be exposed here since we don't want other nodes/packages to be able manipulate it since only the flow owner should be able to do it

type Plugin

type Plugin interface {
	Init(c *astikit.Closer, f *Flow) error
	Start(ctx context.Context, tc astikit.TaskCreator)
}

type Status

type Status uint32
const (
	StatusCreated Status = iota
	StatusStarting
	StatusRunning
	StatusStopping
	StatusDone
)

Must be in order of execution

func (Status) String

func (s Status) String() string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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