basecmd

package
v0.0.0-...-46d4b59 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CURL_VERSION = "curl/7.54.0"
)

Variables

This section is empty.

Functions

func GetKeyValueFromJsonMetric

func GetKeyValueFromJsonMetric(metricRet string, key string) (string, *cmderror.CmdError)

func GetMetricValue

func GetMetricValue(metricRet string) (string, *cmderror.CmdError)

func GetRpcListResponse

func GetRpcListResponse(rpcList []*Rpc, rpcFunc []RpcFunc) ([]interface{}, []*cmderror.CmdError)

func GetRpcResponse

func GetRpcResponse(rpc *Rpc, rpcFunc RpcFunc) (interface{}, *cmderror.CmdError)

func NewFinalCurveCli

func NewFinalCurveCli(cli *FinalCurveCmd, funcs FinalCurveCmdFunc) *cobra.Command

func NewMidCurveCli

func NewMidCurveCli(cli *MidCurveCmd, add MidCurveCmdFunc) *cobra.Command

func QueryMetric

func QueryMetric(m *Metric) (string, *cmderror.CmdError)

Types

type FinalCurveCmd

type FinalCurveCmd struct {
	Use      string             `json:"-"`
	Short    string             `json:"-"`
	Long     string             `json:"-"`
	Example  string             `json:"-"`
	Error    *cmderror.CmdError `json:"error"`
	Result   interface{}        `json:"result"`
	TableNew *tablewriter.Table `json:"-"`
	Header   []string           `json:"-"`
	Cmd      *cobra.Command     `json:"-"`
}

FinalCurveCmd is the final executable command, it has no subcommands. The execution process is Init->RunCommand->Print. Error Use to indicate whether the command is wrong and the reason for the execution error

func (*FinalCurveCmd) SetHeader

func (fc *FinalCurveCmd) SetHeader(header []string)

type FinalCurveCmdFunc

type FinalCurveCmdFunc interface {
	Init(cmd *cobra.Command, args []string) error
	RunCommand(cmd *cobra.Command, args []string) error
	Print(cmd *cobra.Command, args []string) error
	// result in plain format string
	ResultPlainOutput() error
	AddFlags()
}

FinalCurveCmdFunc is the function type for final command If there is flag[required] related code should not be placed in init, the check for it is placed between PreRun and Run

type Metric

type Metric struct {
	Addrs  []string
	SubUri string
	// contains filtered or unexported fields
}

func NewMetric

func NewMetric(addrs []string, subUri string, timeout time.Duration) *Metric

type MetricResult

type MetricResult struct {
	Addr  string
	Key   string
	Value string
	Err   *cmderror.CmdError
}

type MidCurveCmd

type MidCurveCmd struct {
	Use   string
	Short string
	Cmd   *cobra.Command
}

MidCurveCmd is the middle command and has subcommands. If you execute this command you will be prompted which subcommands are included

type MidCurveCmdFunc

type MidCurveCmdFunc interface {
	AddSubCommands()
}

Add subcommand for MidCurveCmd

type Result

type Result struct {
	// contains filtered or unexported fields
}

type Rpc

type Rpc struct {
	Addrs         []string
	RpcTimeout    time.Duration
	RpcRetryTimes int32
	RpcFuncName   string
}

func NewRpc

func NewRpc(addrs []string, timeout time.Duration, retryTimes int32, funcName string) *Rpc

type RpcFunc

type RpcFunc interface {
	NewRpcClient(cc grpc.ClientConnInterface)
	Stub_Func(ctx context.Context) (interface{}, error)
}

type RpcResult

type RpcResult struct {
	Response interface{}
	Error    *cmderror.CmdError
	// contains filtered or unexported fields
}

Directories

Path Synopsis
check/server
* Project: CurveCli * Created Date: 2023-05-07 * Author: pengpengSir
* Project: CurveCli * Created Date: 2023-05-07 * Author: pengpengSir
create/dir
* Copyright (c) 2023 NetEase Inc.
* Copyright (c) 2023 NetEase Inc.
create/file
* Copyright (c) 2023 NetEase Inc.
* Copyright (c) 2023 NetEase Inc.
delete/snapshot
* Project: CurveCli * Created Date: 2023-11-10 * Author: ZackSoul
* Project: CurveCli * Created Date: 2023-11-10 * Author: ZackSoul
list/chunkserver
* Copyright (c) 2023 NetEase Inc.
* Copyright (c) 2023 NetEase Inc.
list/space
* Copyright (c) 2023 NetEase Inc.
* Copyright (c) 2023 NetEase Inc.
query/chunkserver
* Copyright (c) 2023 NetEase Inc.
* Copyright (c) 2023 NetEase Inc.
query/pool
* Copyright (c) 2023 NetEase Inc.
* Copyright (c) 2023 NetEase Inc.
recover
* Project: CurveCli * Created Date: 2023-11-15 * Author: CrystalAnalyst
* Project: CurveCli * Created Date: 2023-11-15 * Author: CrystalAnalyst
status/chunkserver
* Copyright (c) 2023 NetEase Inc.
* Copyright (c) 2023 NetEase Inc.
stop
* Project: CurveCli * Created Date: 2023-11-02 * Author: ZackSoul
* Project: CurveCli * Created Date: 2023-11-02 * Author: ZackSoul
stop/snapshot
* Project: CurveCli * Created Date: 2023-11-02 * Author: ZackSoul
* Project: CurveCli * Created Date: 2023-11-02 * Author: ZackSoul

Jump to

Keyboard shortcuts

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