cmd

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// acl op
	CliAclAdd = "add"

	CliAclDel   = "del"
	CliAclCheck = "check"
)
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"
	CliOpUpdate                      = "update"
	CliOpDecommission                = "decommission"
	CliOpRecommission                = "recommission"
	CliOpQueryProgress               = "query-progress"
	CliOpAbortDecommission           = "abort-decommission"
	CliOpMigrate                     = "migrate"
	CliOpDownloadZip                 = "load"
	CliOpMetaCompatibility           = "meta"
	CliOpFreeze                      = "freeze"
	CliOpSetThreshold                = "threshold"
	CliOpSetVolDeletionDelayTime     = "volDeletionDelayTime"
	CliOpSetCluster                  = "set"
	CliOpCheck                       = "check"
	CliOpReset                       = "reset"
	CliOpReplicate                   = "add-replica"
	CliOpDelReplica                  = "del-replica"
	CliOpExpand                      = "expand"
	CliOpShrink                      = "shrink"
	CliOpGetDiscard                  = "get-discard"
	CliOpSetDiscard                  = "set-discard"
	CliOpForbidMpDecommission        = "forbid-mp-decommission"
	CliOpQueryDecommission           = "query-decommission"
	CliOpEnableAutoDecommission      = "enable-auto-decommission"
	CliOpQueryDecommissionFailedDisk = "query-decommission-failed-disk"
	CliOpSetDecommissionDiskLimit    = "set-decommission-disk-limit"
	CliOpResetRestoreStatus          = "reset-restore-status"
	CliOpCancelDecommission          = "cancel-decommission"

	CliOpSetDecommissionLimit    = "set-decommission-limit"
	CliOpQueryDecommissionStatus = "query-decommission-status"

	// 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"
	CliFlagBusiness                     = "description"
	CliFlagMPCount                      = "mp-count"
	CliFlagDPCount                      = "dp-count"
	CliFlagReplicaNum                   = "replica-num"
	CliFlagSize                         = "size"
	CliFlagVolType                      = "vol-type"
	CliFlagFollowerRead                 = "follower-read"
	CliFlagCacheRuleKey                 = "cache-rule-key"
	CliFlagEbsBlkSize                   = "ebs-blk-size"
	CliFlagCacheCapacity                = "cache-capacity"
	CliFlagCacheAction                  = "cache-action"
	CliFlagCacheThreshold               = "cache-threshold"
	CliFlagCacheTTL                     = "cache-ttl"
	CliFlagCacheHighWater               = "cache-high-water"
	CliFlagCacheLowWater                = "cache-low-water"
	CliFlagCacheLRUInterval             = "cache-lru-interval"
	CliFlagCacheRule                    = "cache-rule"
	CliFlagThreshold                    = "threshold"
	CliFlagAddress                      = "addr"
	CliFlagDiskPath                     = "path"
	CliFlagAuthKey                      = "authkey"
	CliFlagINodeStartID                 = "inode-start"
	CliFlagId                           = "id"
	CliFlagZoneName                     = "zone-name"
	CliFlagDescription                  = "description"
	CliFlagAutoRepairRate               = "autoRepairRate"
	CliFlagDelBatchCount                = "batchCount"
	CliFlagDelWorkerSleepMs             = "deleteWorkerSleepMs"
	CliFlagLoadFactor                   = "loadFactor"
	CliFlagMarkDelRate                  = "markDeleteRate"
	CliFlagMaxDpCntLimit                = "maxDpCntLimit"
	CliFlagMaxMpCntLimit                = "maxMpCntLimit"
	CliFlagDataNodeSelector             = "dataNodeSelector"
	CliFlagMetaNodeSelector             = "metaNodeSelector"
	CliFlagDataNodesetSelector          = "dataNodesetSelector"
	CliFlagMetaNodesetSelector          = "metaNodesetSelector"
	CliFlagCrossZone                    = "crossZone"
	CliNormalZonesFirst                 = "normalZonesFirst"
	CliFlagCount                        = "count"
	CliDpReadOnlyWhenVolFull            = "readonly-when-full"
	CliTxMask                           = "transaction-mask"
	CliTxTimeout                        = "transaction-timeout"
	CliTxOpLimit                        = "transaction-limit"
	CliTxConflictRetryNum               = "tx-conflict-retry-num"
	CliTxConflictRetryInterval          = "tx-conflict-retry-Interval"
	CliTxForceReset                     = "transaction-force-reset"
	CliFlagMaxFiles                     = "maxFiles"
	CliFlagMaxBytes                     = "maxBytes"
	CliFlagMaxConcurrencyInode          = "maxConcurrencyInode"
	CliFlagForceInode                   = "forceInode"
	CliFlagEnableQuota                  = "enableQuota"
	CliFlagDeleteLockTime               = "delete-lock-time"
	CliFlagClientIDKey                  = "clientIDKey"
	CliFlagMarkDiskBrokenThreshold      = "markBrokenDiskThreshold"
	CliFlagForce                        = "force"
	CliFlagEnableCrossZone              = "cross-zone"
	CliFlagAutoDpMetaRepair             = "autoDpMetaRepair"
	CliFlagAutoDpMetaRepairParallelCnt  = "autoDpMetaRepairParallelCnt"
	CliFlagDpRepairTimeout              = "dpRepairTimeout"
	CliFlagDpTimeout                    = "dpHeartbeatTimeout"
	CliFlagAutoDecommissionDisk         = "autoDecommissionDisk"
	CliFlagAutoDecommissionDiskInterval = "autoDecommissionDiskInterval"
	CliFlagDpBackupTimeout              = "dpBackupTimeout"
	CliFlagDecommissionDpLimit          = "decommissionDpLimit"
	CliFlagDecommissionDiskLimit        = "decommissionDiskLimit"
	CliFlagTrashInterval                = "trashInterval"
	CliFlagAccessTimeValidInterval      = "accessTimeValidInterval"
	CliFlagEnablePersistAccessTime      = "enablePersistAccessTime"
	CliFlagDecommissionRaftForce        = "raftForceDel"

	// Shorthand format of resource name
	ResourceDataNodeShortHand      = "dn"
	ResourceMetaNodeShortHand      = "mn"
	ResourceDataPartitionShortHand = "dp"
	ResourceMetaPartitionShortHand = "mp"

	// Usages
	CliUsageClientIDKey = "needed if cluster authentication is on"
	// version op
	CliFlagVersionCreate      = "verCreate"
	CliFlagVersionList        = "verList"
	CliFlagVersionDel         = "verDel"
	CliFlagVersionSetStrategy = "verSetStrategy"
)
View Source
const (
	RoleMaster           = "master"
	RoleClient           = "client"
	KeyRole              = "role"
	KeyVersion           = "version"
	KeyMasterListenPort  = "listen"
	KeyMasterAddr        = "masterAddr"
	KeyMasterClusterName = "clusterName"
	KeyMasterPeers       = "peers"
)
View Source
const (

	// uid op
	CliUidAdd = "add"

	CliUidDel   = "del"
	CliUidCheck = "check"
)

Variables

View Source
var (
	RepFileCountDifferInfoTableHeader = fmt.Sprintf(repFileCountDifferPartitionInfoTablePattern,
		"DP_ID", "VOLUME", "REPLICAS", "DP_STATUS", "MEMBERS(fileCount)")

	RepUsedSizeDifferInfoTableHeader = fmt.Sprintf(repUsedSizeDifferPartitionInfoTablePattern,
		"DP_ID", "VOLUME", "REPLICAS", "DP_STATUS", "MEMBERS(usedSize)")
)
View Source
var GenClusterCfgCmd = &cobra.Command{
	Use:   "gencfg",
	Short: "generate cfs cluster config",
	Long:  `Generate cubefs cluster json config files by yaml config`,
	Run:   genCfgCmd,
}

Functions

func NewVolumeClient

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

Types

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"`
	ClientIDKey string   `json:"clientIDKey"`
}

func LoadConfig

func LoadConfig() (*Config, error)

type CubeFSCmd

type CubeFSCmd struct {
	CFSCmd *cobra.Command
}

func NewRootCmd

func NewRootCmd(client *master.MasterClient) *CubeFSCmd

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