Documentation ¶
Index ¶
- Constants
- Variables
- func GetArch() (formatArch string, rawArch string)
- func InitPluginCheckTimer()
- type InstalledPlugins
- func (ip *InstalledPlugins) Close() error
- func (ip *InstalledPlugins) DeleteByKey(key int) error
- func (ip *InstalledPlugins) FindAll() ([]int, []PluginInfo, error)
- func (ip *InstalledPlugins) FindManyByName(name string) ([]int, []PluginInfo, error)
- func (ip *InstalledPlugins) FindOneWithPredicate(predicate func(plugin *PluginInfo) bool) (int, *PluginInfo, error)
- func (ip *InstalledPlugins) Insert(value *PluginInfo) (int, error)
- func (ip *InstalledPlugins) Update(key int, value *PluginInfo) error
- type PluginInfo
- type PluginListRequest
- type PluginListResponse
- type PluginStatus
- type PluginStatusResponse
- type PluginStatusResquest
- type PluginUpdateCheck
- type PluginUpdateCheckRequest
- type PluginUpdateCheckResponse
- type PluginUpdateInfo
Constants ¶
View Source
const ( NORMAL_REPORT = 0 LAZY_REPORT = 1 // 懒上报 // 限制上报时插件名和插件版本字段的长度 PLUGIN_NAME_MAXLEN = 255 PLUGIN_VERSION_MAXLEN = 32 )
View Source
const ( ARCH_64 = "x64" ARCH_32 = "x86" ARCH_ARM = "arm" ARCH_UNKNOWN = "unknown" )
View Source
const ( // PluginTypeHealth 健康 0 PERSIST_RUNNING string = "PERSIST_RUNNING" // PluginTypeFail 未成功启动 1 PERSIST_FAIL string = "PERSIST_FAIL" // PluginUnknown 未知 PERSIST_UNKNOWN string = "PERSIST_UNKNOWN" // PluginTypeOnce 一次性插件已安装 2 ONCE_INSTALLED string = "ONCE_INSTALLED" // 已删除 REMOVED string = "REMOVED" )
插件状态
View Source
const ( // PluginOneTime 一次性插件 PLUGIN_ONCE string = "Once" PLUGIN_ONCE_INT int = 0 // PluginPersist 常驻型插件 PLUGIN_PERSIST string = "Persist" PLUGIN_PERSIST_INT int = 1 // PluginUnknown 未知类型 PLUGIN_UNKNOWN string = "Unknown" PLUGIN_UNKNOWN_INT int = -1 )
插件类型
Variables ¶
View Source
var (
NEED_REFRESH_STATUS_API []string = []string{"--install", "--uninstall", "--start", "--stop", "--upgrade", "--restart"}
)
调用一下接口后需要主动向服务端上报插件状态
Functions ¶
func InitPluginCheckTimer ¶
func InitPluginCheckTimer()
Types ¶
type InstalledPlugins ¶
type InstalledPlugins struct {
// contains filtered or unexported fields
}
func LoadInstalledPlugins ¶
func LoadInstalledPlugins() (*InstalledPlugins, error)
TODO-FIXME: Should LoadInstalledPlugins has a timeout limit? Now it simply waits indefinitely.
func (*InstalledPlugins) Close ¶
func (ip *InstalledPlugins) Close() error
Close can be called multiple times and internal implementation in bbolt would keep it safe. Thus close the database as soon as possible please.
func (*InstalledPlugins) DeleteByKey ¶
func (ip *InstalledPlugins) DeleteByKey(key int) error
func (*InstalledPlugins) FindAll ¶
func (ip *InstalledPlugins) FindAll() ([]int, []PluginInfo, error)
func (*InstalledPlugins) FindManyByName ¶
func (ip *InstalledPlugins) FindManyByName(name string) ([]int, []PluginInfo, error)
func (*InstalledPlugins) FindOneWithPredicate ¶
func (ip *InstalledPlugins) FindOneWithPredicate(predicate func(plugin *PluginInfo) bool) (int, *PluginInfo, error)
func (*InstalledPlugins) Insert ¶
func (ip *InstalledPlugins) Insert(value *PluginInfo) (int, error)
func (*InstalledPlugins) Update ¶
func (ip *InstalledPlugins) Update(key int, value *PluginInfo) error
Update method simply stores new value to specified position in JSON array. Would PANIC if key is out of range.
type PluginInfo ¶
type PluginInfo struct { PluginID string `json:"pluginId"` Name string `json:"name"` Arch string `json:"arch"` OSType string `json:"osType"` Version string `json:"version"` Publisher string `json:"publisher"` Url string `json:"url"` Md5 string `json:"md5"` RunPath string `json:"runPath"` Timeout string `json:"timeout"` IsPreInstalled string `json:"isPreInstalled"` PluginType_ interface{} `json:"pluginType"` HeartbeatInterval int `json:"heartbeatInterval"` IsRemoved bool `json:"isRemoved"` AddSysTag bool `json:"addSysTag"` // contains filtered or unexported fields }
func (*PluginInfo) PluginType ¶
func (pi *PluginInfo) PluginType() string
func (*PluginInfo) SetPluginType ¶
func (pi *PluginInfo) SetPluginType(pluginType string)
type PluginListRequest ¶
type PluginListRequest struct { OsType string `json:"osType"` PluginName string `json:"pluginName"` Version string `json:"version"` Arch string `json:"arch"` }
向服务端请求插件列表的接口数据
type PluginListResponse ¶
type PluginListResponse struct { Code int `json:"code"` RequestId string `json:"requestId"` InstanceId string `json:"instanceId"` PluginList []PluginInfo `json:"pluginList"` }
type PluginStatus ¶
type PluginStatus struct { Name string `json:"name"` Status string `json:"status"` Version string `json:"version"` SysTagType string `json:"sysTagType,omitempty"` }
状态上报的请求数据
type PluginStatusResponse ¶
type PluginStatusResponse struct { InstanceId string `json:"instanceId"` Code int `json:"code"` ScanInterval int `json:"scanInterval"` // 下次Agent周期扫描插件状态的频率(兜底),单位秒 PullInterval int `json:"pullInterval"` // 下次Agent主动拉取插件状态的频率,单位秒 RefreshInterval int `json:"refreshInterval"` // 周期扫描到Failed状态的常驻插件后会拉起,在RefreshInterval间隔后上报插件状态 ReportType int `json:"reportType"` // 上报方式 0-正常上报;1-懒上报 }
状态上报的响应数据
type PluginStatusResquest ¶
type PluginStatusResquest struct {
Plugin []PluginStatus `json:"plugin"`
}
type PluginUpdateCheck ¶
PluginUpdateCheck 检查升级请求数据
type PluginUpdateCheckRequest ¶
type PluginUpdateCheckRequest struct { Os string `json:"os"` Arch string `json:"arch"` Plugin []PluginUpdateCheck `json:"plugin"` }
type PluginUpdateCheckResponse ¶
type PluginUpdateCheckResponse struct { InstanceId string `json:"instanceId"` NextInterval int `json:"nextInterval"` Plugin []PluginUpdateInfo `json:"plugin"` }
PluginUpdateCheckResp 检查升级的响应数据
type PluginUpdateInfo ¶
type PluginUpdateInfo struct { Name string `json:"name"` Version string `json:"version"` Timeout int `json:"timeout"` }
PluginUpdateInfo 升级插件的信息
Source Files ¶
Click to show internal directories.
Click to hide internal directories.