manager

package
v1.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package manager for managing pipeline scripts

Package manager for managing pipeline scripts

Package manager for managing pipeline scripts

Package manager for managing pipeline scripts

Index

Constants

View Source
const (
	// pipeline关键字段.
	FieldTime       = "time"
	FieldMessage    = "message"
	FieldStatus     = "status"
	PlLoggingSource = "source"

	DefaultStatus = "unknown"
)
View Source
const (
	NSDefault = "default" // 内置 pl script, 优先级最低
	NSGitRepo = "gitrepo" // git 管理的 pl script
	NSConfd   = "confd"   // confd 管理的 pl script
	NSRemote  = "remote"  // remote pl script,优先级最高
)

Variables

This section is empty.

Functions

func CategoryDirName

func CategoryDirName() map[point.Category]string

func CopyDefalutPatterns

func CopyDefalutPatterns() map[string]string

func InitLog

func InitLog()

func InitStore

func InitStore(manager *Manager, installDir string, tags map[string]string)

func NSFindPriority

func NSFindPriority(ns string) int

func NewScripts

func NewScripts(scripts, scriptTags map[string]string, ns string, cat point.Category,
	buks ...*plmap.AggBuckets,
) (map[string]*PlScript, map[string]error)

func ProcLoggingStatus

func ProcLoggingStatus(plpt ptinput.PlInputPt, disable bool, ignore []string)

func ReadScript added in v1.1.21

func ReadScript(fp string) (string, string, error)

func ReadScripts added in v1.1.21

func ReadScripts(dirPath string) (map[string]string, map[string]string)

func ReadWorkspaceScripts added in v1.1.21

func ReadWorkspaceScripts(basePath string) (
	map[point.Category](map[string]string), map[point.Category](map[string]string),
)

func ScriptName added in v1.1.21

func ScriptName(relation *ScriptRelation, cat point.Category, pt *point.Point, scriptMap map[string]string) (string, bool)

func SearchScripts added in v1.1.21

func SearchScripts(dirPath string) (map[string]string, error)

func SearchWorkspaceScripts added in v1.1.21

func SearchWorkspaceScripts(basePath string) map[point.Category](map[string]string)

Types

type Manager

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

func NewManager

func NewManager(cfg ManagerCfg) *Manager

func (*Manager) GetScriptRelation

func (m *Manager) GetScriptRelation() *ScriptRelation

func (*Manager) LoadScriptWithCat added in v1.1.21

func (m *Manager) LoadScriptWithCat(category point.Category, ns string,
	scripts, tags map[string]string,
)

func (*Manager) LoadScripts added in v1.1.21

func (m *Manager) LoadScripts(ns string, scripts map[point.Category](map[string]string),
	tags map[string]string,
)

LoadScripts is used to load and clean the script, parameter scripts example: {point.Logging: {ScriptName: ScriptContent},... }.

func (*Manager) LoadScriptsFromWorkspace added in v1.1.21

func (m *Manager) LoadScriptsFromWorkspace(ns, plPath string, tags map[string]string)

func (*Manager) QueryScript

func (m *Manager) QueryScript(category point.Category, name string,
	DisableDefaultP ...struct{}) (*PlScript, bool)

func (*Manager) ScriptCount

func (m *Manager) ScriptCount(category point.Category) int

func (*Manager) UpdateDefaultScript added in v1.1.21

func (m *Manager) UpdateDefaultScript(mp map[point.Category]string)

type ManagerCfg

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

func NewManagerCfg

func NewManagerCfg(upFn plmap.UploadFunc, gTags [][2]string) ManagerCfg

type Option

type Option struct {
	MaxFieldValLen        int // deprecated
	DisableAddStatusField bool
	IgnoreStatus          []string
	ScriptMap             map[string]string
}

type PlScript

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

func (*PlScript) Category

func (script *PlScript) Category() point.Category

func (*PlScript) Engine

func (script *PlScript) Engine() *plruntime.Script

func (*PlScript) NS

func (script *PlScript) NS() string

func (*PlScript) Name

func (script *PlScript) Name() string

func (*PlScript) Run

func (script *PlScript) Run(plpt ptinput.PlInputPt, signal plruntime.Signal, opt *Option,
) error

func (*PlScript) SetAggBuks

func (script *PlScript) SetAggBuks(buks *plmap.AggBuckets)

type ScriptRelation added in v1.1.21

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

func NewPipelineRelation added in v1.1.21

func NewPipelineRelation() *ScriptRelation

func (*ScriptRelation) Query added in v1.1.21

func (relation *ScriptRelation) Query(cat point.Category, source string) (string, bool)

func (*ScriptRelation) UpdateAt added in v1.1.21

func (relation *ScriptRelation) UpdateAt() int64

func (*ScriptRelation) UpdateRelation added in v1.1.21

func (relation *ScriptRelation) UpdateRelation(updateAt int64, rel map[point.Category]map[string]string)

type ScriptStore

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

func NewScriptStore

func NewScriptStore(category point.Category, cfg ManagerCfg) *ScriptStore

func (*ScriptStore) Count

func (store *ScriptStore) Count() int

func (*ScriptStore) GetDefaultScript added in v1.1.21

func (store *ScriptStore) GetDefaultScript() string

func (*ScriptStore) GetWithNs

func (store *ScriptStore) GetWithNs(name, ns string) (*PlScript, bool)

func (*ScriptStore) IndexDefault added in v1.1.21

func (store *ScriptStore) IndexDefault() (*PlScript, bool)

func (*ScriptStore) IndexGet

func (store *ScriptStore) IndexGet(name string) (*PlScript, bool)

func (*ScriptStore) SetDefaultScript added in v1.1.21

func (store *ScriptStore) SetDefaultScript(name string)

func (*ScriptStore) UpdateScriptsWithNS

func (store *ScriptStore) UpdateScriptsWithNS(ns string,
	namedScript, scriptTags map[string]string,
) map[string]error

Jump to

Keyboard shortcuts

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