cmd

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2019 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Created By ytzhang0828@qq.com Use of this source code is governed by a Apache-2.0 LICENSE

cmd 包实现基础命令的数据模型,并实现基础命令业务逻辑

cmd基础包中定义的 常量

Index

Constants

View Source
const CmdRun = "cmd.run"

标准命令

View Source
const DefaultCmdTimeout int = 60000

默认执行命令超时时间 单位 毫秒

View Source
const ProxyHttp = "proxy.http"

http proxy

View Source
const Req_ping = "req_ping"

心跳消息

View Source
const Res_prefix = "res_"

返回结果前缀

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	*Head `json:"head"`
	Body  string `json:"body,omitempty"` //实际的命令参数或二进制数据的base64编码
}

基础命令结构

type CmdResult

type CmdResult struct {
	Type      string `json:"type,omitempty"`
	JobId     string `json:"jobId,omitempty"` //任务id, 命令唯一序列号
	Async     int    `json:"async"`           //标志是否异步命令
	IsTimeout bool   `json:"isTimeout,omitempty"`
	Stdout    string `json:"stdout,omitempty"`
	Stderr    string `json:"stderr,omitempty"`
}

基础命令 返回结果结构

func CommandRun

func CommandRun(cmd *Cmd) *CmdResult

执行通用命令

func (*CmdResult) String

func (cmdResult *CmdResult) String() string
type Head struct {
	Type    string `json:"type"`              //like cmd.run
	JobId   string `json:"jobId,omitempty"`   //命令唯一序列号
	Timeout int    `json:"timeout,omitempty"` //执行命令超时时间 单位 毫秒
	Async   int    `json:"async,omitempty"`
}

基础命令 头信息结构

Jump to

Keyboard shortcuts

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