napi

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NsOpLogHostletRepSync   = "hostlet/rep/sync"
	NsOpLogHostletRepAction = "hostlet/rep/action"
)
View Source
const (
	BoxStatsSampleCycle uint32 = 20
	BoxStatsLogCycle    uint32 = 60

	AgentBoxStatusFmt = "%s/%s/home/action/.sysinner/box_status.json"
)

Variables

View Source
var (
	PodVolSysFmt       = "%s/%s"
	PodVolSysArchFmt   = "%s/%s.%s"
	VolPodHomeFmt      = "%s/%s/home/action"
	VolAgentSysDirFmt  = "%s/%s/home/action/.sysinner"
	BoxInstanceNameReg = regexp.MustCompile("^([0-9a-f]{16,24})-([0-9a-f]{4})$")
	StatsFeedNames     = []string{
		"ram/us", "ram/cc",
		"net/rs", "net/ws",
		"cpu/us",
		"fs/rn", "fs/rs", "fs/wn", "fs/ws",
	}
	LxcFsVols = []*inapi.PbVolumeMount{}
)

Functions

func AgentBoxStatus

func AgentBoxStatus(mnt, podId string, repId uint32) string

func ArrayInt32Equal

func ArrayInt32Equal(a, b []int32) bool

func ArrayInt32Sort

func ArrayInt32Sort(ls []int32)

func BoxInstanceName

func BoxInstanceName(podId string, repId uint32) string

func BoxInstanceNameParse

func BoxInstanceNameParse(hostname string) (podId string, repId uint32)

func InPackHostDir

func InPackHostDir(name, version, release, dist, arch string) string

func InPackMountPath

func InPackMountPath(name, version string) string

func ObjPrint

func ObjPrint(name string, v interface{})

func PodRepNetworkDomainName

func PodRepNetworkDomainName(podId string, repId uint32) string

func PodVolSysDir

func PodVolSysDir(mnt string, podId string, repId uint32) string

func PodVolSysDirArch

func PodVolSysDirArch(mnt string, podId string, repId uint32) string

func VolAgentSysDir

func VolAgentSysDir(mnt string, podId string, repId uint32) string

func VolMountPoint

func VolMountPoint(mnt string) string

func VolPodHomeDir

func VolPodHomeDir(mnt string, podId string, repId uint32) string

func VolPodPath

func VolPodPath(mnt string, podId string, repId uint32, path string) string

Types

type BoxDriver

type BoxDriver interface {
	Name() string
	Start() error
	Stop() error
	StatusList() []*BoxInstance
	StatsList() []*BoxInstanceStatsFeed
	ImageSetup(box *BoxInstance) error
	BoxCreate(box *BoxInstance) error
	BoxStart(box *BoxInstance) error
	BoxStop(box *BoxInstance) error
	BoxRemove(box *BoxInstance) error
	BoxExist(box *BoxInstance) (bool, error)
}

type BoxDriverList

type BoxDriverList struct {
	Items []BoxDriver
}

func (*BoxDriverList) Get

func (ls *BoxDriverList) Get(name string) BoxDriver

type BoxInstance

type BoxInstance struct {
	ID              string                     `json:"id"`
	Name            string                     `json:"name"`
	PodID           string                     `json:"pod_id"`
	PodOpVersion    uint32                     `json:"pod_op_version"`
	UpUpdated       uint32                     `json:"up_updated"`
	Spec            inapi.PodSpecBoxBound      `json:"spec"`
	Apps            inapi.AppInstances         `json:"apps"`
	Replica         inapi.PodOperateReplica    `json:"replica"`
	Retry           int                        `json:"retry"`
	Env             []inapi.EnvVar             `json:"env"`
	Status          inapi.PbPodBoxStatus       `json:"status"`
	HealthStatus    inapi.HealthStatus         `json:"health_status"`
	Stats           *inapi.PbStatsSampleFeed   `json:"-"`
	SysVolSynced    int64                      `json:"sys_vol_synced"`
	SpecCpuSets     []int32                    `json:"spec_cpu_sets"`
	SpecMounts      []*inapi.PodSpecBoundMount `json:"spec_mounts"`
	PackMounts      []*BoxPackMount            `json:"pack_mounts"`
	SetupHosts      []string                   `json:"setup_hosts"`
	BlkioDeviceBps  int64                      `json:"blkio_device_bps"`  // bytes per second
	BlkioDeviceIOps int64                      `json:"blkio_device_iops"` // IO per second
	// contains filtered or unexported fields
}

func (*BoxInstance) BlkioDeviceRefresh

func (inst *BoxInstance) BlkioDeviceRefresh()

func (*BoxInstance) CpuSets

func (inst *BoxInstance) CpuSets() string

func (*BoxInstance) ExtHosts

func (inst *BoxInstance) ExtHosts(excludeRep bool) []string

func (*BoxInstance) OpActionDesired

func (inst *BoxInstance) OpActionDesired() bool

func (*BoxInstance) OpLock

func (it *BoxInstance) OpLock() bool

func (*BoxInstance) OpRepKey

func (inst *BoxInstance) OpRepKey() string

func (*BoxInstance) OpUnlock

func (it *BoxInstance) OpUnlock()

func (*BoxInstance) SpecDesired

func (inst *BoxInstance) SpecDesired() bool

func (*BoxInstance) StatusActionSet

func (inst *BoxInstance) StatusActionSet(op uint32)

func (*BoxInstance) StatusLock

func (it *BoxInstance) StatusLock() bool

func (*BoxInstance) StatusUnlock

func (it *BoxInstance) StatusUnlock()

func (*BoxInstance) VolumeMountsExport

func (inst *BoxInstance) VolumeMountsExport() []string

func (*BoxInstance) VolumeMountsRefresh

func (inst *BoxInstance) VolumeMountsRefresh()

type BoxInstanceSets

type BoxInstanceSets struct {
	Items      []*BoxInstance       `json:"items"`
	CpuUsages  []*SysCpuUsage       `json:"cpu_usages"`
	CpuCap     int32                `json:"cpu_cap"`
	VolDevices []*VolumeDeviceEntry `json:"device_map"`
	// contains filtered or unexported fields
}

func (*BoxInstanceSets) Del

func (ls *BoxInstanceSets) Del(name string)

func (*BoxInstanceSets) DeviceGet

func (ls *BoxInstanceSets) DeviceGet(mnt string) string

func (*BoxInstanceSets) DeviceSet

func (ls *BoxInstanceSets) DeviceSet(mnt, dev string) string

func (*BoxInstanceSets) Each

func (ls *BoxInstanceSets) Each(fn func(item *BoxInstance))

func (*BoxInstanceSets) Fix

func (ls *BoxInstanceSets) Fix() bool

func (*BoxInstanceSets) Get

func (ls *BoxInstanceSets) Get(name string) *BoxInstance

func (*BoxInstanceSets) OpLockNum

func (ls *BoxInstanceSets) OpLockNum() int

func (*BoxInstanceSets) Set

func (ls *BoxInstanceSets) Set(item *BoxInstance)

func (*BoxInstanceSets) Size

func (ls *BoxInstanceSets) Size() int

func (*BoxInstanceSets) SpecCpuSetsDesired

func (ls *BoxInstanceSets) SpecCpuSetsDesired(inst *BoxInstance) bool

func (*BoxInstanceSets) StatusSet

func (ls *BoxInstanceSets) StatusSet(item *BoxInstance)

type BoxInstanceStatsEntry

type BoxInstanceStatsEntry struct {
	Name  string
	Value int64
}

type BoxInstanceStatsFeed

type BoxInstanceStatsFeed struct {
	Name  string
	Time  uint32
	Items []*BoxInstanceStatsEntry
}

func (*BoxInstanceStatsFeed) Set

func (it *BoxInstanceStatsFeed) Set(name string, value int64)

type BoxPackMount

type BoxPackMount struct {
	Name     string `json:"name"`
	Version  string `json:"version"`
	HostPath string `json:"host_path"`
}

type RsyncModuleItem

type RsyncModuleItem struct {
	User string `json:"user"`
	Dir  string `json:"dir"`
}

type SysCpuUsage

type SysCpuUsage struct {
	Num   int32 `json:"num"`
	Usage int   `json:"usage"`
}

type VolumeDeviceEntry

type VolumeDeviceEntry struct {
	Mountpoint string
	Device     string
}

Jump to

Keyboard shortcuts

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