 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- func NewPool(address, password string) *redis.Pool
- type A
- type AggregatorManager
- type AggregatorMgr
- type BlockDevice
- type BtrfsFS
- type BtrfsManager
- type CPUStats
- type Client
- type Command
- type ContainerCreateAguments
- type ContainerInfo
- type ContainerManager
- type ContainerResult
- type CoreManager
- type DiskManager
- type DiskStats
- type Disks
- type File
- type FilesystemManager
- type InfoManager
- type Job
- type JobId
- type JobStats
- type KvmManager
- type Network
- type NetworkConfig
- type Nic
- type Option
- type Process
- type ProcessId
- type Result
- type State
- type Streams
- type Tags
- type VCpu
- type VM
- type VMInfo
- type ZerotierItem
- type ZerotierManager
- type ZerotierRoute
Constants ¶
      View Source
      
  
    const ( CommandsQueue = "core:default" ResultNoTimeout = 0 ResultDefaultTimeout = 10 )
      View Source
      
  
const ( //StateSuccess successs exit status StateSuccess = State("SUCCESS") //StateError error exist status StateError = State("ERROR") //StateTimeout timeout exit status StateTimeout = State("TIMEOUT") //StateKilled killed exit status StateKilled = State("KILLED") //StateUnknownCmd unknown cmd exit status StateUnknownCmd = State("UNKNOWN_CMD") //StateDuplicateID dublicate id exit status StateDuplicateID = State("DUPILICATE_ID") LevelJson = 20 )
Variables ¶
      View Source
      
  
var (
	NotFound = fmt.Errorf("not found")
)
    Functions ¶
Types ¶
type AggregatorManager ¶
type AggregatorManager interface {
	Query() (interface{}, error)
}
    func Aggregator ¶
func Aggregator(cl Client) AggregatorManager
type AggregatorMgr ¶
type AggregatorMgr struct {
	Client
}
    func (*AggregatorMgr) Query ¶
func (b *AggregatorMgr) Query() (interface{}, error)
type BlockDevice ¶
type BlockDevice struct {
	Name       string        `json:"name"`
	Kname      string        `json:"kname"`
	MajMin     string        `json:"maj:min"`
	Fstype     string        `json:"fstype"`
	Mountpoint string        `json:"mountpoint"`
	Label      string        `json:"label"`
	UUID       string        `json:"uuid"`
	Parttype   string        `json:"parttype"`
	Partlabel  string        `json:"partlabel"`
	Partuuid   string        `json:"partuuid"`
	Partflags  string        `json:"partflags"`
	Ra         string        `json:"ra"`
	Ro         string        `json:"ro"`
	Rm         string        `json:"rm"`
	Hotplug    string        `json:"hotplug"`
	Model      string        `json:"model"`
	Serial     string        `json:"serial"`
	Size       string        `json:"size"`
	State      string        `json:"state"`
	Owner      string        `json:"owner"`
	Group      string        `json:"group"`
	Mode       string        `json:"mode"`
	Alignment  string        `json:"alignment"`
	MinIo      string        `json:"min-io"`
	OptIo      string        `json:"opt-io"`
	PhySec     string        `json:"phy-sec"`
	LogSec     string        `json:"log-sec"`
	Rota       string        `json:"rota"`
	Sched      string        `json:"sched"`
	RqSize     string        `json:"rq-size"`
	Type       string        `json:"type"`
	DiscAln    string        `json:"disc-aln"`
	DiscGran   string        `json:"disc-gran"`
	DiscMax    string        `json:"disc-max"`
	DiscZero   string        `json:"disc-zero"`
	Wsame      string        `json:"wsame"`
	Wwn        string        `json:"wwn"`
	Rand       string        `json:"rand"`
	Pkname     string        `json:"pkname"`
	Hctl       string        `json:"hctl"`
	Tran       string        `json:"tran"`
	Subsystems string        `json:"subsystems"`
	Rev        string        `json:"rev"`
	Vendor     string        `json:"vendor"`
	Children   []BlockDevice `json:"children"`
}
    type BtrfsManager ¶
func Btrfs ¶
func Btrfs(cl Client) BtrfsManager
type CPUStats ¶
type CPUStats struct {
	GuestNice float64 `json:"guestnice"`
	Idle      float64 `json:"idle"`
	IoWait    float64 `json:"iowait"`
	Irq       float64 `json:"irq"`
	Nice      float64 `json:"nice"`
	SoftIrq   float64 `json:"softirq"`
	Steal     float64 `json:"steal"`
	Stolen    float64 `json:"stolen"`
	System    float64 `json:"system"`
	User      float64 `json:"user"`
}
    type Client ¶
type Client interface {
	Raw(command string, args A, opts ...Option) (JobId, error)
	Result(job JobId, timeout ...int) (*Result, error)
	Exists(job JobId) bool
	ResultNonBlock(job JobId) (*Result, error)
}
    func NewClientWithPool ¶
type Command ¶
type Command struct {
	ID              string `json:"id"`
	Command         string `json:"command"`
	Arguments       A      `json:"arguments"`
	Queue           string `json:"queue"`
	StatsInterval   int    `json:"stats_interval,omitempty"`
	MaxTime         int    `json:"max_time,omitempty"`
	MaxRestart      int    `json:"max_restart,omitempty"`
	RecurringPeriod int    `json:"recurring_period,omitempty"`
	LogLevels       []int  `json:"log_levels,omitempty"`
	Tags            Tags   `json:"tags"`
}
    type ContainerCreateAguments ¶
type ContainerCreateAguments struct {
	Root        string            `json:"root"`         //Root plist
	Mount       map[string]string `json:"mount"`        //data disk mounts.
	HostNetwork bool              `json:"host_network"` //share host networking stack
	Nics        []Nic             `json:"nics"`         //network setup (only respected if HostNetwork is false)
	Port        map[int]int       `json:"port"`         //port forwards (only if default networking is enabled)
	Hostname    string            `json:"hostname"`     //hostname
	Storage     string            `json:"storage"`      //ardb storage needed for g8ufs mounts.
	Tags        []string          `json:"tags"`         //for searching containers
}
    type ContainerInfo ¶
type ContainerInfo struct {
	Arguments ContainerCreateAguments `json:"arguments"`
	Pid       int                     `json:"pid"`
	Root      string                  `json:"root"`
}
    type ContainerManager ¶
type ContainerManager interface {
	Client(id int) Client
	List() (map[int16]ContainerResult, error)
}
    func Container ¶
func Container(cl Client) ContainerManager
type ContainerResult ¶
type ContainerResult struct {
	Container ContainerInfo `json:"container"`
	CPU       int           `json:"cpu"`
	Swap      int           `json:"swap"`
	RSS       int           `json:"ress"`
}
    type CoreManager ¶
type CoreManager interface {
	System(cmd string, env map[string]string, cwd string, stdin string, opt ...Option) (JobId, error)
	SystemArgs(cmd string, args []string, env map[string]string, cwd string, stdin string, opt ...Option) (JobId, error)
	Bash(bash string, stdin string, opt ...Option) (JobId, error)
	Ping() error
	Jobs() ([]Job, error)
	Job(job JobId) (*Job, error)
	KillJob(job JobId, signal syscall.Signal) error
	KillAllJobs() error
	Process(pid ProcessId) (*Process, error)
	ProcessAlive(pid ProcessId) (bool, error)
	Processes() ([]Process, error)
	KillProcess(pid ProcessId, signal syscall.Signal) error
	State() (*JobStats, error)
}
    func Core ¶
func Core(client Client) CoreManager
type DiskManager ¶
func Disk ¶
func Disk(cl Client) DiskManager
type Disks ¶
type Disks struct {
	BlockDevices []BlockDevice `json:"blockdevices"`
}
    type FilesystemManager ¶
type FilesystemManager interface {
	Upload(reader io.Reader, p string) error
	Download(p string, writer io.Writer) error
	Remove(p string) error
	Exists(p string) (bool, error)
}
    func Filesystem ¶
func Filesystem(client Client) FilesystemManager
type InfoManager ¶
type InfoManager interface {
	CPU() ([]cpu.InfoStat, error)
	Mem() (mem.VirtualMemoryStat, error)
	Nic() ([]net.InterfaceStat, error)
	Disk() ([]disk.PartitionStat, error)
	OS() (host.InfoStat, error)
}
    func Info ¶
func Info(cl Client) InfoManager
type KvmManager ¶
func Kvm ¶
func Kvm(cl Client) KvmManager
type NetworkConfig ¶
type Nic ¶
type Nic struct {
	Type      string        `json:"type"`
	ID        string        `json:"id"`
	HWAddress string        `json:"hwaddr"`
	Config    NetworkConfig `json:"config"`
}
    type Option ¶
type Option interface {
	// contains filtered or unexported methods
}
    func MaxRestart ¶
func RecurringPeriod ¶
type Result ¶
type Result struct {
	ID        string  `json:"id"`
	Command   string  `json:"command"`
	Data      string  `json:"data"`
	Streams   Streams `json:"streams,omitempty"`
	Critical  string  `json:"critical,omitempty"`
	Level     int     `json:"level"`
	State     State   `json:"state"`
	Code      uint32  `json:"code"`
	StartTime int64   `json:"starttime"`
	Time      int64   `json:"time"`
	Tags      string  `json:"tags"`
	Container uint64  `json:"container"`
}
    type ZerotierItem ¶
type ZerotierItem struct {
	Nwid              string   `json:"nwid"`
	Name              string   `json:"name"`
	Status            string   `json:"status"`
	Type              string   `json:"type"`
	AllowDefault      bool     `json:"allowDefault"`
	AllowGlobal       bool     `json:"allowGlobal"`
	AllowManaged      bool     `json:"allowManaged"`
	Bridge            bool     `json:"bridge"`
	BroadcastEnabled  bool     `json:"broadcastEnabled"`
	DHCP              bool     `json:"dhcp"`
	ID                string   `json:"id"`
	Mac               string   `json:"mac"`
	Mtu               uint64   `json:"mtu"`
	NetConfRevision   uint64   `json:"netconfRevision"`
	PortDeviceName    string   `json:"portDeviceName"`
	PortError         uint8    `json:"portError"`
	AssignedAddresses []string `json:"assignedAddresses"`
}
    type ZerotierManager ¶
type ZerotierManager interface {
	List() ([]ZerotierItem, error)
}
    func Zerotier ¶
func Zerotier(cl Client) ZerotierManager
 Click to show internal directories. 
   Click to hide internal directories.