cobrautil

package
v0.0.0-...-6983430 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DINGOFS_MOUNTPOINT_FSTYPE  = "fuse.dingofs"
	DINGOFS_MOUNTPOINT_FSTYPE2 = "fuse" //for backward compatibility
)
View Source
const (
	ROW_ADDR            = "addr"
	ROW_ALLOC           = "alloc"
	ROW_ALLOC_SIZE      = "allocatedSize"
	ROW_BLOCKSIZE       = "blocksize"
	ROW_CAPACITY        = "capacity"
	ROW_CHILD_LIST      = "childList"
	ROW_CHILD_TYPE      = "childType"
	ROW_CHUNK           = "chunk"
	ROW_CHUNK_SIZE      = "chunkSize"
	ROW_COPYSET         = "copyset"
	ROW_COPYSET_ID      = "copysetId"
	ROW_COPYSET_KEY     = "copysetKey"
	ROW_CREATE_TIME     = "create time"
	ROW_CREATED         = "created"
	ROW_LASTONLINETIME  = "last online time"
	ROW_DUMMY_ADDR      = "dummyAddr"
	ROW_END             = "end"
	ROW_EPOCH           = "epoch"
	ROW_EXPLAIN         = "explain"
	ROW_EXTERNAL_ADDR   = "externalAddr"
	ROW_FILE_NAME       = "fileName"
	ROW_FILE_SIZE       = "fileSize"
	ROW_FILE_TYPE       = "fileType"
	ROW_FS_ID           = "fsId"
	ROW_FS_NAME         = "fsName"
	ROW_FS_CLIENTID     = "clientId"
	ROW_FS_CTO          = "cto"
	ROW_STORAGE_TYPE    = "storageType"
	ROW_STORAGE         = "storage"
	ROW_PARTITION_TYPE  = "partitionType"
	ROW_GROUP           = "group"
	ROW_HOSTNAME        = "hostname"
	ROW_ID              = "id"
	ROW_INODE_ID        = "inodeId"
	ROW_INTERNAL_ADDR   = "internalAddr"
	ROW_IP              = "ip"
	ROW_PORT            = "port"
	ROW_MEMBERID        = "memberid"
	ROW_WEIGHT          = "weight"
	ROW_KEY             = "key"
	ROW_LOCKED          = "locked"
	ROW_OLDLEADER       = "oldLeader"
	ROW_LEADER_PEER     = "leaderPeer"
	ROW_FOLLOWER_PEER   = "followerPeer"
	ROW_LEFT            = "left"
	ROW_LENGTH          = "length"
	ROW_LOCATION        = "location"
	ROW_LOG_GAP         = "logGap"
	ROW_LOGICALPOOL     = "logicalpool"
	ROW_METASERVERID    = "metaserverId"
	ROW_METASERVER      = "metaserver"
	ROW_METASERVER_ADDR = "metaserverAddr"
	ROW_MOUNT_NUM       = "mountNum"
	ROW_MOUNTPOINT      = "mountpoint"
	ROW_UUID            = "uuid"
	ROW_NAME            = "name"
	ROW_NLINK           = "nlink"
	ROW_NUM             = "num"
	ROW_ONLINE_STATE    = "onlineState"
	ROW_OPERATION       = "operation"
	ROW_OPNAME          = "opname"
	ROW_ORIGINAL_PATH   = "originalPath"
	ROW_OWNER           = "owner"
	ROW_PARENT          = "parent"
	ROW_PARENT_ID       = "parentId"
	ROW_PARTITION_ID    = "partitionId"
	ROW_PEER            = "peer"
	ROW_PEER_ADDR       = "peerAddr"
	ROW_PEER_ID         = "peerId"
	ROW_PEER_NUMBER     = "peerNumber"
	ROW_PHYPOOL         = "phyPool"
	ROW_POOL            = "pool"
	ROW_POOL_ID         = "poolId"
	ROW_READONLY        = "readonly"
	ROW_REASON          = "reason"
	ROW_RECOVERING      = "recovering"
	ROW_RECYCLABLE      = "recyclable"
	ROW_RECYCLE         = "recycle"
	ROW_RESULT          = "result"
	ROW_SCAN            = "scan"
	ROW_SEGMENT         = "segment"
	ROW_SEGMENT_SIZE    = "segmentSize"
	ROW_SEQ             = "seq"
	ROW_SERVERID        = "serverid"
	ROW_SERVER          = "server"
	ROW_SIZE            = "size"
	ROW_START           = "start"
	ROW_STATE           = "state"
	ROW_STATUS          = "status"
	ROW_STRIPE          = "stripe"
	ROW_TERM            = "term"
	ROW_THROTTLE        = "throttle"
	ROW_TOTAL           = "total"
	ROW_TYPE            = "type"
	ROW_USED            = "used"
	ROW_VERSION         = "version"
	ROW_ZONE            = "zone"

	// s3
	ROW_S3CHUNKINFO_CHUNKID = "s3ChunkId"
	ROW_S3CHUNKINFO_LENGTH  = "s3Length"
	ROW_S3CHUNKINFO_OFFSET  = "s3Offset"
	ROW_S3CHUNKINFO_SIZE    = "s3Size"

	// vale
	ROW_VALUE_ADD            = "add"
	ROW_VALUE_DEL            = "del"
	ROW_VALUE_DNE            = "DNE"
	ROW_VALUE_FAILED         = "failed"
	ROW_VALUE_LOGICAL        = "logical"
	ROW_VALUE_NO_RECOVERING  = ""
	ROW_VALUE_NO_VALUE       = "-"
	ROW_VALUE_NULL           = "null"
	ROW_VALUE_OFFLINE        = "offline"
	ROW_VALUE_ONLINE         = "online"
	ROW_VALUE_PHYSICAL       = "physical"
	ROW_VALUE_RECOVERING_OUT = "recovering from out"
	ROW_VALUE_SUCCESS        = "success"
	ROW_VALUE_UNKNOWN        = "unknown"

	// quota
	ROW_PATH              = "path"
	ROW_USED_PERCNET      = "use%"
	ROW_REAL_USED         = "realused"
	ROW_INODES            = "inodes"
	ROW_INODES_IUSED      = "iused"
	ROW_INODES_PERCENT    = "iuse%"
	ROW_INODES_REAL_IUSED = "realiused"

	//fuse
	ROW_FUSE_CONNECTION = "CONNECTION"
	ROW_FUSE_WAITING    = "WAITING"

	//mds
	ROW_MDS_NUM = "mdsnum"

	// delete subdir
	ROW_DELETE_INODES = "delete inodes"
)
View Source
const (
	TYPE_POOL       = "pool"
	TYPE_SERVER     = "server"
	TYPE_METASERVER = "metaserver"
	TYPE_ZONE       = "zone"
	TYPE_PHYPOOL    = "physicalpool"
	TYPE_LGPOOL     = "logicalpool"
)

topology type

View Source
const (
	PATH_REGEX    = `^(/[^/ ]*)+/?$`
	FS_NAME_REGEX = "^([a-z0-9]+\\-?)+$"
	K_STRING_TRUE = "true"

	ROOT_PATH       = "/"
	RECYCLEBIN_PATH = "/RecycleBin"
)

Variables

This section is empty.

Functions

func Addr2IpPort

func Addr2IpPort(addr string) (string, uint32, *cmderror.CmdError)

func AskConfirmation

func AskConfirmation(promptStr string, confirm string) bool

func CalcString2Signature

func CalcString2Signature(in string, secretKet string) string

func DisableLogColor

func DisableLogColor()

func GetDingoFSMountPoints

func GetDingoFSMountPoints() ([]*mountinfo.MountInfo, *cmderror.CmdError)

func GetFileInode

func GetFileInode(path string) (uint64, error)

get mountPoint inode

func GetIndexSlice

func GetIndexSlice(source []string, target []string) []int

func GetInodesAsString

func GetInodesAsString(listFilePath string) (string, error)

func GetLogger

func GetLogger(name string) *logHandle

GetLogger returns a logger mapped to `name`

func GetString2Signature

func GetString2Signature(date uint64, owner string) string

func GetTimeofDayUs

func GetTimeofDayUs() (uint64, *cmderror.CmdError)

func IsAligned

func IsAligned(value uint64, alignment uint64) bool

func IsAlpha

func IsAlpha(r rune) bool

func IsDigit

func IsDigit(r rune) bool

func IsHTTPS

func IsHTTPS(endpoint string) bool

func IsSSL

func IsSSL(host string, timeout time.Duration) bool

func IsUpper

func IsUpper(r rune) bool

func IsValidFsname

func IsValidFsname(fsName string) bool

func IsValidPath

func IsValidPath(path string) bool

func ListMap2ListSortByKeys

func ListMap2ListSortByKeys(rows []map[string]string, headers []string, keys []string) [][]string

func Map2List

func Map2List(row map[string]string, headers []string) []string

func Path2DingofsPath

func Path2DingofsPath(path string, mountpoint *mountinfo.MountInfo) string

make sure path' abs path start with mountpoint.MountPoint

func RemoveDuplicates

func RemoveDuplicates(strs []string) []string

func RemoveHTTPPrefix

func RemoveHTTPPrefix(endpoint string) string

func RmWitespaceStr

func RmWitespaceStr(str string) string

rm whitespace

func SetLogID

func SetLogID(id string)

func SetLogLevel

func SetLogLevel(lvl logrus.Level)

SetLogLevel sets Level to all the loggers in the map

func SetOutFile

func SetOutFile(name string)

func SetOutput

func SetOutput(w io.Writer)

func SplitMountpoint

func SplitMountpoint(mountpoint string) ([]string, *cmderror.CmdError)

func StringList2Uint32List

func StringList2Uint32List(strList []string) ([]uint32, error)

func StringList2Uint64List

func StringList2Uint64List(strList []string) ([]uint64, error)

func SupportANSIColor

func SupportANSIColor(fd uintptr) bool

func ToUnderscoredName

func ToUnderscoredName(src string) string

func TranslateCacheGroupMemberState

func TranslateCacheGroupMemberState(state mds.CacheGroupMemberState) string

Types

type RadosChecker

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

func (*RadosChecker) AllHostsUnavailable

func (r *RadosChecker) AllHostsUnavailable() (bool, error)

func (*RadosChecker) Check

func (r *RadosChecker) Check(ctx context.Context) (bool, error)

func (*RadosChecker) Close

func (r *RadosChecker) Close() error

func (*RadosChecker) HostIsConnected

func (r *RadosChecker) HostIsConnected(host string, timeout time.Duration) bool

func (*RadosChecker) Name

func (r *RadosChecker) Name() string

type S3Checker

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

func (*S3Checker) Check

func (s *S3Checker) Check(ctx context.Context) (bool, error)

func (*S3Checker) Name

func (s *S3Checker) Name() string

type StorageChecker

type StorageChecker interface {
	Check(ctx context.Context) (bool, error)
	Name() string
}

func NewRadosChecker

func NewRadosChecker(monHost, user, key, poolName, cluster string, timeout time.Duration) (StorageChecker, error)

func NewS3Checker

func NewS3Checker(endpoint, accessKey, secretKey, bucket string, timeout time.Duration) (StorageChecker, error)

Directories

Path Synopsis
* Project: DingoCli * Created Date: 2022-05-09 * Author: chengyi (Cyber-SiKu)
* Project: DingoCli * Created Date: 2022-05-09 * Author: chengyi (Cyber-SiKu)

Jump to

Keyboard shortcuts

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