frame

package
v1.0.3-pre Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentBaseInitStatus = iota
	ComponentInitStatus
	ComponentStartStatus
	ComponentStopStatus
)
View Source
const (
	ComponentPriorityLow = iota
	ComponentPriorityGeneral
	ComponentPriorityHigh
)
View Source
const (
	APPDefaultSignChanSize = 1
)

Variables

This section is empty.

Functions

func GetConfigTemplatePath

func GetConfigTemplatePath(workPath string) string

func LaunchDaemonApplication

func LaunchDaemonApplication(processType ProcessType, workPath string, launchConf string, newApp NewApplication,
	appArgs []interface{}, enabledDevMode bool) error

func RegisterComponentInfo

func RegisterComponentInfo(priority int, tpy ComponentType, newComponent NewComponent, newComponentKW NewComponentKW)

func RegisterConfigCallback

func RegisterConfigCallback(cbType ConfigCallbackType, conf IConfig, f ConfigCallback) bool

func RegisterConfigInfo

func RegisterConfigInfo(info ConfigRegInfo)

func SetFrameLoggerInstance

func SetFrameLoggerInstance(logger ILogger) bool

Types

type ApplicationID

type ApplicationID string

type ApplicationProxy

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

func GetAppProxy

func GetAppProxy() *ApplicationProxy

func (*ApplicationProxy) GetProcessType

func (t *ApplicationProxy) GetProcessType() ProcessType

func (*ApplicationProxy) IsMainProcess

func (t *ApplicationProxy) IsMainProcess() bool

func (*ApplicationProxy) Pub

func (t *ApplicationProxy) Pub(topic TopicType, args ...interface{}) error

func (*ApplicationProxy) Sub

func (t *ApplicationProxy) Sub(topic TopicType, subKey TopicSubKey,
	handle pubsub.TopicFunc, preArgs ...interface{}) error

type BaseApplication

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

func (*BaseApplication) AfterStart

func (t *BaseApplication) AfterStart() error

func (*BaseApplication) GetID

func (t *BaseApplication) GetID() ApplicationID

func (*BaseApplication) GetProcessType

func (t *BaseApplication) GetProcessType() ProcessType

func (*BaseApplication) Initialize

func (t *BaseApplication) Initialize(args ...interface{}) error

func (*BaseApplication) Pub

func (t *BaseApplication) Pub(topic TopicType, args ...interface{}) error

func (*BaseApplication) StopBefore

func (t *BaseApplication) StopBefore() error

func (*BaseApplication) Sub

func (t *BaseApplication) Sub(topic TopicType, subKey TopicSubKey,
	handle pubsub.TopicFunc, preArgs ...interface{}) error

type BaseComponent

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

func (*BaseComponent) GetID

func (t *BaseComponent) GetID() ComponentID

func (*BaseComponent) GetNum

func (t *BaseComponent) GetNum() int

func (*BaseComponent) GetStartTimestamp

func (t *BaseComponent) GetStartTimestamp() int64

func (*BaseComponent) GetStatus

func (t *BaseComponent) GetStatus() ComponentStatus

func (*BaseComponent) GetType

func (t *BaseComponent) GetType() ComponentType

func (*BaseComponent) Initialize

func (t *BaseComponent) Initialize(args ...interface{}) error

func (*BaseComponent) Start

func (t *BaseComponent) Start() error

func (*BaseComponent) Stop

func (t *BaseComponent) Stop() error

type ComponentID

type ComponentID string

type ComponentStatus

type ComponentStatus uint16

type ComponentType

type ComponentType string

type ConfigCallback

type ConfigCallback func()

type ConfigCallbackType

type ConfigCallbackType = uint8
const (
	ConfigCallbackTypeCreate ConfigCallbackType = iota
	ConfigCallbackTypeUpdate
	ConfigCallbackTypeRemove
)

type ConfigHandler

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

func (*ConfigHandler) GetInfo

func (t *ConfigHandler) GetInfo() (retInfo ConfigHandlerInfo)

func (*ConfigHandler) GetKey

func (t *ConfigHandler) GetKey() string

func (*ConfigHandler) GetPath

func (t *ConfigHandler) GetPath() string

func (*ConfigHandler) GetVersion

func (t *ConfigHandler) GetVersion() int

type ConfigHandlerInfo

type ConfigHandlerInfo struct {
	Version         int
	UpdateTimestamp int64
	Key             string
	Path            string
	Dir             string
	FileName        string
	//HashVal         string
	Watched   bool
	ModelData string
}

type ConfigHandlerMgr

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

func GetConfigHandlerMgr

func GetConfigHandlerMgr() *ConfigHandlerMgr

func (*ConfigHandlerMgr) GetConfigHandlerListInfo

func (t *ConfigHandlerMgr) GetConfigHandlerListInfo() (retList []ConfigHandlerInfo)

type ConfigRegInfo

type ConfigRegInfo struct {
	Key                   string
	Suffix                string
	NewFunc               newConfigFunc
	MustLoad              bool
	EnableWatchLog        bool
	RetryWatchIntervalSec uint64
}

type ForcePolicy

type ForcePolicy struct {
	IntervalMS int `json:"interval_ms"`
	MemPeak    int `json:"mem_peak"`
}

type GCControl

type GCControl struct {
	DisableDefaultGC bool `json:"disable_default_gc"`
	EnableForce      bool `json:"enable_force"`
	ForcePolicy      struct {
		IntervalSecondS int `json:"interval_seconds"`
		MemPeak         int `json:"mem_peak"`
	} `json:"force_policy"`
}

type IApplication

type IApplication interface {
	Initialize(args ...interface{}) error
	GetID() ApplicationID
	GetProcessType() ProcessType

	Pub(topic TopicType, args ...interface{}) error
	Sub(topic TopicType, subKey TopicSubKey, handle pubsub.TopicFunc, preArgs ...interface{}) error

	AfterStart() error

	StopBefore() error
	// contains filtered or unexported methods
}

type IComponent

type IComponent interface {
	Initialize(kw IComponentKW) error
	GetNum() int
	GetID() ComponentID
	GetType() ComponentType
	GetStartTimestamp() int64

	Start() error
	Stop() error
	// contains filtered or unexported methods
}

type IComponentKW

type IComponentKW interface{}

type IConfig

type IConfig interface {
	EncodeConfig(data []byte) error
	OnUpdate()
	GetModelData() ([]byte, error)
}

type ILogger

type ILogger interface {
	SetLevelByDesc(levelDesc string) bool
	All(v ...interface{})
	AllF(format string, v ...interface{})
	Debug(v ...interface{})
	DebugF(format string, v ...interface{})
	Info(v ...interface{})
	InfoF(format string, v ...interface{})
	Warning(v ...interface{})
	WarningF(format string, v ...interface{})
	Error(v ...interface{})
	ErrorF(format string, v ...interface{})
}

type LauncherConfigModel

type LauncherConfigModel struct {
	AppID          string                 `json:"app_id"`
	LogLevel       string                 `json:"log_level"`
	GCControl      GCControl              `json:"gc_control"`
	ConfigInfoList []*configInfoModel     `json:"configs"`
	SubProcessList SubProcessList         `json:"sub_process_list"`
	Components     []componentConfigModel `json:"components"`
}

type MemorySnapshot

type MemorySnapshot struct {
	AllocBytes    uint64
	AllocMBs      uint64
	TotalAllocMBs uint64
	SysMBs        uint64
	MallocsMbs    uint64
	HeapAllocMBs  uint64
	HeapSysMbs    uint64
}

func GetInitialMemorySnapshot

func GetInitialMemorySnapshot() MemorySnapshot

type NewApplication

type NewApplication func() IApplication

type NewComponent

type NewComponent func() IComponent

type NewComponentKW

type NewComponentKW func() IComponentKW

type ProcessType

type ProcessType int
const (
	MainProcessType ProcessType = iota + 1
	SubProcessType
)

type RegComponentInfo

type RegComponentInfo struct {
	Priority       int
	Tpy            ComponentType
	NewComponent   NewComponent
	NewComponentKW NewComponentKW
}

type SubProcessList

type SubProcessList struct {
	Enable   bool                     `json:"enable"`
	Commands []map[string]interface{} `json:"commands"`
}

type TopicSubKey

type TopicSubKey interface{}

type TopicType

type TopicType uint16

Jump to

Keyboard shortcuts

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