runtime

package
v0.0.3-alpha3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: MIT Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	EventPriority_Earliest = math.MinInt8
	EventPriority_Mediocre = 0
	EventPriority_Latest   = math.MaxInt8
)
View Source
const (
	Task_Status_BrandNew = iota
	Task_Status_Staring
	Task_Status_Running
	Task_Status_Stopping
	Task_Status_Stopped
)

Variables

View Source
var (
	EM_Event_Uninitialized = types.NewMask(
		"Event:UninitializedObject",
		"对象未初始化",
	)
	EM_Event_DuplicateSubscriberName = types.NewMask(
		"Event:DuplicateSubscriberName",
		"订阅者名称冲突:{{name}}",
	)
	EM_Event_Locked = types.NewMask(
		"Event:Locked",
		"事件已被锁定,无法重新执行",
	)
	EM_Event_FilterError = types.NewMask(
		"Event:FilterError",
		"过滤器抛出了未被处理的错误",
	)
	EM_Event_UnhandledError = types.NewMask(
		"Event:UnhandledException",
		"事件 {{publisher}} 产生了 {{n}} 未被处理的错误",
	)
)
View Source
var (
	EM_Tasks_DuplicatedTask = types.NewMask(
		"Tasks:DuplicatedTask",
		"任务不能被重复注册",
	)
	EM_Tasks_UnhandledErrors = types.NewMask(
		"Tasks:UnhandledErrors",
		"任务抛出了未被处理的错误",
	)
)
View Source
var Exception_TextWrapperStyle_Cause = typeUtils.Text_WrapperOption{
	Char_LeftTop:    '^',
	Char_LeftMain:   '│',
	Char_LeftBottom: '└',
	Char_BottomMain: '─',
	Indent_Title:    1,
	Indent_Content:  2,
}
View Source
var Exception_TextWrapperStyle_Trace = typeUtils.Text_WrapperOption{
	Char_LeftTop:    '>',
	Char_LeftMain:   '│',
	Char_LeftBottom: '└',
	Char_BottomMain: '─',
	Indent_Title:    1,
	Indent_Content:  2,
}

Functions

This section is empty.

Types

type Event

type Event interface {
	IsEvent()
	GetPayload() interface{}
	CommitPayload(interface{}) error
	Lock()
	UnLock()
	Locked() bool
}

type EventAction

type EventAction struct {
	EventCommon
	// contains filtered or unexported fields
}

func NewEventAction

func NewEventAction(handler EventActionHandler, payload interface{}) *EventAction

func (*EventAction) CommitPayload

func (ea *EventAction) CommitPayload(payload interface{}) error

func (*EventAction) IsEvent

func (ea *EventAction) IsEvent()

type EventActionHandler

type EventActionHandler func(this *EventAction, actionArg interface{}) (err error)

type EventCommon

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

func (*EventCommon) GetPayload

func (eu *EventCommon) GetPayload() interface{}

func (*EventCommon) Lock

func (eu *EventCommon) Lock()

func (*EventCommon) Locked

func (eu *EventCommon) Locked() bool

func (*EventCommon) UnLock

func (eu *EventCommon) UnLock()

type EventFilter

type EventFilter struct {
	EventCommon
	// contains filtered or unexported fields
}

func NewEventFilter

func NewEventFilter(handler EventFilterHandler, payload interface{}) *EventFilter

func (*EventFilter) CommitPayload

func (ef *EventFilter) CommitPayload(payload interface{}) error

func (*EventFilter) IsEvent

func (ef *EventFilter) IsEvent()

type EventFilterHandler

type EventFilterHandler func(this *EventFilter, filterArg interface{}) (newPayload interface{}, err error)

type EventHandler

type EventHandler func(Event) error

type EventPriority

type EventPriority int8

type EventPublisher

type EventPublisher struct {
	Subscribers map[string]*EventSubscriber
	// contains filtered or unexported fields
}

func (*EventPublisher) GenerateExecOrderCache

func (ep *EventPublisher) GenerateExecOrderCache()

type EventSubscriber

type EventSubscriber struct {
	Priority EventPriority
	Handler  EventHandler
}

type Events

type Events struct {
	Publishers map[string]*EventPublisher
}

func GlobalEvents

func GlobalEvents() *Events

func (*Events) Publish

func (es *Events) Publish(publisher string, event Event) error

func (*Events) PublishAndUnsubscribeAll

func (es *Events) PublishAndUnsubscribeAll(publisher string, event Event) error

func (*Events) Subscribe

func (es *Events) Subscribe(
	publisher string, priority EventPriority,
	subscriber string, handler EventHandler,
) error

func (*Events) Unsubscribe

func (es *Events) Unsubscribe(publisher string, subscriber string)

type Exception

type Exception struct {
	types.SimpleThrowable
	// contains filtered or unexported fields
}

func AsException

func AsException(e error) (*Exception, bool)

func Exception_Mismatched_ArgumentList

func Exception_Mismatched_ArgumentList(expected string, got string) *Exception

func Exception_Mismatched_Format

func Exception_Mismatched_Format(expected string, got string) *Exception

func NewException

func NewException(mask types.Mask, param map[string]string, cause interface{}) *Exception

func (*Exception) Cause

func (t *Exception) Cause() error

func (*Exception) GetCause

func (t *Exception) GetCause() interface{}

func (*Exception) GetMessage

func (t *Exception) GetMessage() string

func (*Exception) SetStackFilter

func (t *Exception) SetStackFilter(filter Exception_StackFilter) *Exception

func (*Exception) StackTrace

func (t *Exception) StackTrace() errors.StackTrace

type Exception_StackFilter

type Exception_StackFilter func(fun string, file string, line int) bool

type Task

type Task interface {
	Start() error
	Stop() error
	GetStatus() Task_Status
	SetStatus(status Task_Status) bool
	// contains filtered or unexported methods
}

type TaskMethods

type TaskMethods struct {
	Task
	// contains filtered or unexported fields
}

func (*TaskMethods) GetStatus

func (t *TaskMethods) GetStatus() Task_Status

func (*TaskMethods) SetStatus

func (t *TaskMethods) SetStatus(status Task_Status) bool

type TaskSet

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

func NewTaskSet

func NewTaskSet() *TaskSet

func (*TaskSet) CancelWait

func (ts *TaskSet) CancelWait()

func (*TaskSet) Register

func (ts *TaskSet) Register(t Task) error

func (*TaskSet) StopAll

func (ts *TaskSet) StopAll() error

func (*TaskSet) Wait

func (ts *TaskSet) Wait()

type Task_Status

type Task_Status uint8

Jump to

Keyboard shortcuts

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