memory

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FetchSuccess    = 200000 // 成功
	FetchForbiden   = 401000 // 无权限
	FetchBadRequest = 400001 // 分页参数错误
	FetchException  = 500000 // 服务端错误
)
View Source
const (
	// PluginName plugin name
	PluginName = "memory"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher added in v1.14.0

type Fetcher interface {
	GetIPs() ([]IPInfo, IPs, error)
}

Fetcher fetcher by get cmdb data

type IP added in v1.14.0

type IP struct {
	IP   string
	Type IPType
	// contains filtered or unexported fields
}

IP ip info

func NewIP added in v1.14.0

func NewIP(info IPInfo) (IP, error)

func (IP) Match added in v1.14.0

func (p IP) Match(ip string) bool

Match target ip is match

type IPInfo added in v1.14.0

type IPInfo struct {
	IP     string       `json:"ip"`
	Type   IPType       `json:"type"`
	Region LocationInfo `json:"region"`
	Zone   LocationInfo `json:"zone"`
	Campus LocationInfo `json:"campus"`
}

IPInfo ip info

type IPType added in v1.14.0

type IPType string

IPType ip type

const (
	Host    IPType = "host"
	Mask    IPType = "mask"
	Backoff IPType = "backoff"
)

type IPs added in v1.14.0

type IPs struct {
	Hosts   map[string]IP
	Mask    []IP
	Backoff *IP
}

IPs

type LocationInfo added in v1.14.0

type LocationInfo struct {
	Name     string                 `json:"name"`
	Metadata map[string]interface{} `json:"metadata"`
}

LocationInfo

type Memory

type Memory struct {
	IPs atomic.Value
	// contains filtered or unexported fields
}

Memory 定义MemoryCMDB类

func (*Memory) Destroy

func (m *Memory) Destroy() error

Destroy 销毁函数

func (*Memory) GetLocation

func (m *Memory) GetLocation(host string) (*model.Location, error)

GetLocation 实现CMDB插件接口

func (*Memory) Initialize

func (m *Memory) Initialize(c *plugin.ConfigEntry) error

Initialize 初始化函数

func (*Memory) Name

func (m *Memory) Name() string

Name 返回插件名

func (*Memory) Range

func (m *Memory) Range(handler func(host string, location *model.Location) (bool, error)) error

Range 实现CMDB插件接口

func (*Memory) Size

func (m *Memory) Size() int32

Size 实现CMDB插件接口

type Request added in v1.14.0

type Request struct {
	RequestID string `json:"request_id"`
	PageNo    int64  `json:"page_no"`
	PageSize  int64  `json:"page_size"`
}

Request request cmdb data

type Response added in v1.14.0

type Response struct {
	Total    int      `json:"total"`
	Size     int      `json:"size"`
	Code     int      `json:"code"`
	Info     string   `json:"info"`
	Priority string   `json:"priority"`
	Data     []IPInfo `json:"data"`
}

Response response cmdb data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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