cmd

package
v2.5.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//List of operation name for cli
	CliOpGet               = "get"
	CliOpList              = "list"
	CliOpStatus            = "stat"
	CliOpCreate            = "create"
	CliOpDelete            = "delete"
	CliOpInfo              = "info"
	CliOpAdd               = "add"
	CliOpSet               = "set"
	CliOpDecommission      = "decommission"
	CliOpDownloadZip       = "load"
	CliOpMetaCompatibility = "meta"
	CliOpFreeze            = "freeze"
	CliOpSetThreshold      = "threshold"
	CliOpSetDelRate        = "delelerate"
	CliOpCheck             = "check"
	CliOpReset             = "reset"
	CliOpReplicate         = "add-replica"
	CliOpDelReplica        = "del-replica"
	CliOpExpand            = "expand"
	CliOpShrink            = "shrink"

	//Shorthand format of operation name
	CliOpDecommissionShortHand = "dec"

	//resource name
	CliResourceDataNode      = "datanode [COMMAND]"
	CliResourceMetaNode      = "metanode"
	CliResourceDataPartition = "datapartition"
	CliResourceMetaPartition = "metapartition"
	CliResourceTopology      = "topology"
	CliResourceRaftNode      = "raftnode"
	CliResourceDisk          = "disk"
	CliResourceConfig        = "config"

	//Flags
	CliFlagName               = "name"
	CliFlagOnwer              = "user"
	CliFlagDataPartitionSize  = "dp-size"
	CliFlagDataPartitionCount = "dp-count"
	CliFlagMetaPartitionCount = "mp-count"
	CliFlagReplicas           = "replicas"
	CliFlagEnable             = "enable"
	CliFlagEnableFollowerRead = "follower-read"
	CliFlagAuthenticate       = "authenticate"
	CliFlagCapacity           = "capacity"
	CliFlagThreshold          = "threshold"
	CliFlagAddress            = "addr"
	CliFlagDiskPath           = "path"
	CliFlagAuthKey            = "authkey"
	CliFlagINodeStartID       = "inode-start"
	CliFlagId                 = "id"
	CliFlagZoneName           = "zonename"
	CliFlagAutoRepairRate     = "auto-repair-rate"
	CliFlagDelBatchCount      = "delete-batch-count"
	CliFlagDelWorkerSleepMs   = "delete-worker-sleep-ms"
	CliFlagMarkDelRate        = "mark-delete-rate"
	CliFlagCrossZone          = "crossZone"

	//Shorthand format of resource name
	ResourceDataNodeShortHand      = "dn"
	ResourceMetaNodeShortHand      = "mn"
	ResourceDataPartitionShortHand = "dp"
	ResourceMetaPartitionShortHand = "mp"
)
View Source
const (
	RoleMaster           = "master"
	RoleClient           = "client"
	KeyRole              = "role"
	KeyVersion           = "version"
	KeyMasterListenPort  = "listen"
	KeyMasterAddr        = "masterAddr"
	KeyMasterClusterName = "clusterName"
	KeyMasterPeers       = "peers"
)

Variables

View Source
var (
	GenClusterCfgCmd = &cobra.Command{
		Use:   "gencfg",
		Short: "generate cfs cluster config",
		Long:  `Generate chubaofs cluster json config files by yaml config`,
		Run:   genCfgCmd,
	}
)

Functions

func NewVolumeClient

func NewVolumeClient(opCode MasterOp, client *master.MasterClient) (vol *volumeClient)

func OsExitWithLogFlush

func OsExitWithLogFlush()

Types

type ChubaoFSCmd

type ChubaoFSCmd struct {
	CFSCmd *cobra.Command
}

func NewRootCmd

func NewRootCmd(client *master.MasterClient) *ChubaoFSCmd

type ClusterConfig

type ClusterConfig struct {
	Name    string                 `yaml:"name"`
	Version string                 `yaml:"version,omitempty"`
	Config  map[string]interface{} `yaml:"config,omitempty"`
	Master  *MasterConfig          `yaml:"master"`
	Nodes   []NodeConfig           `yaml:"nodes,flow"`
}

cluster config ! cluster: ! name: <cluster name> ! version: <cluster version> ! config: ! <common config> ! master: ! <master config> ! nodes: ! - <other nodes>

type Config

type Config struct {
	MasterAddr []string `json:"masterAddr"`
	Timeout    uint16   `json:"timeout"`
}

func LoadConfig

func LoadConfig() (*Config, error)

type MasterConfig

type MasterConfig struct {
	IgnoreCommon bool                   `yaml:"ignoreCommon,omitempty"`
	Hosts        []string               `yaml:"hosts"`
	Config       map[string]interface{} `yaml:"config,omitempty"`
}

master config ! master: ! hosts: ! - <master host list> ! config: ! <master config map>

type MasterOp

type MasterOp int
const (
	OpExpandVol MasterOp = iota
	OpShrinkVol
	OpCreateVol
	OpDeleteVol
)

type NodeConfig

type NodeConfig struct {
	Role         string                 `yaml:"role"`
	IgnoreCommon bool                   `yaml:"ignoreCommon,omitempty"`
	Config       map[string]interface{} `yaml:"config,omitempty"`
}

other node config ! role: <node role> ! ignoreCommon: <ignore cluster common config> ! config: ! <node specified config map>

type RootConfig

type RootConfig struct {
	Version string         `yaml:"version,omitempty"`
	Cluster *ClusterConfig `yaml:"cluster"`
}

config root

! version: <cluster config version> ! cluster: ! <cluster config>

Jump to

Keyboard shortcuts

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