frame

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 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 (
	KBSize = 1024
	MBSize = KBSize * 1024
	GBSize = MBSize * 1024
)

Variables

View Source
var (
	ErrInvalidEventMsgInst = errors.New("invalid eventMessageMgr instance")
)

Functions

func GetConfigTemplatePath

func GetConfigTemplatePath(workPath string) string

func LaunchDaemonApplication

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

func MemorySizeToString added in v1.0.4

func MemorySizeToString(size uint64) string

func PublishEventMessage added in v1.0.4

func PublishEventMessage(event EventType, args ...interface{}) 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

func SubscribeEventMessage added in v1.0.4

func SubscribeEventMessage(event EventType, subKey EventSubKey, handle pubsub.TopicFunc, preArgs ...interface{}) error

func UpdateMemoryUsageLimitBytes added in v1.0.4

func UpdateMemoryUsageLimitBytes(limitBytes int64)

Types

type BaseComponent

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

func (*BaseComponent) GetID

func (t *BaseComponent) GetID() ComponentID

func (*BaseComponent) GetIndex added in v1.0.4

func (t *BaseComponent) GetIndex() int

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 EventSubKey added in v1.0.4

type EventSubKey interface{}

type EventType added in v1.0.4

type EventType uint16
const (
	EventAPPStarted EventType = iota + 1
)

type ForcePolicy

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

type GCControl

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

type IComponent

type IComponent interface {
	Initialize(kw IComponentKW) error
	GetIndex() int
	GetID() ComponentID
	GetType() ComponentType
	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 {
	// contains filtered or unexported fields
}

func GetInitialMemorySnapshot

func GetInitialMemorySnapshot() *MemorySnapshot

func NewMemorySnapshot added in v1.0.4

func NewMemorySnapshot() *MemorySnapshot

func (*MemorySnapshot) GetStats added in v1.0.4

func (t *MemorySnapshot) GetStats() runtime.MemStats

func (*MemorySnapshot) String added in v1.0.4

func (t *MemorySnapshot) String() string

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
)

func GetCurrentProcessType added in v1.0.4

func GetCurrentProcessType() ProcessType

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"`
}

Jump to

Keyboard shortcuts

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