host

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BkCloudIDKey     = "bk_cloud_id"
	BkHostInnerIPKey = "bk_host_innerip"
	BkBizIDKey       = "bk_biz_id"
	BkSetIDKey       = "bk_set_id"
	BkModuleIDKey    = "bk_module_id"
	BkObjectIDKey    = "bk_obj_id"
	BkInstIDKey      = "bk_inst_id"
	CustomerToposKey = "layer"
	AssociationsKey  = "associations"
	ChildLayerKey    = "child"

	DefaultLength = 10
)
View Source
const (
	DefaultPath = "/var/lib/gse/host/hostid"
)

Variables

View Source
var (
	ErrGetAssociationFailed = errors.New("get association content failed")
	ErrFileNotExist         = errors.New("host id file not exist")
	ErrParseFileFailed      = errors.New("parse host id file failed")
	ErrParseHostInfoFailed  = errors.New("translate info(number to int) failed")
)
View Source
var (
	DefaultCMDBLevel = map[string]bool{
		"set":    true,
		"module": true,
		"biz":    true,
	}
)

Functions

This section is empty.

Types

type Info

type Info []map[string]interface{}

Info Info数据载体

type Watcher

type Watcher interface {
	Start() error
	Stop()
	Reload(ctx context.Context, address string, length int, mustFileExist bool) error
	GetInfo() (Info, error)
	GetInfoByLevelID(name string, id int) (Info, error)
	GetInfoByCloudIdAndIp(bkCloudId, bkInnerIp string) (Info, error)
	GetUpdateTime() time.Time
	GetCloudId() string
	GetHostInnerIp() string
	UpdateOnce() error
}

Watcher :

func NewEmptyWatcher

func NewEmptyWatcher() Watcher

NewEmptyWatcher 空 watcher,mock 掉所有 watcher 功能

func NewWatcher

func NewWatcher(ctx context.Context, filePath string, cmdbLevelMaxLength int, mustFileExist bool) Watcher

NewWatcher 提供一个Info,并启动监听

Jump to

Keyboard shortcuts

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