process_admin

package
v1.15.7 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const Setting = "setting"

Variables

View Source
var (
	ErrorExtenderNotWork         = errors.New("not work")
	ErrorInnerExtenderCantChange = errors.New("is inner")
	ErrorNotExist                = errors.New("not exist")
	ErrorDuplicatePath           = errors.New("path duplicate")
	ErrorNotMatch                = errors.New("not match profession")
	ErrorExtenderVersionIsChange = errors.New("the version of extender has changed")
)
View Source
var (
	ErrorUnknownContentType = errors.New("unknown content type")
)

Functions

func Process

func Process()

Types

type BaseArg

type BaseArg struct {
	Id          string `json:"id,omitempty" yaml:"id"`
	Name        string `json:"name,omitempty" yaml:"name"`
	Driver      string `json:"driver,omitempty" yaml:"driver"`
	Description string `json:"description" yaml:"description"`
	Version     string `json:"version" yaml:"version"`
}

type CacheItem

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

type ExportApi

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

func NewExportApi

func NewExportApi(extenders *ExtenderData, profession professions.IProfessions, workers *Workers) *ExportApi

func (*ExportApi) Register

func (oe *ExportApi) Register(router *httprouter.Router)

type ExtenderData

type ExtenderData struct {
	Versions map[string]string
	Infos    map[string]*ExtenderProject
	// contains filtered or unexported fields
}

func NewExtenderData

func NewExtenderData(conf map[string][]byte, extenderRequire eosc.IRequires) *ExtenderData

func (*ExtenderData) Delete

func (e *ExtenderData) Delete(group, project, version string) (*ExtenderProject, error)

func (*ExtenderData) GetConfigTypes

func (e *ExtenderData) GetConfigTypes() map[string]reflect.Type

func (*ExtenderData) GetInfo

func (e *ExtenderData) GetInfo(group, project string) ([]*ExtenderItemInfo, bool)

func (*ExtenderData) GetRender

func (e *ExtenderData) GetRender(group, project, name string) (*ExtenderItemRender, bool)

func (*ExtenderData) IsWork

func (e *ExtenderData) IsWork() bool

func (*ExtenderData) List

func (e *ExtenderData) List() []*ExtenderItem

func (*ExtenderData) SetVersion

func (e *ExtenderData) SetVersion(group, project, version string) (*ExtenderProject, bool, error)

type ExtenderItem

type ExtenderItem struct {
	ExtenderItemInfo
	Id string `json:"id" yaml:"id"`
}

type ExtenderItemInfo

type ExtenderItemInfo struct {
	Group   string `json:"group" yaml:"group" `
	Project string `json:"project" yaml:"project"`
	Name    string `json:"name" yaml:"name"`
	Version string `json:"version" yaml:"version"`
}

type ExtenderItemRender

type ExtenderItemRender struct {
	ExtenderItemInfo
	Render interface{} `json:"render" yaml:"render"`
}

type ExtenderOpenApi

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

func NewExtenderOpenApi

func NewExtenderOpenApi(extenders *ExtenderData) *ExtenderOpenApi

func (*ExtenderOpenApi) Delete

func (oe *ExtenderOpenApi) Delete(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ExtenderOpenApi) Info

func (oe *ExtenderOpenApi) Info(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ExtenderOpenApi) List

func (oe *ExtenderOpenApi) List(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ExtenderOpenApi) Register

func (oe *ExtenderOpenApi) Register(router *httprouter.Router)

func (*ExtenderOpenApi) Render

func (oe *ExtenderOpenApi) Render(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ExtenderOpenApi) SET

func (oe *ExtenderOpenApi) SET(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

type ExtenderProject

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

type IData

type IData interface {
	UnMarshal(v interface{}) error
	Encode() ([]byte, error)
}

func GetData

func GetData(req *http.Request) (IData, error)

type JsonData

type JsonData []byte

func (JsonData) Encode

func (j JsonData) Encode() ([]byte, error)

func (JsonData) Marshal

func (j JsonData) Marshal() ([]byte, error)

func (JsonData) String

func (j JsonData) String() string

func (JsonData) UnMarshal

func (j JsonData) UnMarshal(v interface{}) error

type ProcessAdmin

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

func NewProcessAdmin

func NewProcessAdmin(parent context.Context, arg map[string]map[string][]byte) (*ProcessAdmin, error)

NewProcessAdmin 创建新的admin进程 启动时通过stdin传输配置信息

func (*ProcessAdmin) OpenApiServer

func (pa *ProcessAdmin) OpenApiServer() error

func (*ProcessAdmin) ServeHTTP

func (pa *ProcessAdmin) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProfessionApi

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

func NewProfessionApi

func NewProfessionApi(data professions.IProfessions, ws *WorkerDatas) *ProfessionApi

func (*ProfessionApi) AddDriver

func (pi *ProfessionApi) AddDriver(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ProfessionApi) All

func (pi *ProfessionApi) All(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ProfessionApi) Delete

func (pi *ProfessionApi) Delete(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ProfessionApi) Detail

func (pi *ProfessionApi) Detail(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ProfessionApi) DriverInfo

func (pi *ProfessionApi) DriverInfo(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ProfessionApi) Drivers

func (pi *ProfessionApi) Drivers(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ProfessionApi) Register

func (pi *ProfessionApi) Register(router *httprouter.Router)

func (*ProfessionApi) ResetDrivers

func (pi *ProfessionApi) ResetDrivers(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ProfessionApi) SetDriver

func (pi *ProfessionApi) SetDriver(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*ProfessionApi) Skill

func (pi *ProfessionApi) Skill(req *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

type ProfessionInfo

type ProfessionInfo struct {
	Name   string   `json:"name,omitempty"`
	Label  string   `json:"label,omitempty"`
	Desc   string   `json:"desc,omitempty"`
	Driver []string `json:"driver,omitempty"`
}

type ProfessionsRequire

type ProfessionsRequire struct {
	professions.IProfessions
	// contains filtered or unexported fields
}

func NewProfessionsRequire

func NewProfessionsRequire(professions professions.IProfessions, requires eosc.IRequires) *ProfessionsRequire

func (*ProfessionsRequire) Delete

func (p *ProfessionsRequire) Delete(name string) error

func (*ProfessionsRequire) Reset

func (p *ProfessionsRequire) Reset(configs []*eosc.ProfessionConfig)

func (*ProfessionsRequire) Set

func (p *ProfessionsRequire) Set(name string, profession *eosc.ProfessionConfig) error

type SettingApi

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

func NewSettingApi

func NewSettingApi(init map[string][]byte, workers *Workers, variable eosc.IVariable) *SettingApi

func (*SettingApi) Get

func (oe *SettingApi) Get(req *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*SettingApi) RegisterSetting

func (oe *SettingApi) RegisterSetting(router *httprouter.Router)

func (*SettingApi) Set

func (oe *SettingApi) Set(req *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

type VariableApi

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

func NewVariableApi

func NewVariableApi(extenderData *ExtenderData, workers *Workers, variableData eosc.IVariable, setting eosc.ISettings) *VariableApi

func (*VariableApi) Register

func (oe *VariableApi) Register(router *httprouter.Router)

type WorkerApi

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

func NewWorkerApi

func NewWorkerApi(workers *Workers, settingRequest func(req *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})) *WorkerApi

func (*WorkerApi) Add

func (oe *WorkerApi) Add(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*WorkerApi) Delete

func (oe *WorkerApi) Delete(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*WorkerApi) Patch

func (oe *WorkerApi) Patch(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

func (*WorkerApi) Register

func (oe *WorkerApi) Register(router *httprouter.Router)

func (*WorkerApi) Save

func (oe *WorkerApi) Save(r *http.Request, params httprouter.Params) (status int, header http.Header, events []*open_api.EventResponse, body interface{})

type WorkerDatas

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

func NewWorkerDatas

func NewWorkerDatas(initData map[string][]byte) *WorkerDatas

func (*WorkerDatas) All

func (w *WorkerDatas) All() map[string]*WorkerInfo

func (*WorkerDatas) Clone

func (w *WorkerDatas) Clone() *WorkerDatas

func (*WorkerDatas) Count

func (w *WorkerDatas) Count() int

func (*WorkerDatas) Del

func (w *WorkerDatas) Del(id string) (*WorkerInfo, bool)

func (*WorkerDatas) Get

func (w *WorkerDatas) Get(id string) (eosc.IWorker, bool)

func (*WorkerDatas) GetInfo

func (w *WorkerDatas) GetInfo(id string) (*WorkerInfo, bool)

func (*WorkerDatas) Keys

func (w *WorkerDatas) Keys() []string

func (*WorkerDatas) List

func (w *WorkerDatas) List() []*WorkerInfo

func (*WorkerDatas) Set

func (w *WorkerDatas) Set(id string, v *WorkerInfo)

type WorkerInfo

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

func NewWorkerInfo

func NewWorkerInfo(worker eosc.IWorker, id string, profession string, name, driver, version, desc, create, update string, body []byte, configType reflect.Type) *WorkerInfo

func (*WorkerInfo) Body

func (w *WorkerInfo) Body() []byte

func (*WorkerInfo) ConfigType

func (w *WorkerInfo) ConfigType() reflect.Type

func (*WorkerInfo) Detail

func (w *WorkerInfo) Detail() interface{}

func (*WorkerInfo) Info

func (w *WorkerInfo) Info(appendLabels ...string) interface{}

type Workers

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

func NewWorkers

func NewWorkers() *Workers

func (*Workers) Delete

func (oe *Workers) Delete(id string) (*WorkerInfo, error)

func (*Workers) DeleteTest

func (oe *Workers) DeleteTest(ids ...string) (requires []string)

func (*Workers) Export

func (oe *Workers) Export() map[string][]*WorkerInfo

func (*Workers) GetEmployee

func (oe *Workers) GetEmployee(profession, name string) (*WorkerInfo, error)

func (*Workers) Init

func (oe *Workers) Init(professions professions.IProfessions, data *WorkerDatas, variables eosc.IVariable)

func (*Workers) ListEmployees

func (oe *Workers) ListEmployees(profession string) ([]interface{}, error)

func (*Workers) Update

func (oe *Workers) Update(profession, name, driver, version, desc string, data IData) (*WorkerInfo, error)

type YamlData

type YamlData []byte

func (YamlData) Encode

func (y YamlData) Encode() ([]byte, error)

func (YamlData) Marshal

func (y YamlData) Marshal() ([]byte, error)

func (YamlData) String

func (y YamlData) String() string

func (YamlData) UnMarshal

func (y YamlData) UnMarshal(v interface{}) error

Jump to

Keyboard shortcuts

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