master

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: 58 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// the maximum number of tasks that can be handled each time
	MaxTaskNum = 30

	TaskWorkerInterval = time.Second * time.Duration(2)
)

const

View Source
const (
	TypeMetaPartition uint32 = 0x01
	TypeDataPartition uint32 = 0x02
)
View Source
const (
	QosEnableKey     = "qosEnable"
	DiskEnableKey    = "diskenable"
	IopsWKey         = "iopsWKey"
	IopsRKey         = "iopsRKey"
	FlowWKey         = "flowWKey"
	FlowRKey         = "flowRKey"
	ClientReqPeriod  = "reqPeriod"
	ClientTriggerCnt = "triggerCnt"
	QosMasterLimit   = "qosLimit"

	DiskDisableKey = "diskDisable"
	Limit          = "limit"
	TimeOut        = "timeout"
	CountByMeta    = "countByMeta"

	PeriodicKey = "periodic"
	IPKey       = "ip"
	OperateKey  = "op"
	UIDKey      = "uid"
	CapacityKey = "capacity"

	MaxFilesKey = "maxFiles"
	MaxBytesKey = "maxBytes"

	TrashIntervalKey = "trashInterval"
	ClientIDKey      = "clientIDKey"

	Periodic         = "periodic"
	DecommissionType = "decommissionType"

	ShowAll = "showAll"
)

Keys in the request

View Source
const (
	MetricRoleMaster     = "master"
	MetricRoleMetaNode   = "metaNode"
	MetricRoleDataNode   = "dataNode"
	MetricRoleObjectNode = "objectNode"
)
View Source
const (
	LRUCacheSize       = 3 << 30
	WriteBufferSize    = 4 * util.MB
	MaxFlowLimit       = 10 * util.TB
	MinFlowLimit       = 100 * util.MB
	MinIoLimit         = 100
	MinMagnify         = 10
	MaxMagnify         = 100
	QosMasterAcceptCnt = 3000
	MinZoneDiskLimit   = 300
	MaxZoneDiskLimit   = 10000
)
View Source
const (
	EmptyCrcValue   uint32 = 4045511210
	DefaultZoneName        = proto.DefaultZoneName
)
View Source
const (
	DecommissionDiskAcronym = "dd"
	DecommissionDiskPrefix  = keySeparator + DecommissionDiskAcronym + keySeparator
)
View Source
const (
	S3QoS = "s3qos"

	DomainPrefix = keySeparator + domainAcronym + keySeparator

	MultiVerPrefix = keySeparator + "multiVer" + keySeparator
	AclPrefix      = keySeparator + "acl" + keySeparator
	UidPrefix      = keySeparator + "uid" + keySeparator

	S3QoSPrefix = keySeparator + S3QoS + keySeparator
)
View Source
const (
	DataNodeType = NodeType(0)
	MetaNodeType = NodeType(iota)
)
View Source
const (
	DecommissionInitial uint32 = iota

	DecommissionPause // can only stop markDecommission
	DecommissionPrepare
	DecommissionRunning
	DecommissionSuccess
	DecommissionFail
	DecommissionCancel
)
View Source
const (
	RestoreReplicaMetaStop uint32 = iota
	RestoreReplicaMetaRunning
	RestoreReplicaMetaForbidden
)
View Source
const (
	SpecialDecommissionInitial uint32 = iota
	SpecialDecommissionEnter
	SpecialDecommissionWaitAddRes
	SpecialDecommissionWaitAddResFin
	SpecialDecommissionRemoveOld
)
View Source
const (
	InitialDecommission = proto.InitialDecommission
	ManualDecommission  = proto.ManualDecommission
	AutoDecommission    = proto.AutoDecommission
	QueryDecommission   = proto.QueryDecommission
	AutoAddReplica      = proto.AutoAddReplica
	ManualAddReplica    = proto.ManualAddReplica
)
View Source
const (
	ADMIN permissionMode = permissionMode(1)
	USER  permissionMode = permissionMode(2)
)
View Source
const (
	StatPeriod                 = time.Minute * time.Duration(1)
	MetricDataNodesUsedGB      = "dataNodes_used_GB"
	MetricDataNodesTotalGB     = "dataNodes_total_GB"
	MetricDataNodesIncreasedGB = "dataNodes_increased_GB"
	MetricMetaNodesUsedGB      = "metaNodes_used_GB"
	MetricMetaNodesTotalGB     = "metaNodes_total_GB"
	MetricMetaNodesIncreasedGB = "metaNodes_increased_GB"
	MetricDataNodesCount       = "dataNodes_count"
	MetricMetaNodesCount       = "metaNodes_count"
	MetricNodeStat             = "node_stat"
	MetricVolCount             = "vol_count"
	MetricVolTotalGB           = "vol_total_GB"
	MetricVolUsedGB            = "vol_used_GB"
	MetricVolUsageGB           = "vol_usage_ratio"
	MetricVolMetaCount         = "vol_meta_count"
	MetricBadMpCount           = "bad_mp_count"
	MetricBadDpCount           = "bad_dp_count"
	MetricDiskError            = "disk_error"
	MetricDataNodesInactive    = "dataNodes_inactive"
	MetricInactiveDataNodeInfo = "inactive_dataNodes_info"
	MetricMetaNodesInactive    = "metaNodes_inactive"
	MetricDataNodesNotWritable = "dataNodes_not_writable"
	MetricDataNodesAllocable   = "dataNodes_allocable"
	MetricMetaNodesNotWritable = "metaNodes_not_writable"
	MetricInactiveMataNodeInfo = "inactive_mataNodes_info"
	MetricMetaInconsistent     = "mp_inconsistent"
	MetricMasterNoLeader       = "master_no_leader"
	MetricMasterNoCache        = "master_no_cache"
	MetricMasterSnapshot       = "master_snapshot"

	MetricMissingDp                = "missing_dp"
	MetricDpNoLeader               = "dp_no_leader"
	MetricMissingMp                = "missing_mp"
	MetricMpNoLeader               = "mp_no_leader"
	MetricReplicaMissingDPCount    = "replica_missing_dp_count"
	MetricDpMissingLeaderCount     = "dp_missing_Leader_count"
	MetricMpMissingLeaderCount     = "mp_missing_Leader_count"
	MetricMpMissingReplicaCount    = "mp_missing_Replica_count"
	MetricDataNodesetInactiveCount = "data_nodeset_inactive_count"
	MetricMetaNodesetInactiveCount = "meta_nodeset_inactive_count"

	MetricNodesetMetaTotalGB    = "nodeset_meta_total_GB"
	MetricNodesetMetaUsedGB     = "nodeset_meta_used_GB"
	MetricNodesetMetaUsageRadio = "nodeset_meta_usage_ratio"
	MetricNodesetDataTotalGB    = "nodeset_data_total_GB"
	MetricNodesetDataUsedGB     = "nodeset_data_used_GB"
	MetricNodesetDataUsageRadio = "nodeset_data_usage_ratio"
	MetricNodesetMpReplicaCount = "nodeset_mp_replica_count"
	MetricNodesetDpReplicaCount = "nodeset_dp_replica_count"

	MetricLcNodesConcurrentCount     = "lcNodes_concurrent"
	Metrics3LcTotalScanned           = "s3Lc_Total_Scanned"
	Metrics3LcTotalFileScanned       = "s3Lc_Total_File_Scanned"
	Metrics3LcTotalDirScanned        = "s3Lc_Total_DirS_canned"
	Metrics3LcTotalExpired           = "s3Lc_Total_Expired"
	Metrics3LcAbortedMultipartUpload = "s3Lc_Aborted_Multipart_Upload"
	MetricLcNodesCount               = "lc_nodes_count"
	MetricLcTotalScanned             = "lc_total_scanned"
	MetricLcTotalFileScanned         = "lc_total_file_scanned"
	MetricLcTotalDirScanned          = "lc_total_dirs_scanned"
	MetricLcTotalExpired             = "lc_total_expired"
)

metrics

View Source
const (
	TypeNoReply      = 0
	TypeReply        = 1
	MaxSnapshotCount = 30
)
View Source
const (
	ClusterName          = "clusterName"
	ID                   = "id"
	IP                   = "ip"
	Port                 = "port"
	LogLevel             = "logLevel"
	LogDir               = "logDir"
	WalDir               = "walDir"
	StoreDir             = "storeDir"
	EbsAddrKey           = "ebsAddr"
	BStoreAddrKey        = "bStoreAddr"
	EbsServicePathKey    = "ebsServicePath"
	BStoreServicePathKey = "bStoreServicePath"
	GroupID              = 1
	ModuleName           = "master"
	CfgRetainLogs        = "retainLogs"
	DefaultRetainLogs    = 20000

	SecretKey = "masterServiceKey"

	Stat                = "stat"
	Authenticate        = "authenticate"
	AuthNodeHost        = "authNodeHost"
	AuthNodeEnableHTTPS = "authNodeEnableHTTPS"
	AuthNodeCertFile    = "authNodeCertFile"
)

configuration keys

View Source
const (
	RootUserID          = "root"
	DefaultRootPasswd   = "CubeFSRoot"
	DefaultUserPassword = "CubeFSUser"
)
View Source
const AvailableSpaceFirstNodeSelectorName = "AvailableSpaceFirst"
View Source
const AvailableSpaceFirstNodesetSelectorName = "AvailableSpaceFirst"
View Source
const CarryWeightNodeSelectorName = "CarryWeight"
View Source
const CarryWeightNodesetSelectorName = "CarryWeight"
View Source
const DecommissionInterval = 5 * time.Second
View Source
const DefaultNodeSelectorName = CarryWeightNodeSelectorName
View Source
const DefaultNodesetSelectorName = RoundRobinNodeSelectorName
View Source
const InvalidDecommissionDpCnt = -1
View Source
const (
	NumberOfDataPartitionsToLoad = "numberOfDataPartitionsToLoad"
)

config key

View Source
const RoundRobinNodeSelectorName = "RoundRobin"
View Source
const RoundRobinNodesetSelectorName = "RoundRobin"
View Source
const StrawNodeSelectorName = "Straw"
View Source
const (
	StrawNodeSelectorRandMax = 65536
)
View Source
const StrawNodesetSelectorName = "Straw"
View Source
const (
	StrawNodesetSelectorRandMax = 65536
)

Variables

View Source
var AddrDatabase = make(map[uint64]string)

AddrDatabase is a map that stores the address of a given host (e.g., the leader)

View Source
var AuthenticationUri2MsgTypeMap = map[string]proto.MsgType{

	proto.AdminClusterFreeze: proto.MsgMasterClusterFreezeReq,
	proto.AddRaftNode:        proto.MsgMasterAddRaftNodeReq,
	proto.RemoveRaftNode:     proto.MsgMasterRemoveRaftNodeReq,
	proto.AdminSetNodeInfo:   proto.MsgMasterSetNodeInfoReq,
	proto.AdminSetNodeRdOnly: proto.MsgMasterSetNodeRdOnlyReq,

	proto.AdminCreateVol: proto.MsgMasterCreateVolReq,
	proto.AdminDeleteVol: proto.MsgMasterDeleteVolReq,
	proto.AdminUpdateVol: proto.MsgMasterUpdateVolReq,
	proto.AdminVolShrink: proto.MsgMasterVolShrinkReq,
	proto.AdminVolExpand: proto.MsgMasterVolExpandReq,

	proto.AdminLoadMetaPartition:         proto.MsgMasterLoadMetaPartitionReq,
	proto.AdminDecommissionMetaPartition: proto.MsgMasterDecommissionMetaPartitionReq,
	proto.AdminChangeMetaPartitionLeader: proto.MsgMasterChangeMetaPartitionLeaderReq,
	proto.AdminCreateMetaPartition:       proto.MsgMasterCreateMetaPartitionReq,
	proto.AdminAddMetaReplica:            proto.MsgMasterAddMetaReplicaReq,
	proto.AdminDeleteMetaReplica:         proto.MsgMasterDeleteMetaReplicaReq,
	proto.QosUpdate:                      proto.MsgMasterQosUpdateReq,
	proto.QosUpdateZoneLimit:             proto.MsgMasterQosUpdateZoneLimitReq,
	proto.QosUpdateMasterLimit:           proto.MsgMasterQosUpdateMasterLimitReq,
	proto.QosUpdateClientParam:           proto.MsgMasterQosUpdateClientParamReq,

	proto.AdminCreateDataPartition:       proto.MsgMasterCreateDataPartitionReq,
	proto.AdminDataPartitionChangeLeader: proto.MsgMasterDataPartitionChangeLeaderReq,
	proto.AdminLoadDataPartition:         proto.MsgMasterLoadDataPartitionReq,
	proto.AdminDecommissionDataPartition: proto.MsgMasterDecommissionDataPartitionReq,
	proto.AdminAddDataReplica:            proto.MsgMasterAddDataReplicaReq,
	proto.AdminDeleteDataReplica:         proto.MsgMasterDeleteDataReplicaReq,
	proto.AdminSetDpRdOnly:               proto.MsgMasterSetDpRdOnlyReq,

	proto.AddMetaNode:               proto.MsgMasterAddMetaNodeReq,
	proto.DecommissionMetaNode:      proto.MsgMasterDecommissionMetaNodeReq,
	proto.MigrateMetaNode:           proto.MsgMasterMigrateMetaNodeReq,
	proto.AdminSetMetaNodeThreshold: proto.MsgMasterSetMetaNodeThresholdReq,
	proto.AdminUpdateMetaNode:       proto.MsgMasterUpdateMetaNodeReq,

	proto.AddDataNode:                   proto.MsgMasterAddDataNodeReq,
	proto.DecommissionDataNode:          proto.MsgMasterDecommissionDataNodeReq,
	proto.MigrateDataNode:               proto.MsgMasterMigrateDataNodeReq,
	proto.PauseDecommissionDataNode:     proto.MsgMasterCancelDecommissionDataNodeReq,
	proto.DecommissionDisk:              proto.MsgMasterDecommissionDiskReq,
	proto.AdminUpdateNodeSetCapcity:     proto.MsgMasterUpdateNodeSetCapcityReq,
	proto.AdminUpdateNodeSetId:          proto.MsgMasterUpdateNodeSetIdReq,
	proto.AdminUpdateDomainDataUseRatio: proto.MsgMasterUpdateDomainDataUseRatioReq,
	proto.AdminUpdateZoneExcludeRatio:   proto.MsgMasterUpdateZoneExcludeRatioReq,
	proto.RecommissionDisk:              proto.MsgMasterRecommissionDiskReq,

	proto.UserCreate:          proto.MsgMasterUserCreateReq,
	proto.UserDelete:          proto.MsgMasterUserDeleteReq,
	proto.UserUpdate:          proto.MsgMasterUserUpdateReq,
	proto.UserUpdatePolicy:    proto.MsgMasterUserUpdatePolicyReq,
	proto.UserRemovePolicy:    proto.MsgMasterUserRemovePolicyReq,
	proto.UserDeleteVolPolicy: proto.MsgMasterUserDeleteVolPolicyReq,
	proto.UserTransferVol:     proto.MsgMasterUserTransferVolReq,

	proto.UpdateZone: proto.MsgMasterUpdateZoneReq,
}

AuthenticationUri2MsgTypeMap define the mapping from authentication uri to message type

View Source
var WarnMetrics *warningMetrics

Functions

func ErrResponse added in v1.34.0

func ErrResponse(w http.ResponseWriter, err error)

func FormatFloatFloor added in v1.34.0

func FormatFloatFloor(num float64, decimal int) (float64, error)

func GetDecommissionStatusMessage added in v1.34.0

func GetDecommissionStatusMessage(status uint32) string

func GetDecommissionTypeMessage added in v1.34.0

func GetDecommissionTypeMessage(status uint32) string

func GetRestoreReplicaMessage added in v1.34.0

func GetRestoreReplicaMessage(status uint32) string

func GetSpecialDecommissionStatusMessage added in v1.34.0

func GetSpecialDecommissionStatusMessage(status uint32) string

func Warn

func Warn(clusterID, msg string)

Warn provides warnings when exits

func WarnBySpecialKey

func WarnBySpecialKey(key, msg string)

WarnBySpecialKey provides warnings when exits

Types

type AclFsm added in v1.34.0

type AclFsm struct {
	AclIpArr []*proto.AclIpInfo
}

type AclManager added in v1.34.0

type AclManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

type AdminTaskManager

type AdminTaskManager struct {
	TaskMap map[string]*proto.AdminTask
	sync.RWMutex
	// contains filtered or unexported fields
}

AdminTaskManager sends administration commands to the metaNode or dataNode.

func (*AdminTaskManager) AddTask

func (sender *AdminTaskManager) AddTask(t *proto.AdminTask)

AddTask adds a new task to the task map.

func (*AdminTaskManager) DelTask

func (sender *AdminTaskManager) DelTask(t *proto.AdminTask)

DelTask deletes the to-be-deleted tasks.

type ApiLimitInfo added in v1.34.0

type ApiLimitInfo struct {
	ApiName        string        `json:"api_name"`
	QueryPath      string        `json:"query_path"`
	Limit          uint32        `json:"limit"` // qps
	LimiterTimeout uint32        `json:"limiter_timeout"`
	Limiter        *rate.Limiter `json:"-"`
}

func (*ApiLimitInfo) InitLimiter added in v1.34.0

func (li *ApiLimitInfo) InitLimiter()

type ApiLimiter added in v1.34.0

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

func (*ApiLimiter) Clear added in v1.34.0

func (l *ApiLimiter) Clear()

func (*ApiLimiter) IsApiNameValid added in v1.34.0

func (l *ApiLimiter) IsApiNameValid(name string) (err error, normalizedName, qPath string)

func (*ApiLimiter) IsFollowerLimiter added in v1.34.0

func (l *ApiLimiter) IsFollowerLimiter(qPath string) bool

func (*ApiLimiter) Replace added in v1.34.0

func (l *ApiLimiter) Replace(limiterInfos map[string]*ApiLimitInfo)

func (*ApiLimiter) RmLimiter added in v1.34.0

func (l *ApiLimiter) RmLimiter(apiName string) (err error)

func (*ApiLimiter) SetLimiter added in v1.34.0

func (l *ApiLimiter) SetLimiter(apiName string, Limit uint32, LimiterTimeout uint32) (err error)

func (*ApiLimiter) Wait added in v1.34.0

func (l *ApiLimiter) Wait(qPath string) (err error)

type AuthenticSubItem added in v1.34.0

type AuthenticSubItem struct {
	OSSAccessKey string
	OSSSecretKey string
	// contains filtered or unexported fields
}

type AuthorizedVols added in v1.34.0

type AuthorizedVols struct {
	Vol        string
	Authorized []string
}

type AvailableSpaceFirstNodeSelector added in v1.34.0

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

func NewAvailableSpaceFirstNodeSelector added in v1.34.0

func NewAvailableSpaceFirstNodeSelector(nodeType NodeType) *AvailableSpaceFirstNodeSelector

func (*AvailableSpaceFirstNodeSelector) GetName added in v1.34.0

func (*AvailableSpaceFirstNodeSelector) Select added in v1.34.0

func (s *AvailableSpaceFirstNodeSelector) Select(ns *nodeSet, excludeHosts []string, replicaNum int) (newHosts []string, peers []proto.Peer, err error)

type AvailableSpaceFirstNodesetSelector added in v1.34.0

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

func NewAvailableSpaceFirstNodesetSelector added in v1.34.0

func NewAvailableSpaceFirstNodesetSelector(nodeType NodeType) *AvailableSpaceFirstNodesetSelector

func (*AvailableSpaceFirstNodesetSelector) GetName added in v1.34.0

func (*AvailableSpaceFirstNodesetSelector) Select added in v1.34.0

func (s *AvailableSpaceFirstNodesetSelector) Select(nsc nodeSetCollection, excludeNodeSets []uint64, replicaNum uint8) (ns *nodeSet, err error)

type CacheSubItem added in v1.34.0

type CacheSubItem struct {
	EbsBlkSize       int
	CacheCapacity    uint64
	CacheAction      int
	CacheThreshold   int
	CacheTTL         int
	CacheHighWater   int
	CacheLowWater    int
	CacheLRUInterval int
	CacheRule        string
	PreloadCacheOn   bool
	// contains filtered or unexported fields
}

type CarryWeightNodeSelector added in v1.34.0

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

func NewCarryWeightNodeSelector added in v1.34.0

func NewCarryWeightNodeSelector(nodeType NodeType) *CarryWeightNodeSelector

func (*CarryWeightNodeSelector) GetName added in v1.34.0

func (s *CarryWeightNodeSelector) GetName() string

func (*CarryWeightNodeSelector) Select added in v1.34.0

func (s *CarryWeightNodeSelector) Select(ns *nodeSet, excludeHosts []string, replicaNum int) (newHosts []string, peers []proto.Peer, err error)

type CarryWeightNodesetSelector added in v1.34.0

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

func NewCarryWeightNodesetSelector added in v1.34.0

func NewCarryWeightNodesetSelector(nodeType NodeType) *CarryWeightNodesetSelector

func (*CarryWeightNodesetSelector) GetName added in v1.34.0

func (s *CarryWeightNodesetSelector) GetName() string

func (*CarryWeightNodesetSelector) Select added in v1.34.0

func (s *CarryWeightNodesetSelector) Select(nsc nodeSetCollection, excludeNodeSets []uint64, replicaNum uint8) (ns *nodeSet, err error)

type ClientInfoMgr added in v1.34.0

type ClientInfoMgr struct {
	Cli    *proto.ClientReportLimitInfo
	Assign *proto.LimitRsp2Client
	Time   time.Time
	ID     uint64
	Host   string
}

type ClientInfoOutput added in v1.34.0

type ClientInfoOutput struct {
	Cli     *ClientReportOutput
	Assign  *LimitOutput
	Time    time.Time
	ID      uint64
	Host    string
	Version *proto.VersionInfo
}

type ClientReportOutput added in v1.34.0

type ClientReportOutput struct {
	ID        uint64
	FactorMap map[uint32]*proto.ClientLimitInfo
	Host      string
	Status    uint8
}

type Cluster

type Cluster struct {
	Name       string
	CreateTime int64

	MasterSecretKey []byte

	ClusterVolSubItem
	ClusterTopoSubItem
	ClusterDecommission

	DisableAutoAllocate bool

	S3ApiQosQuota  *sync.Map // (api,uid,limtType) -> limitQuota
	QosAcceptLimit *rate.Limiter
	// contains filtered or unexported fields
}

Cluster stores all the cluster-level information.

func (*Cluster) AutoDecommissionDiskIsEnabled added in v1.34.0

func (c *Cluster) AutoDecommissionDiskIsEnabled() bool

func (*Cluster) DelBucketLifecycle added in v1.34.0

func (c *Cluster) DelBucketLifecycle(VolName string)

func (*Cluster) GetAutoDecommissionDiskInterval added in v1.34.0

func (c *Cluster) GetAutoDecommissionDiskInterval() (interval time.Duration)

func (*Cluster) GetAutoDpMetaRepairParallelCnt added in v1.34.0

func (c *Cluster) GetAutoDpMetaRepairParallelCnt() (cnt int)

func (*Cluster) GetBucketLifecycle added in v1.34.0

func (c *Cluster) GetBucketLifecycle(VolName string) (lcConf *proto.LcConfiguration)

func (*Cluster) GetDecommissionDataPartitionBackupTimeOut added in v1.34.0

func (c *Cluster) GetDecommissionDataPartitionBackupTimeOut() time.Duration

func (*Cluster) GetDecommissionDataPartitionRecoverTimeOut added in v1.34.0

func (c *Cluster) GetDecommissionDataPartitionRecoverTimeOut() time.Duration

func (*Cluster) GetDecommissionDiskLimit added in v1.34.0

func (c *Cluster) GetDecommissionDiskLimit() (limit uint32)

func (*Cluster) IsLeader added in v1.34.0

func (c *Cluster) IsLeader() bool

func (*Cluster) RetryDecommissionDisk added in v1.34.0

func (c *Cluster) RetryDecommissionDisk(addr string, diskPath string) bool

func (*Cluster) SetAutoDecommissionDisk added in v1.34.0

func (c *Cluster) SetAutoDecommissionDisk(flag bool)

func (*Cluster) SetBucketLifecycle added in v1.34.0

func (c *Cluster) SetBucketLifecycle(req *proto.LcConfiguration) error

func (*Cluster) SetVerStrategy added in v1.34.0

func (c *Cluster) SetVerStrategy(volName string, strategy proto.VolumeVerStrategy, isForce bool) (err error)

func (*Cluster) TryDecommissionDataNode added in v1.34.0

func (c *Cluster) TryDecommissionDataNode(dataNode *DataNode)

func (*Cluster) TryDecommissionDisk added in v1.34.0

func (c *Cluster) TryDecommissionDisk(disk *DecommissionDisk)

type ClusterDecommission added in v1.34.0

type ClusterDecommission struct {
	BadDataPartitionIds     *sync.Map
	BadMetaPartitionIds     *sync.Map
	DecommissionDisks       sync.Map
	DecommissionLimit       uint64
	AutoDecommissionDiskMux sync.Mutex
	DecommissionDiskLimit   uint32
	MarkDiskBrokenThreshold atomicutil.Float64

	ForbidMpDecommission        bool
	EnableAutoDpMetaRepair      atomicutil.Bool
	EnableAutoDecommissionDisk  atomicutil.Bool
	AutoDecommissionInterval    atomicutil.Int64
	AutoDpMetaRepairParallelCnt atomicutil.Uint32
	// contains filtered or unexported fields
}

type ClusterService added in v1.34.0

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

func (*ClusterService) Schema added in v1.34.0

func (s *ClusterService) Schema() *graphql.Schema

type ClusterTopoSubItem added in v1.34.0

type ClusterTopoSubItem struct {
	FaultDomain bool
	// contains filtered or unexported fields
}

type ClusterVolSubItem added in v1.34.0

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

type DataNode

type DataNode struct {
	Total          uint64 `json:"TotalWeight"`
	Used           uint64 `json:"UsedWeight"`
	AvailableSpace uint64
	ID             uint64
	ZoneName       string `json:"Zone"`
	Addr           string
	DomainAddr     string
	ReportTime     time.Time
	StartTime      int64
	LastUpdateTime time.Time

	sync.RWMutex              `graphql:"-"`
	UsageRatio                float64           // used / total space
	SelectedTimes             uint64            // number times that this datanode has been selected as the location for a data partition.
	TaskManager               *AdminTaskManager `graphql:"-"`
	DataPartitionReports      []*proto.DataPartitionReport
	DataPartitionCount        uint32
	TotalPartitionSize        uint64
	NodeSetID                 uint64
	PersistenceDataPartitions []uint64
	BadDisks                  []string            // Keep this old field for compatibility
	BadDiskStats              []proto.BadDiskStat // key: disk path
	DecommissionedDisks       sync.Map            `json:"-"` // NOTE: the disks that already be decommissioned
	AllDisks                  []string            // TODO: remove me when merge to github master
	ToBeOffline               bool
	RdOnly                    bool
	MigrateLock               sync.RWMutex
	QosIopsRLimit             uint64
	QosIopsWLimit             uint64
	QosFlowRLimit             uint64
	QosFlowWLimit             uint64
	DecommissionStatus        uint32
	DecommissionDstAddr       string
	DecommissionRaftForce     bool
	DecommissionLimit         int
	DecommissionCompleteTime  int64
	DpCntLimit                LimitCounter       `json:"-"` // max count of data partition in a data node
	CpuUtil                   atomicutil.Float64 `json:"-"`

	DecommissionDiskList  []string // NOTE: the disks that running decommission
	DecommissionDpTotal   int
	DecommissionSyncMutex sync.Mutex
	BackupDataPartitions  []proto.BackupDataPartitionInfo
	// contains filtered or unexported fields
}

DataNode stores all the information about a data node

func (*DataNode) CanBePaused added in v1.34.0

func (dataNode *DataNode) CanBePaused() bool

func (*DataNode) GetAddr added in v1.34.0

func (dataNode *DataNode) GetAddr() string

func (*DataNode) GetAvailableSpace added in v1.34.0

func (dataNode *DataNode) GetAvailableSpace() uint64

func (*DataNode) GetDecommissionFailedDP added in v1.34.0

func (dataNode *DataNode) GetDecommissionFailedDP(c *Cluster) (error, []uint64)

func (*DataNode) GetDecommissionFailedDPByTerm added in v1.34.0

func (dataNode *DataNode) GetDecommissionFailedDPByTerm(c *Cluster) []proto.FailedDpInfo

func (*DataNode) GetDecommissionStatus added in v1.34.0

func (dataNode *DataNode) GetDecommissionStatus() uint32

func (*DataNode) GetID added in v1.34.0

func (dataNode *DataNode) GetID() uint64

func (*DataNode) GetIoUtils added in v1.34.0

func (dataNode *DataNode) GetIoUtils() map[string]float64

func (*DataNode) GetLatestDecommissionDataPartition added in v1.34.0

func (dataNode *DataNode) GetLatestDecommissionDataPartition(c *Cluster) (partitions []*DataPartition)

func (*DataNode) GetPartitionLimitCnt added in v1.34.0

func (dataNode *DataNode) GetPartitionLimitCnt() uint32

func (*DataNode) GetStorageInfo added in v1.34.0

func (dataNode *DataNode) GetStorageInfo() string

func (*DataNode) GetTotal added in v1.34.0

func (dataNode *DataNode) GetTotal() uint64

func (*DataNode) GetUsed added in v1.34.0

func (dataNode *DataNode) GetUsed() uint64

func (*DataNode) IsActiveNode added in v1.34.0

func (dataNode *DataNode) IsActiveNode() bool

func (*DataNode) IsOffline added in v1.34.0

func (dataNode *DataNode) IsOffline() bool

func (*DataNode) IsWriteAble added in v1.34.0

func (dataNode *DataNode) IsWriteAble() (ok bool)

func (*DataNode) PartitionCntLimited added in v1.34.0

func (dataNode *DataNode) PartitionCntLimited() bool

func (*DataNode) SelectNodeForWrite

func (dataNode *DataNode) SelectNodeForWrite()

SelectNodeForWrite implements "SelectNodeForWrite" in the Node interface

func (*DataNode) SetDecommissionStatus added in v1.34.0

func (dataNode *DataNode) SetDecommissionStatus(status uint32)

func (*DataNode) SetIoUtils added in v1.34.0

func (dataNode *DataNode) SetIoUtils(used map[string]float64)

type DataPartition

type DataPartition struct {
	PartitionID    uint64
	PartitionType  int
	PartitionTTL   int64
	LastLoadedTime int64
	ReplicaNum     uint8
	Status         int8

	Replicas         []*DataReplica
	LeaderReportTime int64
	Hosts            []string // host addresses
	Peers            []proto.Peer

	sync.RWMutex

	MissingNodes map[string]int64 // key: address of the missing node, value: when the node is missing
	VolName      string
	VolID        uint64

	OfflinePeerID           uint64
	FileInCoreMap           map[string]*FileInCore
	FilesWithMissingReplica map[string]int64 // key: file name, value: last time when a missing replica is found

	RdOnly bool

	DecommissionRetry              int
	DecommissionStatus             uint32
	DecommissionSrcAddr            string
	DecommissionDstAddr            string
	DecommissionRaftForce          bool
	DecommissionSrcDiskPath        string
	DecommissionTerm               uint64
	DecommissionDstAddrSpecify     bool // if DecommissionDstAddrSpecify is true, donot rollback when add replica fail
	DecommissionNeedRollback       bool
	DecommissionNeedRollbackTimes  uint32
	DecommissionErrorMessage       string
	SpecialReplicaDecommissionStop chan bool // used for stop
	SpecialReplicaDecommissionStep uint32
	IsDiscard                      bool
	VerSeq                         uint64
	RecoverStartTime               time.Time
	RecoverLastConsumeTime         time.Duration
	RepairBlockSize                uint64
	DecommissionType               uint32
	RestoreReplica                 uint32
	// contains filtered or unexported fields
}

DataPartition represents the structure of storing the file contents.

func (*DataPartition) Decommission added in v1.34.0

func (partition *DataPartition) Decommission(c *Cluster) bool

func (*DataPartition) GetDecommissionStatus added in v1.34.0

func (partition *DataPartition) GetDecommissionStatus() uint32

func (*DataPartition) GetSpecialReplicaDecommissionStep added in v1.34.0

func (partition *DataPartition) GetSpecialReplicaDecommissionStep() uint32

func (*DataPartition) IsDecommissionFailed added in v1.34.0

func (partition *DataPartition) IsDecommissionFailed() bool

func (*DataPartition) IsDecommissionInitial added in v1.34.0

func (partition *DataPartition) IsDecommissionInitial() bool

func (*DataPartition) IsDecommissionPaused added in v1.34.0

func (partition *DataPartition) IsDecommissionPaused() bool

func (*DataPartition) IsDecommissionPrepare added in v1.34.0

func (partition *DataPartition) IsDecommissionPrepare() bool

func (*DataPartition) IsDecommissionRunning added in v1.34.0

func (partition *DataPartition) IsDecommissionRunning() bool

func (*DataPartition) IsDecommissionSuccess added in v1.34.0

func (partition *DataPartition) IsDecommissionSuccess() bool

func (*DataPartition) IsDoingDecommission added in v1.34.0

func (partition *DataPartition) IsDoingDecommission() bool

func (*DataPartition) IsMarkDecommission added in v1.34.0

func (partition *DataPartition) IsMarkDecommission() bool

func (*DataPartition) IsRollbackFailed added in v1.34.0

func (partition *DataPartition) IsRollbackFailed() bool

func (*DataPartition) MarkDecommissionStatus added in v1.34.0

func (partition *DataPartition) MarkDecommissionStatus(srcAddr, dstAddr, srcDisk string, raftForce bool, term uint64,
	migrateType uint32, c *Cluster, ns *nodeSet,
) (err error)

func (*DataPartition) PauseDecommission added in v1.34.0

func (partition *DataPartition) PauseDecommission(c *Cluster) bool

func (*DataPartition) ReleaseDecommissionToken added in v1.34.0

func (partition *DataPartition) ReleaseDecommissionToken(c *Cluster)

func (*DataPartition) ResetDecommissionStatus added in v1.34.0

func (partition *DataPartition) ResetDecommissionStatus()

func (*DataPartition) SetDecommissionStatus added in v1.34.0

func (partition *DataPartition) SetDecommissionStatus(status uint32)

func (*DataPartition) SetSpecialReplicaDecommissionStep added in v1.34.0

func (partition *DataPartition) SetSpecialReplicaDecommissionStep(step uint32)

func (*DataPartition) TryAcquireDecommissionToken added in v1.34.0

func (partition *DataPartition) TryAcquireDecommissionToken(c *Cluster) bool

func (*DataPartition) TryToDecommission added in v1.34.0

func (partition *DataPartition) TryToDecommission(c *Cluster) bool

type DataPartitionMap

type DataPartitionMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

DataPartitionMap stores all the data partitionMap

type DataPartitionPreLoad added in v1.34.0

type DataPartitionPreLoad struct {
	PreloadCacheTTL uint64
	// contains filtered or unexported fields
}

type DataReplica

type DataReplica struct {
	proto.DataReplica
	// contains filtered or unexported fields
}

DataReplica represents the replica of a data partition

type DecommissionDataPartitionCacheValue added in v1.34.0

type DecommissionDataPartitionCacheValue struct {
	CacheMap []dataPartitionValue
	Status   uint32
}

type DecommissionDataPartitionList added in v1.34.0

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

func NewDecommissionDataPartitionList added in v1.34.0

func NewDecommissionDataPartitionList(c *Cluster, nsId uint64) *DecommissionDataPartitionList

func (*DecommissionDataPartitionList) Clear added in v1.34.0

func (l *DecommissionDataPartitionList) Clear()

func (*DecommissionDataPartitionList) GetAllDecommissionDataPartitions added in v1.34.0

func (l *DecommissionDataPartitionList) GetAllDecommissionDataPartitions() (collection []*DataPartition)

func (*DecommissionDataPartitionList) Has added in v1.34.0

func (*DecommissionDataPartitionList) Length added in v1.34.0

func (l *DecommissionDataPartitionList) Length() int

func (*DecommissionDataPartitionList) Put added in v1.34.0

func (*DecommissionDataPartitionList) Remove added in v1.34.0

func (l *DecommissionDataPartitionList) Remove(value *DataPartition)

func (*DecommissionDataPartitionList) Stop added in v1.34.0

reserved

type DecommissionDataPartitionListValue added in v1.34.0

type DecommissionDataPartitionListValue struct {
	DecommissionDataPartitionCacheValue
	ParallelLimit int32
	CurParallel   int32
}

type DecommissionDisk added in v1.34.0

type DecommissionDisk struct {
	SrcAddr                  string
	DstAddr                  string
	DiskPath                 string
	DecommissionStatus       uint32
	DecommissionRaftForce    bool
	DecommissionTimes        uint8
	DecommissionDpTotal      int
	DecommissionTerm         uint64
	DecommissionDpCount      int
	DiskDisable              bool
	IgnoreDecommissionDps    []proto.IgnoreDecommissionDP
	ResidualDecommissionDps  []proto.IgnoreDecommissionDP
	Type                     uint32
	DecommissionCompleteTime int64
	UpdateMutex              sync.RWMutex `json:"-"`
}

func (*DecommissionDisk) Abort added in v1.34.0

func (dd *DecommissionDisk) Abort(c *Cluster) (err error)

func (*DecommissionDisk) AddToNodeSet added in v1.34.0

func (dd *DecommissionDisk) AddToNodeSet() bool

func (*DecommissionDisk) CanBePaused added in v1.34.0

func (dd *DecommissionDisk) CanBePaused() bool

func (*DecommissionDisk) GenerateKey added in v1.34.0

func (dd *DecommissionDisk) GenerateKey() string

func (*DecommissionDisk) GetDecommissionFailedDP added in v1.34.0

func (dd *DecommissionDisk) GetDecommissionFailedDP(c *Cluster) (error, []uint64)

func (*DecommissionDisk) GetDecommissionFailedDPByTerm added in v1.34.0

func (dd *DecommissionDisk) GetDecommissionFailedDPByTerm(c *Cluster) []proto.FailedDpInfo

func (*DecommissionDisk) GetDecommissionStatus added in v1.34.0

func (dd *DecommissionDisk) GetDecommissionStatus() uint32

func (*DecommissionDisk) GetLatestDecommissionDP added in v1.34.0

func (dd *DecommissionDisk) GetLatestDecommissionDP(c *Cluster) (partitions []*DataPartition)

func (*DecommissionDisk) IsManualDecommissionDisk added in v1.34.0

func (dd *DecommissionDisk) IsManualDecommissionDisk() bool

func (*DecommissionDisk) SetDecommissionStatus added in v1.34.0

func (dd *DecommissionDisk) SetDecommissionStatus(status uint32)

type DecommissionDiskList added in v1.34.0

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

func NewDecommissionDiskList added in v1.34.0

func NewDecommissionDiskList() *DecommissionDiskList

func (*DecommissionDiskList) Clear added in v1.34.0

func (l *DecommissionDiskList) Clear()

func (*DecommissionDiskList) Length added in v1.34.0

func (l *DecommissionDiskList) Length() int

func (*DecommissionDiskList) PopMarkDecommissionDisk added in v1.34.0

func (l *DecommissionDiskList) PopMarkDecommissionDisk(limit int) (count int, collection []*DecommissionDisk)

only pop decommission disk with markDecommission status from front

func (*DecommissionDiskList) Put added in v1.34.0

func (l *DecommissionDiskList) Put(nsId uint64, value *DecommissionDisk)

func (*DecommissionDiskList) Remove added in v1.34.0

func (l *DecommissionDiskList) Remove(nsId uint64, value *DecommissionDisk)

type DomainManager added in v1.34.0

type DomainManager struct {
	ZoneName2DomainIdMap map[string]uint64

	sync.RWMutex
	// contains filtered or unexported fields
}

type DomainNodeSetGrpManager added in v1.34.0

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

type FileCrc

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

FileCrc defines the crc of a file

type FileInCore

type FileInCore struct {
	proto.FileInCore
	MetadataArray []*FileMetadata
}

FileInCore define file in data partition

type FileMetadata

type FileMetadata struct {
	proto.FileMetadata

	ApplyID uint64
	// contains filtered or unexported fields
}

FileMetadata defines the file metadata on a dataNode

func (*FileMetadata) String

func (fm *FileMetadata) String() (msg string)

type IDAllocator

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

IDAllocator generates and allocates ids

type InvalidNodeView added in v1.34.0

type InvalidNodeView struct {
	Addr     string
	ID       uint64
	OldID    uint64
	NodeType string
}

NodeView provides the view of the data or meta node.

type LcNode added in v1.34.0

type LcNode struct {
	ID          uint64
	Addr        string
	ReportTime  time.Time
	IsActive    bool
	TaskManager *AdminTaskManager
	sync.RWMutex
}

type LcNodeInfoResponse added in v1.34.0

type LcNodeInfoResponse struct {
	RegisterInfos      []*LcNodeStatInfo
	LcConfigurations   map[string]*proto.LcConfiguration
	LcRuleTaskStatus   lcRuleTaskStatus
	LcNodeStatus       lcNodeStatus
	SnapshotVerStatus  lcSnapshotVerStatus
	SnapshotNodeStatus lcNodeStatus
}

type LcNodeStatInfo added in v1.34.0

type LcNodeStatInfo struct {
	Addr string
}

type LeaderInfo

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

LeaderInfo represents the leader's information

type LeaderMetaNode added in v1.34.0

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

LeaderMetaNode define the leader metaPartitions in meta node

type LimitCounter added in v1.34.0

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

func (*LimitCounter) GetCntLimit added in v1.34.0

func (cntLimiter *LimitCounter) GetCntLimit() uint64

type LimitOutput added in v1.34.0

type LimitOutput struct {
	ID            uint64
	Enable        bool
	ReqPeriod     uint32
	HitTriggerCnt uint8
	FactorMap     map[uint32]*proto.ClientLimitInfo
}

type MasterInfo added in v1.34.0

type MasterInfo struct {
	Index    string
	Addr     string
	IsLeader bool
}

type MasterQuotaManager added in v1.34.0

type MasterQuotaManager struct {
	MpQuotaInfoMap map[uint64][]*proto.QuotaReportInfo
	IdQuotaInfoMap map[uint32]*proto.QuotaInfo

	sync.RWMutex
	// contains filtered or unexported fields
}

func (*MasterQuotaManager) HasQuota added in v1.34.0

func (mqMgr *MasterQuotaManager) HasQuota() bool

type MetaNode

type MetaNode struct {
	ID                uint64
	Addr              string
	DomainAddr        string
	IsActive          bool
	Sender            *AdminTaskManager `graphql:"-"`
	ZoneName          string            `json:"Zone"`
	MaxMemAvailWeight uint64            `json:"MaxMemAvailWeight"`
	Total             uint64            `json:"TotalWeight"`
	Used              uint64            `json:"UsedWeight"`
	Ratio             float64
	SelectCount       uint64
	Threshold         float32
	ReportTime        time.Time

	MetaPartitionCount        int
	NodeSetID                 uint64
	sync.RWMutex              `graphql:"-"`
	ToBeOffline               bool
	PersistenceMetaPartitions []uint64
	RdOnly                    bool
	MigrateLock               sync.RWMutex
	MpCntLimit                LimitCounter       `json:"-"` // max count of meta partition in a meta node
	CpuUtil                   atomicutil.Float64 `json:"-"`
	// contains filtered or unexported fields
}

MetaNode defines the structure of a meta node

func (*MetaNode) GetAddr added in v1.34.0

func (metaNode *MetaNode) GetAddr() string

func (*MetaNode) GetAvailableSpace added in v1.34.0

func (metaNode *MetaNode) GetAvailableSpace() uint64

func (*MetaNode) GetID added in v1.34.0

func (metaNode *MetaNode) GetID() uint64

func (*MetaNode) GetPartitionLimitCnt added in v1.34.0

func (metaNode *MetaNode) GetPartitionLimitCnt() (limit uint32)

func (*MetaNode) GetStorageInfo added in v1.34.0

func (metaNode *MetaNode) GetStorageInfo() string

func (*MetaNode) GetTotal added in v1.34.0

func (metaNode *MetaNode) GetTotal() uint64

func (*MetaNode) GetUsed added in v1.34.0

func (metaNode *MetaNode) GetUsed() uint64

func (*MetaNode) IsActiveNode added in v1.34.0

func (metaNode *MetaNode) IsActiveNode() bool

func (*MetaNode) IsOffline added in v1.34.0

func (metaNode *MetaNode) IsOffline() bool

func (*MetaNode) IsWriteAble added in v1.34.0

func (metaNode *MetaNode) IsWriteAble() (ok bool)

func (*MetaNode) PartitionCntLimited added in v1.34.0

func (metaNode *MetaNode) PartitionCntLimited() bool

func (*MetaNode) SelectNodeForWrite

func (metaNode *MetaNode) SelectNodeForWrite()

SelectNodeForWrite implements the Node interface

type MetaPartition

type MetaPartition struct {
	PartitionID      uint64
	Start            uint64
	End              uint64
	MaxInodeID       uint64
	InodeCount       uint64
	DentryCount      uint64
	FreeListLen      uint64
	TxCnt            uint64
	TxRbInoCnt       uint64
	TxRbDenCnt       uint64
	Replicas         []*MetaReplica
	LeaderReportTime int64
	ReplicaNum       uint8
	Status           int8
	IsRecover        bool

	Hosts         []string
	Peers         []proto.Peer
	OfflinePeerID uint64
	MissNodes     map[string]int64
	LoadResponse  []*proto.MetaPartitionLoadResponse

	EqualCheckPass bool
	VerSeq         uint64

	sync.RWMutex
	// contains filtered or unexported fields
}

MetaPartition defines the structure of a meta partition

func (*MetaPartition) SetTxCnt added in v1.34.0

func (mp *MetaPartition) SetTxCnt()

type MetaReplica

type MetaReplica struct {
	Addr string

	MaxInodeID  uint64
	InodeCount  uint64
	DentryCount uint64
	TxCnt       uint64
	TxRbInoCnt  uint64
	TxRbDenCnt  uint64
	FreeListLen uint64
	ReportTime  int64
	Status      int8 // unavailable, readOnly, readWrite
	IsLeader    bool
	// contains filtered or unexported fields
}

MetaReplica defines the replica of a meta partition

type MetadataFsm

type MetadataFsm struct {
	UserAppCmdHandler raftUserCmdApplyHandler
	// contains filtered or unexported fields
}

MetadataFsm represents the finite state machine of a metadata partition

func (*MetadataFsm) Apply

func (mf *MetadataFsm) Apply(command []byte, index uint64) (resp interface{}, err error)

Apply implements the interface of raft.StateMachine

func (*MetadataFsm) ApplyMemberChange

func (mf *MetadataFsm) ApplyMemberChange(confChange *proto.ConfChange, index uint64) (interface{}, error)

ApplyMemberChange implements the interface of raft.StateMachine

func (*MetadataFsm) ApplySnapshot

func (mf *MetadataFsm) ApplySnapshot(peers []proto.Peer, iterator proto.SnapIterator) (err error)

ApplySnapshot implements the interface of raft.StateMachine

func (*MetadataFsm) HandleFatalEvent

func (mf *MetadataFsm) HandleFatalEvent(err *raft.FatalError)

HandleFatalEvent implements the interface of raft.StateMachine

func (*MetadataFsm) HandleLeaderChange

func (mf *MetadataFsm) HandleLeaderChange(leader uint64)

HandleLeaderChange implements the interface of raft.StateMachine

func (*MetadataFsm) Snapshot

func (mf *MetadataFsm) Snapshot() (proto.Snapshot, error)

Snapshot implements the interface of raft.StateMachine

func (*MetadataFsm) Stop added in v1.34.0

func (mf *MetadataFsm) Stop()

Stop stops the RaftServer

type MetadataSnapshot

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

MetadataSnapshot represents the snapshot of a meta partition

func (*MetadataSnapshot) ApplyIndex

func (ms *MetadataSnapshot) ApplyIndex() uint64

ApplyIndex implements the Snapshot interface

func (*MetadataSnapshot) Close

func (ms *MetadataSnapshot) Close()

Close implements the Snapshot interface

func (*MetadataSnapshot) Next

func (ms *MetadataSnapshot) Next() (data []byte, err error)

Next implements the Snapshot interface

type NoLeaderPartInfo added in v1.34.0

type NoLeaderPartInfo struct {
	ReportTime int64
	Replicas   uint8
}

type Node

type Node interface {
	SelectNodeForWrite()
	GetID() uint64
	GetAddr() string
	PartitionCntLimited() bool
	IsActiveNode() bool
	IsWriteAble() bool
	GetPartitionLimitCnt() uint32
	GetTotal() uint64
	GetUsed() uint64
	GetAvailableSpace() uint64
	GetStorageInfo() string
	IsOffline() bool
}

Node defines an interface that needs to be implemented by weightedNode

type NodeSelector added in v1.34.0

type NodeSelector interface {
	GetName() string
	Select(ns *nodeSet, excludeHosts []string, replicaNum int) (newHosts []string, peers []proto.Peer, err error)
}

func NewNodeSelector added in v1.34.0

func NewNodeSelector(name string, nodeType NodeType) NodeSelector

type NodeSetView added in v1.34.0

type NodeSetView struct {
	DataNodeLen int
	MetaNodeLen int
	MetaNodes   []proto.NodeView
	DataNodes   []proto.NodeView
}

type NodeType added in v1.34.0

type NodeType int

selector enum

type NodeView

type NodeView struct {
	Addr       string
	Status     bool
	ID         uint64
	IsWritable bool
}

NodeView provides the view of the data or meta node.

type NodesetSelector added in v1.34.0

type NodesetSelector interface {
	GetName() string
	Select(nsc nodeSetCollection, excludeNodeSets []uint64, replicaNum uint8) (ns *nodeSet, err error)
}

func NewNodesetSelector added in v1.34.0

func NewNodesetSelector(name string, nodeType NodeType) NodesetSelector

type OpLcNode added in v1.34.0

type OpLcNode interface {
	GetIdleNode() (nodeAddr string)
	RemoveNode(nodeAddr string)
	UpdateNode(nodeAddr string, count int)
}

type QosCtrlManager added in v1.34.0

type QosCtrlManager struct {
	ClientReqPeriod     uint32
	ClientHitTriggerCnt uint32

	sync.RWMutex
	// contains filtered or unexported fields
}

func (*QosCtrlManager) HandleClientQosReq added in v1.34.0

func (qosManager *QosCtrlManager) HandleClientQosReq(reqClientInfo *proto.ClientReportLimitInfo, clientID uint64) (limitRsp *proto.LimitRsp2Client, err error)

type RaftCmd

type RaftCmd struct {
	Op uint32 `json:"op"`
	K  string `json:"k"`
	V  []byte `json:"v"`
}

RaftCmd defines the Raft commands.

func (*RaftCmd) Marshal

func (m *RaftCmd) Marshal() ([]byte, error)

Marshal converts the RaftCmd to a byte array.

func (*RaftCmd) Unmarshal

func (m *RaftCmd) Unmarshal(data []byte) (err error)

Unmarshal converts the byte array to a RaftCmd.

type RoundRobinNodeSelector added in v1.34.0

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

func NewRoundRobinNodeSelector added in v1.34.0

func NewRoundRobinNodeSelector(nodeType NodeType) *RoundRobinNodeSelector

func (*RoundRobinNodeSelector) GetName added in v1.34.0

func (s *RoundRobinNodeSelector) GetName() string

func (*RoundRobinNodeSelector) Select added in v1.34.0

func (s *RoundRobinNodeSelector) Select(ns *nodeSet, excludeHosts []string, replicaNum int) (newHosts []string, peers []proto.Peer, err error)

type RoundRobinNodesetSelector added in v1.34.0

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

func NewRoundRobinNodesetSelector added in v1.34.0

func NewRoundRobinNodesetSelector(nodeType NodeType) *RoundRobinNodesetSelector

func (*RoundRobinNodesetSelector) GetName added in v1.34.0

func (s *RoundRobinNodesetSelector) GetName() string

func (*RoundRobinNodesetSelector) Select added in v1.34.0

func (s *RoundRobinNodesetSelector) Select(nsc nodeSetCollection, excludeNodeSets []uint64, replicaNum uint8) (ns *nodeSet, err error)

type Server

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

Server represents the server in a cluster

func NewServer

func NewServer() *Server

NewServer creates a new server

func (*Server) CreateQuota added in v1.34.0

func (m *Server) CreateQuota(w http.ResponseWriter, r *http.Request)

func (*Server) CreateVersion added in v1.34.0

func (m *Server) CreateVersion(w http.ResponseWriter, r *http.Request)

func (*Server) DelBucketLifecycle added in v1.34.0

func (m *Server) DelBucketLifecycle(w http.ResponseWriter, r *http.Request)

func (*Server) DelVersion added in v1.34.0

func (m *Server) DelVersion(w http.ResponseWriter, r *http.Request)

func (*Server) DeleteQuota added in v1.34.0

func (m *Server) DeleteQuota(w http.ResponseWriter, r *http.Request)

func (*Server) GetAllVersionInfo added in v1.34.0

func (m *Server) GetAllVersionInfo(w http.ResponseWriter, r *http.Request)

func (*Server) GetBucketLifecycle added in v1.34.0

func (m *Server) GetBucketLifecycle(w http.ResponseWriter, r *http.Request)

func (*Server) GetClusterValue added in v1.34.0

func (m *Server) GetClusterValue(w http.ResponseWriter, r *http.Request)

func (*Server) GetQuota added in v1.34.0

func (m *Server) GetQuota(w http.ResponseWriter, r *http.Request)

func (*Server) GetVersionInfo added in v1.34.0

func (m *Server) GetVersionInfo(w http.ResponseWriter, r *http.Request)

func (*Server) ListQuota added in v1.34.0

func (m *Server) ListQuota(w http.ResponseWriter, r *http.Request)

func (*Server) ListQuotaAll added in v1.34.0

func (m *Server) ListQuotaAll(w http.ResponseWriter, r *http.Request)

func (*Server) OpFollowerPartitionsRead added in v1.34.0

func (m *Server) OpFollowerPartitionsRead(w http.ResponseWriter, r *http.Request)

func (*Server) QosGetZoneLimit added in v1.34.0

func (m *Server) QosGetZoneLimit(w http.ResponseWriter, r *http.Request)

flowRVal, flowWVal take MB as unit

func (*Server) QosUpdate added in v1.34.0

func (m *Server) QosUpdate(w http.ResponseWriter, r *http.Request)

func (*Server) QosUpdateClientParam added in v1.34.0

func (m *Server) QosUpdateClientParam(w http.ResponseWriter, r *http.Request)

func (*Server) QosUpdateZoneLimit added in v1.34.0

func (m *Server) QosUpdateZoneLimit(w http.ResponseWriter, r *http.Request)

flowRVal, flowWVal take MB as unit

func (*Server) QueryDecommissionFailedDisk added in v1.34.0

func (m *Server) QueryDecommissionFailedDisk(w http.ResponseWriter, r *http.Request)

func (*Server) S3QosDelete added in v1.34.0

func (m *Server) S3QosDelete(w http.ResponseWriter, r *http.Request)

func (*Server) S3QosGet added in v1.34.0

func (m *Server) S3QosGet(w http.ResponseWriter, r *http.Request)

func (*Server) S3QosSet added in v1.34.0

func (m *Server) S3QosSet(w http.ResponseWriter, r *http.Request)

func (*Server) SetBucketLifecycle added in v1.34.0

func (m *Server) SetBucketLifecycle(w http.ResponseWriter, r *http.Request)

func (*Server) SetVerStrategy added in v1.34.0

func (m *Server) SetVerStrategy(w http.ResponseWriter, r *http.Request)

func (*Server) Shutdown

func (m *Server) Shutdown()

Shutdown closes the server

func (*Server) Start

func (m *Server) Start(cfg *config.Config) (err error)

Start starts a server

func (*Server) Sync

func (m *Server) Sync()

Sync waits for the execution termination of the server

func (*Server) UidOperate added in v1.34.0

func (m *Server) UidOperate(w http.ResponseWriter, r *http.Request)

func (*Server) UpdateQuota added in v1.34.0

func (m *Server) UpdateQuota(w http.ResponseWriter, r *http.Request)

type ServerFactorLimit added in v1.34.0

type ServerFactorLimit struct {
	Name           string
	Type           uint32
	Total          uint64
	Buffer         uint64 // flowbuffer add with preallocate buffer equal with flowtotal
	CliUsed        uint64
	CliNeed        uint64
	Allocated      uint64
	NeedAfterAlloc uint64

	LimitRate   float32
	LastMagnify uint64
	// contains filtered or unexported fields
}

func (*ServerFactorLimit) String added in v1.34.0

func (serverLimit *ServerFactorLimit) String() string

type SortedWeightedNodes

type SortedWeightedNodes []*weightedNode

SortedWeightedNodes defines an array sorted by carry

func (SortedWeightedNodes) Len

func (nodes SortedWeightedNodes) Len() int

func (SortedWeightedNodes) Less

func (nodes SortedWeightedNodes) Less(i, j int) bool

func (SortedWeightedNodes) Swap

func (nodes SortedWeightedNodes) Swap(i, j int)

type StrawNodeSelector added in v1.34.0

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

NOTE: this node selector inspired by Straw2 algorithm, which is widely used in ceph

func NewStrawNodeSelector added in v1.34.0

func NewStrawNodeSelector(nodeType NodeType) *StrawNodeSelector

func (*StrawNodeSelector) GetName added in v1.34.0

func (s *StrawNodeSelector) GetName() string

func (*StrawNodeSelector) Select added in v1.34.0

func (s *StrawNodeSelector) Select(ns *nodeSet, excludeHosts []string, replicaNum int) (newHosts []string, peers []proto.Peer, err error)

type StrawNodesetSelector added in v1.34.0

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

NOTE: this nodeset selector inspired by Straw2 algorithm, which is widely used in ceph

func NewStrawNodesetSelector added in v1.34.0

func NewStrawNodesetSelector(nodeType NodeType) *StrawNodesetSelector

func (*StrawNodesetSelector) GetName added in v1.34.0

func (s *StrawNodesetSelector) GetName() string

func (*StrawNodesetSelector) Select added in v1.34.0

func (s *StrawNodesetSelector) Select(nsc nodeSetCollection, excludeNodeSets []uint64, replicaNum uint8) (ns *nodeSet, err error)

type TopoSubItem added in v1.34.0

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

type TopologyView

type TopologyView struct {
	Zones []*ZoneView
}

TopologyView provides the view of the topology view of the cluster

type TxSubItem added in v1.34.0

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

type UidCmd added in v1.34.0

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

type UidSpaceFsm added in v1.34.0

type UidSpaceFsm struct {
	UidSpaceArr []*proto.UidSpaceInfo
}

type UidSpaceManager added in v1.34.0

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

type User added in v1.34.0

type User struct {
	AKStore sync.Map // K: ak, V: userID

	AKStoreMutex sync.RWMutex
	// contains filtered or unexported fields
}

type UserPermission added in v1.34.0

type UserPermission struct {
	UserID string
	Access []string
	Edit   bool
}

type UserService added in v1.34.0

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

func (*UserService) Schema added in v1.34.0

func (s *UserService) Schema() *graphql.Schema

type UserStatistical added in v1.34.0

type UserStatistical struct {
	Data               uint64
	VolumeCount        int32
	DataPartitionCount int32
	MetaPartitionCount int32
}

type UserUseSpace added in v1.34.0

type UserUseSpace struct {
	Name  string
	Size  uint64
	Ratio float32
}

type Ver2PhaseCommit added in v1.34.0

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

func (*Ver2PhaseCommit) String added in v1.34.0

func (commit *Ver2PhaseCommit) String() string

type Vol

type Vol struct {
	ID      uint64
	Name    string
	Owner   string
	Status  uint8
	VolType int

	TrashInterval int64

	Capacity uint64 // GB

	MetaPartitions map[uint64]*MetaPartition `graphql:"-"`

	NeedToLowerReplica bool
	FollowerRead       bool

	DisableAuditLog         bool
	DpReadOnlyWhenVolFull   bool // only if this switch is on, all dp becomes readonly when vol is full
	ReadOnlyForVolFull      bool // only if the switch DpReadOnlyWhenVolFull is on, mark vol is readonly when is full
	AccessTimeInterval      int64
	EnablePersistAccessTime bool
	AccessTimeValidInterval int64
	EnableAutoMetaRepair    atomicutil.Bool

	TopoSubItem
	CacheSubItem
	TxSubItem
	AuthenticSubItem
	VolDeletionSubItem

	VersionMgr *VolVersionManager
	// contains filtered or unexported fields
}

Vol represents a set of meta partitionMap and data partitionMap

func (*Vol) CalculatePreloadCapacity added in v1.34.0

func (vol *Vol) CalculatePreloadCapacity() uint64

func (*Vol) CheckStrategy added in v1.34.0

func (vol *Vol) CheckStrategy(c *Cluster)

func (*Vol) IsReadOnlyForVolFull added in v1.34.0

func (vol *Vol) IsReadOnlyForVolFull() bool

func (*Vol) SetReadOnlyForVolFull added in v1.34.0

func (vol *Vol) SetReadOnlyForVolFull(isFull bool)

func (*Vol) String

func (vol *Vol) String() string

type VolDeletionSubItem added in v1.34.0

type VolDeletionSubItem struct {
	Deleting       bool
	DeleteLockTime int64
	Forbidden      bool
	DeleteExecTime time.Time
}

type VolNameSet added in v1.34.0

type VolNameSet map[string]struct{}

type VolVarargs added in v1.34.0

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

type VolVersionManager added in v1.34.0

type VolVersionManager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*VolVersionManager) CommitVer added in v1.34.0

func (verMgr *VolVersionManager) CommitVer() (ver *proto.VolVersionInfo)

func (*VolVersionManager) DelVer added in v1.34.0

func (verMgr *VolVersionManager) DelVer(verSeq uint64) (err error)

func (*VolVersionManager) GenerateVer added in v1.34.0

func (verMgr *VolVersionManager) GenerateVer(verSeq uint64, op uint8) (err error)

func (*VolVersionManager) Persist added in v1.34.0

func (verMgr *VolVersionManager) Persist() (err error)

func (*VolVersionManager) SetVerStrategy added in v1.34.0

func (verMgr *VolVersionManager) SetVerStrategy(strategy proto.VolumeVerStrategy, isForce bool) (err error)

func (*VolVersionManager) String added in v1.34.0

func (verMgr *VolVersionManager) String() string

func (*VolVersionManager) UpdateVerStatus added in v1.34.0

func (verMgr *VolVersionManager) UpdateVerStatus(verSeq uint64, status uint8) (err error)

type VolVersionPersist added in v1.34.0

type VolVersionPersist struct {
	MultiVersionList []*proto.VolVersionInfo
	Strategy         proto.VolumeVerStrategy
	VerSeq           uint64
}

type VolumeService added in v1.34.0

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

func (*VolumeService) Schema added in v1.34.0

func (s *VolumeService) Schema() *graphql.Schema

type WarnMessage added in v1.34.0

type WarnMessage struct {
	Time     string `json:"time"`
	Key      string `json:"key"`
	Hostname string `json:"hostname"`
	Type     string `json:"type"`
	Value    string `json:"value"`
	Detail   string `json:"detail"`
}

type Zone added in v1.34.0

type Zone struct {
	QosIopsRLimit uint64
	QosIopsWLimit uint64
	QosFlowRLimit uint64
	QosFlowWLimit uint64
	sync.RWMutex
	// contains filtered or unexported fields
}

Zone stores all the zone related information

func (*Zone) GetDataNodesetSelector added in v1.34.0

func (zone *Zone) GetDataNodesetSelector() string

func (*Zone) GetMetaNodesetSelector added in v1.34.0

func (zone *Zone) GetMetaNodesetSelector() string

func (*Zone) SetDataNodesetSelector added in v1.34.0

func (zone *Zone) SetDataNodesetSelector(name string)

func (*Zone) SetMetaNodeSelector added in v1.34.0

func (zone *Zone) SetMetaNodeSelector(name string)

type ZoneView added in v1.34.0

type ZoneView struct {
	Name                string
	Status              string
	DataNodesetSelector string
	MetaNodesetSelector string
	NodeSet             map[uint64]*NodeSetView
}

ZoneView define the view of zone

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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