frame

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 19 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, confHandler IConfigHandler, f ConfigCallback) bool

func RegisterConfigInfo

func RegisterConfigInfo(info ConfigRegInfo)

func SetFrameLoggerInstance

func SetFrameLoggerInstance(logger ILogger) error

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 ConfigRegInfo

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

type ConfigWatcher added in v1.0.2

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

func (*ConfigWatcher) GetInfo added in v1.0.2

func (t *ConfigWatcher) GetInfo() (retInfo ConfigWatcherInfo)

func (*ConfigWatcher) GetKey added in v1.0.2

func (t *ConfigWatcher) GetKey() string

func (*ConfigWatcher) GetPath added in v1.0.2

func (t *ConfigWatcher) GetPath() string

func (*ConfigWatcher) GetVersion added in v1.0.2

func (t *ConfigWatcher) GetVersion() int

type ConfigWatcherInfo added in v1.0.2

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

type ConfigWatcherMgr added in v1.0.2

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

func GetConfigWatcherMgr added in v1.0.2

func GetConfigWatcherMgr() *ConfigWatcherMgr

func (*ConfigWatcherMgr) GetConfigWatcherListInfo added in v1.0.2

func (t *ConfigWatcherMgr) GetConfigWatcherListInfo() (retList []ConfigWatcherInfo)

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 IConfigHandler added in v1.0.2

type IConfigHandler interface {
	EncodeConfig(data []byte) error
	OnUpdate()
	GetConfigData() ([]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"`
	PidFileDirPath string                 `json:"pid_file_dir_path"`
	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 NewConfigHandlerFunc added in v1.0.2

type NewConfigHandlerFunc func() IConfigHandler

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