Documentation ¶
Index ¶
- Constants
- type APICore
- type Ability
- type AbilityRequest
- type AbilityResponse
- type AsyncInvokeCallbackParams
- type ColumnDesc
- type DBCallBack
- type EventPublisher
- type HeaderVal
- type HostBootInfo
- type HostBootStatus
- type HostInfo
- type HostStatus
- type HttpContext
- type HttpRequest
- type HttpResponse
- type IHost
- type IHostBoot
- type IInstanceDescription
- type IPlugin
- type IPluginDescriptor
- type IResources
- type IVersion
- type LifeCycleRequest
- type LocalDB
- type MockHost
- type MockHostBoot
- type MockInstanceDesc
- type MockPluginDescriptor
- func (i *MockPluginDescriptor) ApplicationID() string
- func (i *MockPluginDescriptor) ApplicationVersion() IVersion
- func (i *MockPluginDescriptor) HostVersion() IVersion
- func (i *MockPluginDescriptor) Language() string
- func (i *MockPluginDescriptor) LanguageVersion() IVersion
- func (i *MockPluginDescriptor) MinSystemVersion() IVersion
- func (i *MockPluginDescriptor) Name() string
- type Network
- type NetworkCallBack
- type PError
- type PluginError
- type PluginFactory
- type PluginLogger
- type RawData
- type SysDB
- type Version
- type VersionTime
- type Workspace
Constants ¶
View Source
const ( StatusOK = http.StatusOK UnknownError = 11000 // 任何时候都不应该主动使用 MsgTimeOut = 11001 SocketListenOrDialFailure = 11002 TargetEndpointNotFound = 11003 ProtoUnmarshalFailure = 11004 ProtoMarshalFailure = 11005 DbSelectFailure = 11006 DbExecFailure = 11007 DbSqlSyntaxErr = 11008 CreateFileFailure = 11009 RenameFileFailure = 11010 RemoveFileFailure = 11011 IsExistFileFailure = 11012 CopyFileFailure = 11013 ListFileFailure = 11014 IsDirFailure = 11015 ReadFailure = 11016 ReadLinesFailure = 11017 WriteBytesFailure = 11018 AppendBytesFailure = 11019 WriteStringsFailure = 11020 AppendStringsFailure = 11021 ZipFailure = 11022 UnZipFailure = 11023 GzFailure = 11024 UnGzFailure = 11025 HashFailure = 11026 MakeDirFailure = 11027 CallPluginHttpFailure = 11028 CallPluginConfigFailure = 11029 OnEnableFailure = 11030 OnDisEnableFailure = 11031 OnUpgradeFailure = 11032 OnCheckCompatibilityFailure = 11033 OnCheckStateFailure = 11034 OnHeartbeatFailure = 11035 OnPluginHttpFailure = 11036 AsyncFetchFailure = 11037 GetInstanceFailure = 11038 CallMainSystemAPIFailure = 11039 DbErrorFailure = 11040 FileNotFoundFailure = 11041 CallSysAPIFailure = 11042 OutgoingFailure = 11043 SysDbImportSqlFailure = 11044 DataBaseNameFailure = 11045 NotifyEventFailure = 11046 CallAbilityFailure = 11047 UnmarshalFailure = 11048 AddGroupFieldFailure = 11051 UpdateFieldOptionFailure = 11052 OnInstallFailure = 11053 OnUnInstallFailure = 11054 LocalDevelopErr = 11055 EndpointReceiveErr = 11056 EndpointSendErr = 11057 EndpointIdentifyErr = 11058 HostNotFoundErr = 11059 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APICore ¶
type APICore interface {
Fetch(*HttpRequest) *HttpResponse
}
type AbilityRequest ¶
type AbilityResponse ¶
type AbilityResponse struct { Data []byte `json:"data"` Err PluginError `json:"err"` }
type AsyncInvokeCallbackParams ¶
type AsyncInvokeCallbackParams func(PluginError)
type ColumnDesc ¶
type DBCallBack ¶
type DBCallBack func([]*RawData, []*ColumnDesc, PluginError)
type EventPublisher ¶
type EventPublisher interface { Subscribe(condition []string) PluginError // 不支持通配符, ex: project.task.create SubscribeWithFilter(condition []string, filter map[string][]string) PluginError // 支持过滤条件, ex: filter: project_uuid_in:[""] Unsubscribe(condition []string) PluginError // 支持通配符 }
type HostBootInfo ¶
type HostBootStatus ¶
type HostBootStatus int
const ( HostBootStatusNormal HostBootStatus = 1 HostBootStatusDrift HostBootStatus = 2 )
type HostInfo ¶
type HostInfo struct { ID string Name string Version string MinSystemVersion string Language string LanguageVersion string RunningPlugins map[string]IInstanceDescription SupportPlugins map[string]IInstanceDescription }
type HostStatus ¶
type HostStatus int
const ( HostStatusNormal HostStatus = 1 HostStatusDrift HostStatus = 2 )
type HttpContext ¶
type HttpContext struct { Params map[string]string Request *HttpRequest Response *HttpResponse }
type HttpRequest ¶
type HttpResponse ¶
type HttpResponse struct { Err PluginError Headers map[string][]string Body []byte StatusCode int }
type IHost ¶
type IHost interface { //Store() GetInfo() HostInfo GetStatus() HostStatus }
type IHostBoot ¶
type IHostBoot interface { GetInfo() HostBootInfo GetStatus() HostBootStatus }
type IInstanceDescription ¶
type IInstanceDescription interface { PluginDescription() IPluginDescriptor InstanceID() string }
type IPlugin ¶
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 IPluginDescriptor ¶
type IResources ¶
type IResources interface { GetLogger() PluginLogger GetWorkspace() Workspace GetLocalDB() LocalDB GetEventPublisher() EventPublisher GetSysDB() SysDB GetAPICore() APICore GetOutDoor() Network GetAbility() Ability }
type IVersion ¶
type IVersion interface { Major() int Minor() int Revision() int VersionString() string Relationship(IVersion) VersionTime }
func NewVersion ¶
type LifeCycleRequest ¶
type LocalDB ¶
type LocalDB interface { Select(sql string) ([]*RawData, []*ColumnDesc, PluginError) AsyncSelect(sql string, callback DBCallBack) // Unmarshal eg: // type User struct { // UUID string `orm:"uuid"` // Name string `orm:"name"` // } // users := make([]*User, 0) // err = Unmarshal(rawData, colDesc, &users) Unmarshal(rawData []*RawData, columnDesc []*ColumnDesc, v interface{}) PluginError Exec(sql string) PluginError ImportSQL(sqlFilePath string) PluginError }
type MockHost ¶
type MockHost struct { Info HostInfo Status HostStatus }
func (*MockHost) GetStatus ¶
func (h *MockHost) GetStatus() HostStatus
type MockHostBoot ¶
type MockHostBoot struct { Info HostBootInfo Status HostBootStatus }
func (*MockHostBoot) GetInfo ¶
func (b *MockHostBoot) GetInfo() HostBootInfo
func (*MockHostBoot) GetStatus ¶
func (b *MockHostBoot) GetStatus() HostBootStatus
type MockInstanceDesc ¶
type MockInstanceDesc struct { PluginInstanceID string PluginDescriptor *MockPluginDescriptor }
func (*MockInstanceDesc) InstanceID ¶
func (i *MockInstanceDesc) InstanceID() string
func (*MockInstanceDesc) PluginDescription ¶
func (i *MockInstanceDesc) PluginDescription() IPluginDescriptor
type MockPluginDescriptor ¶
type MockPluginDescriptor struct { AppID string PluginName string Lang string LangVer string AppVer string HostVer string MinSysVer string }
func (*MockPluginDescriptor) ApplicationID ¶
func (i *MockPluginDescriptor) ApplicationID() string
func (*MockPluginDescriptor) ApplicationVersion ¶
func (i *MockPluginDescriptor) ApplicationVersion() IVersion
func (*MockPluginDescriptor) HostVersion ¶
func (i *MockPluginDescriptor) HostVersion() IVersion
func (*MockPluginDescriptor) Language ¶
func (i *MockPluginDescriptor) Language() string
func (*MockPluginDescriptor) LanguageVersion ¶
func (i *MockPluginDescriptor) LanguageVersion() IVersion
func (*MockPluginDescriptor) MinSystemVersion ¶
func (i *MockPluginDescriptor) MinSystemVersion() IVersion
func (*MockPluginDescriptor) Name ¶
func (i *MockPluginDescriptor) Name() string
type Network ¶
type Network interface { Fetch(*HttpRequest) *HttpResponse AsyncFetch(*HttpRequest, NetworkCallBack) }
type NetworkCallBack ¶
type NetworkCallBack func(*HttpResponse, PluginError)
type PluginError ¶
func NewPluginError ¶
func NewPluginError(code int, msg string) PluginError
type PluginFactory ¶
type PluginFactory interface {
GetPlugin() IPlugin
}
type PluginLogger ¶
type SysDB ¶
type SysDB interface { Select(db, sql string) ([]*RawData, []*ColumnDesc, PluginError) AsyncSelect(db, sql string, callback DBCallBack) Exec(db, sql string) PluginError // Unmarshal eg: // type User struct { // UUID string `orm:"uuid"` // Name string `orm:"name"` // } // users := make([]*User, 0) // err = Unmarshal(rawData, colDesc, &users) Unmarshal(rawData []*RawData, columnDesc []*ColumnDesc, v interface{}) PluginError }
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
func ParseVersionString ¶
func (*Version) GetVersion ¶
func (*Version) Relationship ¶
func (v *Version) Relationship(t IVersion) VersionTime
func (*Version) VersionString ¶
type VersionTime ¶
type VersionTime int
const ( Earlier VersionTime = -1 Same VersionTime = 0 Later VersionTime = 1 )
func (*VersionTime) ToString ¶
func (vt *VersionTime) ToString() string
type Workspace ¶
type Workspace interface { CreateFile(string) PluginError MakeDir(string) PluginError Rename(string, string) PluginError Remove(string) PluginError IsExist(string) (bool, PluginError) IsDir(string) (bool, PluginError) Copy(string, string) PluginError Read(string) ([]byte, PluginError) ReadLines(string, int32, int32) ([]byte, PluginError) WriteBytes(string, []byte) PluginError AppendBytes(string, []byte) PluginError WriteStrings(string, []string) PluginError AppendStrings(string, []string) PluginError Zip(string, []string) PluginError UnZip(string, string) PluginError Gz(string) PluginError UnGz(string, string) PluginError Hash(string) ([]byte, PluginError) List(string) ([]string, PluginError) AsyncCopy(string, string, AsyncInvokeCallbackParams) AsyncZip(string, []string, AsyncInvokeCallbackParams) AsyncUnZip(string, string, AsyncInvokeCallbackParams) AsyncGz(string, AsyncInvokeCallbackParams) AsyncUnGz(string, string, AsyncInvokeCallbackParams) }
Click to show internal directories.
Click to hide internal directories.