-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.go
63 lines (52 loc) · 1.37 KB
/
plugin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package common_type
type IPlugin interface {
// 程序实现
Assign(pid IInstanceDescription, resources IResources) PluginError
GetPluginDescription() IInstanceDescription
// 业务动作
Enable(LifeCycleRequest) PluginError
Disable(LifeCycleRequest) PluginError
Install(LifeCycleRequest) PluginError
UnInstall(LifeCycleRequest) PluginError
Upgrade(IVersion, LifeCycleRequest) PluginError
CheckState() PluginError
CheckCompatibility() PluginError
// 事件相关
OnEvent(eventType string, payload []byte) PluginError
// 配置修改
OnConfigChange(configKey string, originValue, newValue []string) PluginError
// 外部请求
OnExternalHttpRequest(request *HttpRequest) *HttpResponse
}
type IInstanceDescription interface {
PluginDescription() IPluginDescriptor
InstanceID() string
}
type IPluginDescriptor interface {
ApplicationID() string
Name() string
Language() string
LanguageVersion() IVersion
ApplicationVersion() IVersion
HostVersion() IVersion
MinSystemVersion() IVersion
}
type IResources interface {
GetLogger() PluginLogger
GetWorkspace() Workspace
GetLocalDB() LocalDB
GetEventPublisher() EventPublisher
GetSysDB() SysDB
GetAPICore() APICore
GetOutDoor() Network
GetAbility() Ability
}
type LifeCycleRequest struct {
Headers map[string]*HeaderVal
}
type HeaderVal struct {
Val []string
}
type PluginFactory interface {
GetPlugin() IPlugin
}