Documentation ¶
Index ¶
- Constants
- Variables
- func CheckAPIAccessCaps(ticket *cryptoutil.Ticket, rscType string, mp MsgType, action string) (err error)
- func CheckVOLAccessCaps(ticket *cryptoutil.Ticket, volName string, action string, accessNode string) (err error)
- func DumpVersion(role string) string
- func ExtractAPIAccessTicket(req *APIAccessReq, key []byte) (ticket cryptoutil.Ticket, ts int64, err error)
- func ExtractTicket(str string, key []byte) (ticket cryptoutil.Ticket, err error)
- func GenerateRequestID() int64
- func GetDataFromResp(body []byte, key []byte) (plaintext []byte, err error)
- func GetDpType(volType int, isPreload bool) int
- func InitMountOptions(opts []MountOption)
- func IsCacheDp(typ int) bool
- func IsCold(typ int) bool
- func IsDir(mode uint32) bool
- func IsHot(typ int) bool
- func IsNormalDp(typ int) bool
- func IsPreLoadDp(typ int) bool
- func IsRegular(mode uint32) bool
- func IsSymlink(mode uint32) bool
- func IsValidAK(ak string) bool
- func IsValidClientID(id string) (err error)
- func IsValidMsgReqType(serviceID string, msgType MsgType) (err error)
- func IsValidSK(sk string) bool
- func IsValidServiceID(serviceID string) (err error)
- func Mode(osMode os.FileMode) uint32
- func OsMode(mode uint32) os.FileMode
- func OsModeType(mode uint32) os.FileMode
- func ParseErrorCode(code int32) error
- func ParseMountOptions(opts []MountOption, cfg *config.Config)
- func ParseVerifier(verifier string, key []byte) (ts int64, err error)
- func ReadFull(c net.Conn, buf *[]byte, readSize int) (err error)
- func SendBytes(client *http.Client, target string, data []byte) (res []byte, err error)
- func SendData(client *http.Client, target string, data interface{}) (res []byte, err error)
- func VerifyAPIAccessReqIDs(req *APIAccessReq) (err error)
- func VerifyAPIRespComm(apiResp *APIAccessResp, msg MsgType, clientID string, serviceID string, ...) (err error)
- func VerifyTicketRespComm(ticketResp *AuthGetTicketResp, msg MsgType, clientID string, serviceID string, ...) (err error)
- type AKUser
- type APIAccessReq
- type APIAccessResp
- type Action
- type Actions
- type AddDataPartitionRaftMemberRequest
- type AddMetaPartitionRaftMemberRequest
- type AddMultipartPartRequest
- type AdminTask
- func (t *AdminTask) CheckTaskNeedSend() (needRetry bool)
- func (t *AdminTask) CheckTaskTimeOut() (notResponse bool)
- func (t *AdminTask) IsHeartbeatTask() bool
- func (t *AdminTask) IsTaskFailed() (isFail bool)
- func (t *AdminTask) IsTaskSuccessful() (isSuccess bool)
- func (t *AdminTask) IsUrgentTask() bool
- func (t *AdminTask) SetStatus(status int8)
- func (t *AdminTask) ToString() (msg string)
- type AppendExtentKeyRequest
- type AppendExtentKeyWithCheckRequest
- type AppendExtentKeysRequest
- type AppendObjExtentKeysRequest
- type AuthAPIAccessReq
- type AuthAPIAccessResp
- type AuthGetTicketReq
- type AuthGetTicketResp
- type AuthOSAccessKeyReq
- type AuthOSAccessKeyResp
- type AuthRaftNodeInfo
- type AuthRaftNodeReq
- type AuthRaftNodeResp
- type BadPartitionView
- type BatchDeleteDentryRequest
- type BatchDeleteDentryResponse
- type BatchEvictInodeRequest
- type BatchGetXAttrRequest
- type BatchGetXAttrResponse
- type BatchInodeGetRequest
- type BatchInodeGetResponse
- type BatchUnlinkInodeRequest
- type BatchUnlinkInodeResponse
- type Blob
- type ClearInodeCacheRequest
- type ClearInodeCacheResponse
- type ClusterInfo
- type ClusterStatInfo
- type ClusterView
- type CreateDataPartitionRequest
- type CreateDataPartitionResponse
- type CreateDentryRequest
- type CreateInodeRequest
- type CreateInodeResponse
- type CreateMetaPartitionRequest
- type CreateMetaPartitionResponse
- type CreateMultipartRequest
- type CreateMultipartResponse
- type CreateNameSpaceRequest
- type CreateNameSpaceResponse
- type DataNodeHeartbeatResponse
- type DataNodeInfo
- type DataPartitionDecommissionRequest
- type DataPartitionDiagnosis
- type DataPartitionInfo
- type DataPartitionResponse
- type DataPartitionsView
- type DataReplica
- type DelExtentKeyRequest
- type DeleteDataPartitionRequest
- type DeleteDataPartitionResponse
- type DeleteDentryRequest
- type DeleteDentryResponse
- type DeleteFileRequest
- type DeleteFileResponse
- type DeleteInodeBatchRequest
- type DeleteInodeRequest
- type DeleteMetaPartitionRequest
- type DeleteMetaPartitionResponse
- type Dentry
- type DomainNodeSetGrpInfoList
- type EmptyExtentKeyRequest
- type EvictInodeRequest
- type ExtentKey
- func (k *ExtentKey) CheckSum() uint32
- func (k *ExtentKey) Copy() btree.Item
- func (k *ExtentKey) GetExtentKey() (m string)
- func (k *ExtentKey) Less(than btree.Item) bool
- func (k *ExtentKey) Marshal() (m string)
- func (k *ExtentKey) MarshalBinary() ([]byte, error)
- func (k *ExtentKey) MarshalBinaryWithCheckSum() ([]byte, error)
- func (k ExtentKey) String() string
- func (k *ExtentKey) UnMarshal(m string) (err error)
- func (k *ExtentKey) UnmarshalBinary(buf *bytes.Buffer) (err error)
- func (k *ExtentKey) UnmarshalBinaryWithCheckSum(buf *bytes.Buffer) (err error)
- type File
- type FileInCore
- type FileMetadata
- type GeneralResp
- type GetExtentsRequest
- type GetExtentsResponse
- type GetMultipartRequest
- type GetMultipartResponse
- type GetObjExtentsResponse
- type GetXAttrRequest
- type GetXAttrResponse
- type HTTPAuthReply
- type HTTPReply
- type HeartBeatRequest
- type InodeGetRequest
- type InodeGetResponse
- type InodeInfo
- type LinkInodeRequest
- type LinkInodeResponse
- type ListMultipartRequest
- type ListMultipartResponse
- type ListXAttrRequest
- type ListXAttrResponse
- type LoadDataPartitionRequest
- type LoadDataPartitionResponse
- type LoadMetaPartitionMetricRequest
- type LoadMetaPartitionMetricResponse
- type LookupRequest
- type LookupResponse
- type MasterAPIAccessResp
- type MetaNodeHeartbeatResponse
- type MetaNodeInfo
- type MetaPartitionDecommissionRequest
- type MetaPartitionDecommissionResponse
- type MetaPartitionDiagnosis
- type MetaPartitionInfo
- type MetaPartitionLoadRequest
- type MetaPartitionLoadResponse
- type MetaPartitionReport
- type MetaPartitionView
- type MetaReplicaInfo
- type MountOption
- type MountOptions
- type MsgType
- type MultipartInfo
- type MultipartPartInfo
- type NodeSetInfo
- type NodeSetView
- type NodeStatInfo
- type NodeView
- type Nonce
- type OSSSecure
- type ObjExtentKey
- func (k *ObjExtentKey) Copy() btree.Item
- func (k *ObjExtentKey) IsEquals(obj *ObjExtentKey) bool
- func (k *ObjExtentKey) Less(than btree.Item) bool
- func (k *ObjExtentKey) MarshalBinary() ([]byte, error)
- func (k ObjExtentKey) String() string
- func (k *ObjExtentKey) UnmarshalBinary(buf *bytes.Buffer) (err error)
- type Packet
- func (p *Packet) AddMesgLog(m string)
- func (p *Packet) GetOpMsg() (m string)
- func (p *Packet) GetOpMsgWithReqAndResult() (m string)
- func (p *Packet) GetReqID() int64
- func (p *Packet) GetResultMsg() (m string)
- func (p *Packet) GetStoreType() (m string)
- func (p *Packet) GetUniqueLogId() (m string)
- func (p *Packet) IsBatchDeleteExtents() bool
- func (p *Packet) IsForwardPkt() bool
- func (p *Packet) LogMessage(action, remote string, start int64, err error) (m string)
- func (p *Packet) MarshalData(v interface{}) error
- func (p *Packet) MarshalHeader(out []byte)
- func (p *Packet) PacketErrorWithBody(code uint8, reply []byte)
- func (p *Packet) PacketOkReply()
- func (p *Packet) PacketOkWithBody(reply []byte)
- func (p *Packet) ReadFromConn(c net.Conn, timeoutSec int) (err error)
- func (p *Packet) SetPacketHasPrepare()
- func (p *Packet) SetPacketRePrepare()
- func (p *Packet) ShouldRetry() bool
- func (p *Packet) String() string
- func (p *Packet) UnmarshalData(v interface{}) error
- func (p *Packet) UnmarshalHeader(in []byte) error
- func (p *Packet) WriteToConn(c net.Conn) (err error)
- func (p *Packet) WriteToNoDeadLineConn(c net.Conn) (err error)
- type PartitionReport
- type Peer
- type Permission
- type ReadDirLimitRequest
- type ReadDirLimitResponse
- type ReadDirOnlyRequest
- type ReadDirOnlyResponse
- type ReadDirRequest
- type ReadDirResponse
- type RegisterMetaNodeResp
- type RemoveDataPartitionRaftMemberRequest
- type RemoveMetaPartitionRaftMemberRequest
- type RemoveMultipartRequest
- type RemoveXAttrRequest
- type ServiceID
- type SetAttrRequest
- type SetXAttrRequest
- type SimpleNodeSetGrpInfo
- type SimpleNodeSetGrpInfoList
- type SimpleVolView
- type TinyExtentDeleteRecord
- type TopologyView
- type TruncateRequest
- type UnlinkInodeRequest
- type UnlinkInodeResponse
- type UpdateDentryRequest
- type UpdateDentryResponse
- type UpdateMetaPartitionRequest
- type UpdateMetaPartitionResponse
- type UpdateXAttrRequest
- type UserCreateParam
- type UserInfo
- type UserPermRemoveParam
- type UserPermUpdateParam
- type UserPolicy
- func (policy *UserPolicy) Add(addPolicy *UserPolicy)
- func (policy *UserPolicy) AddAuthorizedVol(volume string, policies []string)
- func (policy *UserPolicy) AddOwnVol(volume string)
- func (policy *UserPolicy) Delete(deletePolicy *UserPolicy)
- func (policy *UserPolicy) IsAuthorized(volume, subdir string, action Action) bool
- func (policy *UserPolicy) IsOwn(volume string) bool
- func (policy *UserPolicy) RemoveAuthorizedVol(volume string)
- func (policy *UserPolicy) RemoveOwnVol(volume string)
- func (policy *UserPolicy) SetActions(volume string, actions Actions)
- func (policy *UserPolicy) SetPerm(volume string, perm Permission)
- type UserTransferVolParam
- type UserType
- type UserUpdateParam
- type VolInfo
- type VolStatInfo
- type VolUser
- type VolView
- type XAttrInfo
- type ZoneNodesStat
- type ZoneStat
- type ZoneView
Constants ¶
const ( // Admin APIs AdminGetCluster = "/admin/getCluster" AdminGetDataPartition = "/dataPartition/get" AdminLoadDataPartition = "/dataPartition/load" AdminCreateDataPartition = "/dataPartition/create" AdminCreatePreLoadDataPartition = "/dataPartition/createPreLoad" AdminDecommissionDataPartition = "/dataPartition/decommission" AdminDiagnoseDataPartition = "/dataPartition/diagnose" AdminDeleteDataReplica = "/dataReplica/delete" AdminAddDataReplica = "/dataReplica/add" AdminDeleteVol = "/vol/delete" AdminUpdateVol = "/vol/update" AdminVolShrink = "/vol/shrink" AdminVolExpand = "/vol/expand" AdminCreateVol = "/admin/createVol" AdminGetVol = "/admin/getVol" AdminClusterFreeze = "/cluster/freeze" AdminClusterStat = "/cluster/stat" AdminGetIP = "/admin/getIp" AdminCreateMetaPartition = "/metaPartition/create" AdminSetMetaNodeThreshold = "/threshold/set" AdminListVols = "/vol/list" AdminSetNodeInfo = "/admin/setNodeInfo" AdminGetNodeInfo = "/admin/getNodeInfo" AdminDomainCreate = "/admin/createDomain" AdminGetAllNodeSetGrpInfo = "/admin/getDomainInfo" AdminGetNodeSetGrpInfo = "/admin/getDomainNodeSetGrpInfo" AdminGetIsDomainOn = "/admin/getIsDomainOn" AdminUpdateNodeSetCapcity = "/admin/updateNodeSetCapcity" AdminUpdateNodeSetId = "/admin/updateNodeSetId" AdminUpdateDomainDataUseRatio = "/admin/updateDomainDataRatio" AdminUpdateZoneExcludeRatio = "/admin/updateZoneExcludeRatio" //graphql master api AdminClusterAPI = "/api/cluster" AdminUserAPI = "/api/user" AdminVolumeAPI = "/api/volume" //graphql coonsole api ConsoleIQL = "/iql" ConsoleLoginAPI = "/login" ConsoleMonitorAPI = "/cfs_monitor" ConsoleFile = "/file" ConsoleFileDown = "/file/down" ConsoleFileUpload = "/file/upload" // Client APIs ClientDataPartitions = "/client/partitions" ClientVol = "/client/vol" ClientMetaPartition = "/metaPartition/get" ClientVolStat = "/client/volStat" ClientMetaPartitions = "/client/metaPartitions" //raft node APIs AddRaftNode = "/raftNode/add" RemoveRaftNode = "/raftNode/remove" RaftStatus = "/get/raftStatus" // Node APIs AddDataNode = "/dataNode/add" DecommissionDataNode = "/dataNode/decommission" DecommissionDisk = "/disk/decommission" GetDataNode = "/dataNode/get" AddMetaNode = "/metaNode/add" DecommissionMetaNode = "/metaNode/decommission" GetMetaNode = "/metaNode/get" AdminUpdateMetaNode = "/metaNode/update" AdminUpdateDataNode = "/dataNode/update" AdminGetInvalidNodes = "/invalid/nodes" AdminLoadMetaPartition = "/metaPartition/load" AdminDiagnoseMetaPartition = "/metaPartition/diagnose" AdminDecommissionMetaPartition = "/metaPartition/decommission" AdminAddMetaReplica = "/metaReplica/add" AdminDeleteMetaReplica = "/metaReplica/delete" // Operation response GetMetaNodeTaskResponse = "/metaNode/response" // Method: 'POST', ContentType: 'application/json' GetDataNodeTaskResponse = "/dataNode/response" // Method: 'POST', ContentType: 'application/json' GetTopologyView = "/topo/get" UpdateZone = "/zone/update" GetAllZones = "/zone/list" // Header keys SkipOwnerValidation = "Skip-Owner-Validation" ForceDelete = "Force-Delete" // APIs for user management UserCreate = "/user/create" UserDelete = "/user/delete" UserUpdate = "/user/update" UserUpdatePolicy = "/user/updatePolicy" UserRemovePolicy = "/user/removePolicy" UserDeleteVolPolicy = "/user/deleteVolPolicy" UserGetInfo = "/user/info" UserGetAKInfo = "/user/akInfo" UserTransferVol = "/user/transferVol" UserList = "/user/list" UsersOfVol = "/vol/users" //graphql api for header HeadAuthorized = "Authorization" ParamAuthorized = "_authorization" UserKey = "_user_key" UserInfoKey = "_user_info_key" )
api
const ( PartitionTypeNormal = 0 PartitionTypeCache = 1 PartitionTypePreLoad = 2 )
const ( VolumeTypeHot = 0 VolumeTypeCold = 1 )
const ( NoCache = 0 RCache = 1 RWCache = 2 )
const ( TaskFailed = 2 TaskStart = 0 TaskSucceeds = 1 TaskRunning = 3 ResponseInterval = 5 ResponseTimeOut = 100 MaxSendCount = 5 )
const ( APIRsc = "API" APIAccess = "access" ClientMessage = "Token" OwnerVOLRsc = "OwnerVOL" NoneOwnerVOLRsc = "NoneOwnerVOL" VOLAccess = "*" )
const ( // Client APIs ClientGetTicket = "/client/getticket" // Admin APIs AdminCreateKey = "/admin/createkey" AdminDeleteKey = "/admin/deletekey" AdminGetKey = "/admin/getkey" AdminAddCaps = "/admin/addcaps" AdminDeleteCaps = "/admin/deletecaps" AdminGetCaps = "/admin/getcaps" //raft node APIs AdminAddRaftNode = "/admin/addraftnode" AdminRemoveRaftNode = "/admin/removeraftnode" // Object node APIs OSAddCaps = "/os/addcaps" OSDeleteCaps = "/os/deletecaps" OSGetCaps = "/os/getcaps" )
api
const ( // AuthServiceID defines ticket for authnode access (not supported) AuthServiceID = "AuthService" // MasterServiceID defines ticket for master access MasterServiceID = "MasterService" // MetaServiceID defines ticket for metanode access (not supported) MetaServiceID = "MetanodeService" // DataServiceID defines ticket for datanode access (not supported) DataServiceID = "DatanodeService" //ObjectServiceID defines ticket for objectnode access ObjectServiceID = "ObjectService" )
const ( MasterNode = "master" MetaNode = "metanode" DataNode = "datanode" )
const ( ErrCodeSuccess = iota ErrCodeInternalError ErrCodeParamError ErrCodeInvalidCfg ErrCodePersistenceByRaft ErrCodeMarshalData ErrCodeUnmarshalData ErrCodeVolNotExists ErrCodeMetaPartitionNotExists ErrCodeDataPartitionNotExists ErrCodeDataNodeNotExists ErrCodeMetaNodeNotExists ErrCodeDuplicateVol ErrCodeActiveDataNodesTooLess ErrCodeActiveMetaNodesTooLess ErrCodeInvalidMpStart ErrCodeNoAvailDataPartition ErrCodeReshuffleArray ErrCodeIllegalDataReplica ErrCodeMissingReplica ErrCodeHasOneMissingReplica ErrCodeNoDataNodeToWrite ErrCodeNoMetaNodeToWrite ErrCodeCannotBeOffLine ErrCodeNoDataNodeToCreateDataPartition ErrCodeNoZoneToCreateDataPartition ErrCodeNoNodeSetToCreateDataPartition ErrCodeNoNodeSetToCreateMetaPartition ErrCodeNoMetaNodeToCreateMetaPartition ErrCodeIllegalMetaReplica ErrCodeNoEnoughReplica ErrCodeNoLeader ErrCodeVolAuthKeyNotMatch ErrCodeAuthKeyStoreError ErrCodeAuthAPIAccessGenRespError ErrCodeAuthRaftNodeGenRespError ErrCodeAuthOSCapsOpGenRespError ErrCodeAuthReqRedirectError ErrCodeAccessKeyNotExists ErrCodeInvalidTicket ErrCodeExpiredTicket ErrCodeMasterAPIGenRespError ErrCodeDuplicateUserID ErrCodeUserNotExists ErrCodeReadBodyError ErrCodeVolPolicyNotExists ErrCodeDuplicateAccessKey ErrCodeHaveNoPolicy ErrCodeNoZoneToCreateMetaPartition ErrCodeZoneNotExists ErrCodeOwnVolExists ErrCodeSuperAdminExists ErrCodeInvalidUserID ErrCodeInvalidUserType ErrCodeNoPermission ErrCodeTokenNotExist ErrCodeInvalidAccessKey ErrCodeInvalidSecretKey ErrCodeIsOwner ErrCodeZoneNumError )
http response error code and error message definitions
const ( FlagsSyncWrite int = 1 << iota FlagsAppend )
const ( AttrMode uint32 = 1 << iota AttrUid AttrGid AttrModifyTime AttrAccessTime )
const ( // Mandatory MountPoint int = iota VolName Owner Master // Optional LogDir WarnLogDir LogLevel ProfPort IcacheTimeout LookupValid AttrValid ReadRate WriteRate EnSyncWrite AutoInvalData Rdonly WriteCache KeepCache FollowerRead Authenticate ClientKey TicketHost EnableHTTPS CertFile TokenKey AccessKey SecretKey DisableDcache SubDir FsyncOnClose MaxCPUs EnableXattr NearRead EnablePosixACL //adls VolType EbsEndpoint EbsServerPath CacheAction EbsBlockSize EnableBcache ReadThreads WriteThreads EnableSummary MaxMountOption )
For client
const ( MasterAddr = "masterAddr" ListenPort = "listen" ObjectNodeDomain = "objectNodeDomain" )
For server
const ( ProtoMagic uint8 = 0xFF OpInitResultCode uint8 = 0x00 OpCreateExtent uint8 = 0x01 OpMarkDelete uint8 = 0x02 OpWrite uint8 = 0x03 OpRead uint8 = 0x04 OpStreamRead uint8 = 0x05 OpStreamFollowerRead uint8 = 0x06 OpGetAllWatermarks uint8 = 0x07 OpNotifyReplicasToRepair uint8 = 0x08 OpExtentRepairRead uint8 = 0x09 OpBroadcastMinAppliedID uint8 = 0x0A OpRandomWrite uint8 = 0x0F OpGetAppliedId uint8 = 0x10 OpGetPartitionSize uint8 = 0x11 OpSyncRandomWrite uint8 = 0x12 OpSyncWrite uint8 = 0x13 OpReadTinyDeleteRecord uint8 = 0x14 OpTinyExtentRepairRead uint8 = 0x15 OpGetMaxExtentIDAndPartitionSize uint8 = 0x16 // Operations: Client -> MetaNode. OpMetaCreateInode uint8 = 0x20 OpMetaUnlinkInode uint8 = 0x21 OpMetaCreateDentry uint8 = 0x22 OpMetaDeleteDentry uint8 = 0x23 OpMetaOpen uint8 = 0x24 OpMetaLookup uint8 = 0x25 OpMetaReadDir uint8 = 0x26 OpMetaInodeGet uint8 = 0x27 OpMetaBatchInodeGet uint8 = 0x28 OpMetaExtentsAdd uint8 = 0x29 OpMetaExtentsDel uint8 = 0x2A OpMetaExtentsList uint8 = 0x2B OpMetaUpdateDentry uint8 = 0x2C OpMetaTruncate uint8 = 0x2D OpMetaLinkInode uint8 = 0x2E OpMetaEvictInode uint8 = 0x2F OpMetaSetattr uint8 = 0x30 OpMetaReleaseOpen uint8 = 0x31 //Operations: MetaNode Leader -> MetaNode Follower OpMetaFreeInodesOnRaftFollower uint8 = 0x32 OpMetaDeleteInode uint8 = 0x33 // delete specified inode immediately and do not remove data. OpMetaBatchExtentsAdd uint8 = 0x34 // for extents batch attachment OpMetaSetXAttr uint8 = 0x35 OpMetaGetXAttr uint8 = 0x36 OpMetaRemoveXAttr uint8 = 0x37 OpMetaListXAttr uint8 = 0x38 OpMetaBatchGetXAttr uint8 = 0x39 OpMetaExtentAddWithCheck uint8 = 0x3A // Append extent key with discard extents check OpMetaReadDirLimit uint8 = 0x3D // Operations: Master -> MetaNode OpCreateMetaPartition uint8 = 0x40 OpMetaNodeHeartbeat uint8 = 0x41 OpDeleteMetaPartition uint8 = 0x42 OpUpdateMetaPartition uint8 = 0x43 OpLoadMetaPartition uint8 = 0x44 OpDecommissionMetaPartition uint8 = 0x45 OpAddMetaPartitionRaftMember uint8 = 0x46 OpRemoveMetaPartitionRaftMember uint8 = 0x47 OpMetaPartitionTryToLeader uint8 = 0x48 // Operations: Master -> DataNode OpCreateDataPartition uint8 = 0x60 OpDeleteDataPartition uint8 = 0x61 OpLoadDataPartition uint8 = 0x62 OpDataNodeHeartbeat uint8 = 0x63 OpReplicateFile uint8 = 0x64 OpDeleteFile uint8 = 0x65 OpDecommissionDataPartition uint8 = 0x66 OpAddDataPartitionRaftMember uint8 = 0x67 OpRemoveDataPartitionRaftMember uint8 = 0x68 OpDataPartitionTryToLeader uint8 = 0x69 // Operations: MultipartInfo OpCreateMultipart uint8 = 0x70 OpGetMultipart uint8 = 0x71 OpAddMultipartPart uint8 = 0x72 OpRemoveMultipart uint8 = 0x73 OpListMultiparts uint8 = 0x74 OpBatchDeleteExtent uint8 = 0x75 // SDK to MetaNode //Operations: MetaNode Leader -> MetaNode Follower OpMetaBatchDeleteInode uint8 = 0x90 OpMetaBatchDeleteDentry uint8 = 0x91 OpMetaBatchUnlinkInode uint8 = 0x92 OpMetaBatchEvictInode uint8 = 0x93 // Commons OpConflictExtentsErr uint8 = 0xF2 OpIntraGroupNetErr uint8 = 0xF3 OpArgMismatchErr uint8 = 0xF4 OpNotExistErr uint8 = 0xF5 OpDiskNoSpaceErr uint8 = 0xF6 OpDiskErr uint8 = 0xF7 OpErr uint8 = 0xF8 OpAgain uint8 = 0xF9 OpExistErr uint8 = 0xFA OpInodeFullErr uint8 = 0xFB OpTryOtherAddr uint8 = 0xFC OpNotPerm uint8 = 0xFD OpNotEmtpy uint8 = 0xFE OpOk uint8 = 0xF0 OpPing uint8 = 0xFF OpMetaUpdateXAttr uint8 = 0x3B OpMetaReadDirOnly uint8 = 0x3C // ebs obj meta OpMetaObjExtentAdd uint8 = 0xDD OpMetaObjExtentsList uint8 = 0xDE OpMetaExtentsEmpty uint8 = 0xDF OpMetaBatchObjExtentsAdd uint8 = 0xD0 OpMetaClearInodeCache uint8 = 0xD1 )
Operations
const ( WriteDeadlineTime = 5 ReadDeadlineTime = 5 SyncSendTaskDeadlineTime = 20 NoReadDeadlineTime = -1 BatchDeleteExtentReadDeadLineTime = 120 GetAllWatermarksDeadLineTime = 60 DefaultClusterLoadFactor float64 = 10 )
const ( TinyExtentType = 0 NormalExtentType = 1 )
const ( NormalCreateDataPartition = 0 DecommissionedCreateDataPartition = 1 )
const ( ReadOnly = 1 ReadWrite = 2 )
The following defines the status of a disk or a partition.
const (
AddrSplit = "/"
)
const (
DefaultZoneName = "default"
)
const (
LFClient = 1 // low frequency client
)
const (
RootIno = uint64(1)
)
const TimeFormat = "2006-01-02 15:04:05"
Variables ¶
var ( ErrSuc = errors.New("success") ErrInternalError = errors.New("internal error") ErrParamError = errors.New("parameter error") ErrInvalidCfg = errors.New("bad configuration file") ErrPersistenceByRaft = errors.New("persistence by raft occurred error") ErrMarshalData = errors.New("marshal data error") ErrUnmarshalData = errors.New("unmarshal data error") ErrVolNotExists = errors.New("vol not exists") ErrMetaPartitionNotExists = errors.New("meta partition not exists") ErrDataPartitionNotExists = errors.New("data partition not exists") ErrDataNodeNotExists = errors.New("data node not exists") ErrMetaNodeNotExists = errors.New("meta node not exists") ErrDuplicateVol = errors.New("duplicate vol") ErrActiveDataNodesTooLess = errors.New("no enough active data node") ErrActiveMetaNodesTooLess = errors.New("no enough active meta node") ErrInvalidMpStart = errors.New("invalid meta partition start value") ErrNoAvailDataPartition = errors.New("no available data partition") ErrReshuffleArray = errors.New("the array to be reshuffled is nil") ErrIllegalDataReplica = errors.New("data replica is illegal") ErrMissingReplica = errors.New("a missing data replica is found") ErrHasOneMissingReplica = errors.New("there is a missing replica") ErrNoDataNodeToWrite = errors.New("No data node available for creating a data partition") ErrNoMetaNodeToWrite = errors.New("No meta node available for creating a meta partition") ErrCannotBeOffLine = errors.New("cannot take the data replica offline") ErrNoDataNodeToCreateDataPartition = errors.New("no enough data nodes for creating a data partition") ErrNoZoneToCreateDataPartition = errors.New("no zone available for creating a data partition") ErrNoZoneToCreateMetaPartition = errors.New("no zone available for creating a meta partition") ErrNoNodeSetToCreateDataPartition = errors.New("no node set available for creating a data partition") ErrNoNodeSetToCreateMetaPartition = errors.New("no node set available for creating a meta partition") ErrNoMetaNodeToCreateMetaPartition = errors.New("no enough meta nodes for creating a meta partition") ErrIllegalMetaReplica = errors.New("illegal meta replica") ErrNoEnoughReplica = errors.New("no enough replicas") ErrNoLeader = errors.New("no leader") ErrVolAuthKeyNotMatch = errors.New("client and server auth key do not match") ErrAuthKeyStoreError = errors.New("auth keystore error") ErrAuthAPIAccessGenRespError = errors.New("auth API access response error") ErrAuthOSCapsOpGenRespError = errors.New("auth Object Storage Node API response error") ErrKeyNotExists = errors.New("key not exists") ErrDuplicateKey = errors.New("duplicate key") ErrAccessKeyNotExists = errors.New("access key not exists") ErrInvalidTicket = errors.New("invalid ticket") ErrExpiredTicket = errors.New("expired ticket") ErrMasterAPIGenRespError = errors.New("master API generate response error") ErrDuplicateUserID = errors.New("duplicate user id") ErrUserNotExists = errors.New("user not exists") ErrReadBodyError = errors.New("read request body failed") ErrVolPolicyNotExists = errors.New("vol policy not exists") ErrDuplicateAccessKey = errors.New("duplicate access key") ErrHaveNoPolicy = errors.New("no vol policy") ErrZoneNotExists = errors.New("zone not exists") ErrOwnVolExists = errors.New("own vols not empty") ErrSuperAdminExists = errors.New("super administrator exists ") ErrInvalidUserID = errors.New("invalid user ID") ErrInvalidUserType = errors.New("invalid user type") ErrNoPermission = errors.New("no permission") ErrTokenNotFound = errors.New("token not found") ErrInvalidAccessKey = errors.New("invalid access key") ErrInvalidSecretKey = errors.New("invalid secret key") ErrIsOwner = errors.New("user owns the volume") ErrZoneNum = errors.New("zone num not qualified") )
err
var ( ExtentKeyHeader = []byte("EKV2") ExtentKeyHeaderSize = len(ExtentKeyHeader) ExtentLength = 40 ExtentKeyChecksumSize = 4 ExtentV2Length = ExtentKeyHeaderSize + ExtentLength + ExtentKeyChecksumSize InvalidKey = errors.New("invalid key error") InvalidKeyHeader = errors.New("invalid extent v2 key header error") InvalidKeyCheckSum = errors.New("invalid extent v2 key checksum error") )
var ( GRequestID = int64(1) Buffers = buf.NewBufferPool() )
var ( AKRegexp = regexp.MustCompile("^[a-zA-Z0-9]{16}$") SKRegexp = regexp.MustCompile("^[a-zA-Z0-9]{32}$") )
var ( Version string CommitID string BranchName string BuildTime string )
var ( AllActions = []Action{ OSSGetObjectAction, OSSPutObjectAction, OSSCopyObjectAction, OSSListObjectsAction, OSSDeleteObjectAction, OSSDeleteObjectsAction, OSSHeadObjectAction, OSSCreateBucketAction, OSSDeleteBucketAction, OSSHeadBucketAction, OSSListBucketsAction, OSSGetBucketPolicyAction, OSSPutBucketPolicyAction, OSSDeleteBucketPolicyAction, OSSGetBucketPolicyStatusAction, OSSGetBucketAclAction, OSSPutBucketAclAction, OSSGetObjectTorrentAction, OSSGetObjectAclAction, OSSPutObjectAclAction, OSSCreateMultipartUploadAction, OSSListMultipartUploadsAction, OSSUploadPartAction, OSSUploadPartCopyAction, OSSListPartsAction, OSSCompleteMultipartUploadAction, OSSAbortMultipartUploadAction, OSSGetBucketLocationAction, OSSGetObjectXAttrAction, OSSPutObjectXAttrAction, OSSListObjectXAttrsAction, OSSDeleteObjectXAttrAction, OSSGetObjectTaggingAction, OSSPutObjectTaggingAction, OSSDeleteObjectTaggingAction, OSSGetBucketTaggingAction, OSSPutBucketTaggingAction, OSSDeleteBucketTaggingAction, OSSGetBucketLifecycleAction, OSSPutBucketLifecycleAction, OSSDeleteBucketLifecycleAction, OSSGetBucketVersioningAction, OSSPutBucketVersioningAction, OSSListObjectVersionsAction, OSSGetObjectLegalHoldAction, OSSPutObjectLegalHoldAction, OSSGetObjectRetentionAction, OSSPutObjectRetentionAction, OSSGetBucketEncryptionAction, OSSPutBucketEncryptionAction, OSSDeleteBucketEncryptionAction, OSSGetBucketCorsAction, OSSPutBucketCorsAction, OSSDeleteBucketCorsAction, OSSGetBucketWebsiteAction, OSSPutBucketWebsiteAction, OSSDeleteBucketWebsiteAction, OSSRestoreObjectAction, OSSGetPublicAccessBlockAction, OSSPutPublicAccessBlockAction, OSSDeletePublicAccessBlockAction, OSSGetBucketRequestPaymentAction, OSSPutBucketRequestPaymentAction, OSSGetBucketReplicationAction, OSSPutBucketReplicationAction, OSSDeleteBucketReplicationAction, OSSOptionsObjectAction, POSIXReadAction, POSIXWriteAction, } )
var Err2CodeMap = map[error]int32{ ErrSuc: ErrCodeSuccess, ErrInternalError: ErrCodeInternalError, ErrParamError: ErrCodeParamError, ErrInvalidCfg: ErrCodeInvalidCfg, ErrPersistenceByRaft: ErrCodePersistenceByRaft, ErrMarshalData: ErrCodeMarshalData, ErrUnmarshalData: ErrCodeUnmarshalData, ErrVolNotExists: ErrCodeVolNotExists, ErrMetaPartitionNotExists: ErrCodeMetaPartitionNotExists, ErrDataPartitionNotExists: ErrCodeDataPartitionNotExists, ErrDataNodeNotExists: ErrCodeDataNodeNotExists, ErrMetaNodeNotExists: ErrCodeMetaNodeNotExists, ErrDuplicateVol: ErrCodeDuplicateVol, ErrActiveDataNodesTooLess: ErrCodeActiveDataNodesTooLess, ErrActiveMetaNodesTooLess: ErrCodeActiveMetaNodesTooLess, ErrInvalidMpStart: ErrCodeInvalidMpStart, ErrNoAvailDataPartition: ErrCodeNoAvailDataPartition, ErrReshuffleArray: ErrCodeReshuffleArray, ErrIllegalDataReplica: ErrCodeIllegalDataReplica, ErrMissingReplica: ErrCodeMissingReplica, ErrHasOneMissingReplica: ErrCodeHasOneMissingReplica, ErrNoDataNodeToWrite: ErrCodeNoDataNodeToWrite, ErrNoMetaNodeToWrite: ErrCodeNoMetaNodeToWrite, ErrCannotBeOffLine: ErrCodeCannotBeOffLine, ErrNoDataNodeToCreateDataPartition: ErrCodeNoDataNodeToCreateDataPartition, ErrNoZoneToCreateDataPartition: ErrCodeNoZoneToCreateDataPartition, ErrNoZoneToCreateMetaPartition: ErrCodeNoZoneToCreateMetaPartition, ErrNoNodeSetToCreateDataPartition: ErrCodeNoNodeSetToCreateDataPartition, ErrNoNodeSetToCreateMetaPartition: ErrCodeNoNodeSetToCreateMetaPartition, ErrNoMetaNodeToCreateMetaPartition: ErrCodeNoMetaNodeToCreateMetaPartition, ErrIllegalMetaReplica: ErrCodeIllegalMetaReplica, ErrNoEnoughReplica: ErrCodeNoEnoughReplica, ErrNoLeader: ErrCodeNoLeader, ErrVolAuthKeyNotMatch: ErrCodeVolAuthKeyNotMatch, ErrAuthKeyStoreError: ErrCodeAuthKeyStoreError, ErrAuthAPIAccessGenRespError: ErrCodeAuthAPIAccessGenRespError, ErrAuthOSCapsOpGenRespError: ErrCodeAuthOSCapsOpGenRespError, ErrAccessKeyNotExists: ErrCodeAccessKeyNotExists, ErrInvalidTicket: ErrCodeInvalidTicket, ErrExpiredTicket: ErrCodeExpiredTicket, ErrMasterAPIGenRespError: ErrCodeMasterAPIGenRespError, ErrDuplicateUserID: ErrCodeDuplicateUserID, ErrUserNotExists: ErrCodeUserNotExists, ErrReadBodyError: ErrCodeReadBodyError, ErrVolPolicyNotExists: ErrCodeVolPolicyNotExists, ErrDuplicateAccessKey: ErrCodeDuplicateAccessKey, ErrHaveNoPolicy: ErrCodeHaveNoPolicy, ErrZoneNotExists: ErrCodeZoneNotExists, ErrOwnVolExists: ErrCodeOwnVolExists, ErrSuperAdminExists: ErrCodeSuperAdminExists, ErrInvalidUserID: ErrCodeInvalidUserID, ErrInvalidUserType: ErrCodeInvalidUserType, ErrNoPermission: ErrCodeNoPermission, ErrTokenNotFound: ErrCodeTokenNotExist, ErrInvalidAccessKey: ErrCodeInvalidAccessKey, ErrInvalidSecretKey: ErrCodeInvalidSecretKey, ErrIsOwner: ErrCodeIsOwner, ErrZoneNum: ErrCodeZoneNumError, }
Err2CodeMap error map to code
var MsgType2ResourceMap = map[MsgType]string{ MsgAuthCreateKeyReq: "auth:createkey", MsgAuthDeleteKeyReq: "auth:deletekey", MsgAuthGetKeyReq: "auth:getkey", MsgAuthAddCapsReq: "auth:addcaps", MsgAuthDeleteCapsReq: "auth:deletecaps", MsgAuthGetCapsReq: "auth:getcaps", MsgAuthAddRaftNodeReq: "auth:addnode", MsgAuthRemoveRaftNodeReq: "auth:removenode", MsgAuthOSAddCapsReq: "auth:osaddcaps", MsgAuthOSDeleteCapsReq: "auth:osdeletecaps", MsgAuthOSGetCapsReq: "auth:osgetcaps", MsgMasterFetchVolViewReq: "master:getvol", }
MsgType2ResourceMap define the mapping from message type to resource
Functions ¶
func CheckAPIAccessCaps ¶ added in v1.5.0
func CheckAPIAccessCaps(ticket *cryptoutil.Ticket, rscType string, mp MsgType, action string) (err error)
CheckAPIAccessCaps checks capability
func CheckVOLAccessCaps ¶ added in v1.5.0
func DumpVersion ¶
func ExtractAPIAccessTicket ¶ added in v1.5.0
func ExtractAPIAccessTicket(req *APIAccessReq, key []byte) (ticket cryptoutil.Ticket, ts int64, err error)
ExtractAPIAccessTicket verify ticket validity
func ExtractTicket ¶ added in v1.5.0
func ExtractTicket(str string, key []byte) (ticket cryptoutil.Ticket, err error)
func GetDataFromResp ¶ added in v1.5.0
GetDataFromResp extract data from response
func InitMountOptions ¶
func InitMountOptions(opts []MountOption)
func IsNormalDp ¶
func IsPreLoadDp ¶
func IsValidClientID ¶ added in v1.5.0
IsValidClientID determine the validity of a clientID
func IsValidMsgReqType ¶ added in v1.5.0
IsValidMsgReqType determine the validity of a message type
func IsValidServiceID ¶ added in v1.5.0
IsValidServiceID determine the validity of a serviceID
func OsModeType ¶
Returns os.FileMode masked by os.ModeType
func ParseErrorCode ¶
func ParseMountOptions ¶
func ParseMountOptions(opts []MountOption, cfg *config.Config)
func ParseVerifier ¶ added in v1.5.0
ParseVerifier checks the verifier structure for replay attack mitigation
func VerifyAPIAccessReqIDs ¶ added in v1.5.0
func VerifyAPIAccessReqIDs(req *APIAccessReq) (err error)
VerifyAPIAccessReqIDs verify the req IDs
func VerifyAPIRespComm ¶ added in v1.5.0
func VerifyAPIRespComm(apiResp *APIAccessResp, msg MsgType, clientID string, serviceID string, ts int64) (err error)
VerifyAPIRespComm client verifies commond attributes returned from server
func VerifyTicketRespComm ¶ added in v1.5.0
func VerifyTicketRespComm(ticketResp *AuthGetTicketResp, msg MsgType, clientID string, serviceID string, ts int64) (err error)
VerifyTicketRespComm verifies the ticket respose from server
Types ¶
type APIAccessReq ¶ added in v1.5.0
type APIAccessReq struct { Type MsgType `json:"type"` ClientID string `json:"client_id"` ServiceID string `json:"service_id"` Verifier string `json:"verifier"` Ticket string `json:"ticket"` }
APIAccessReq defines the request for access restful api use Timestamp as verifier for MITM mitigation verifier is also used to verify the server identity
type APIAccessResp ¶ added in v1.5.0
type APIAccessResp struct { Type MsgType `json:"type"` ClientID string `json:"client_id"` ServiceID string `json:"service_id"` Verifier int64 `json:"verifier"` }
APIAccessResp defines the response for access restful api use Timestamp as verifier for MITM mitigation verifier is also used to verify the server identity
type Action ¶
type Action string
const ( ActionPrefix = "action:" OSSActionPrefix = ActionPrefix + "oss:" POSIXActionPrefix = ActionPrefix + "posix:" // Object actions OSSGetObjectAction Action = OSSActionPrefix + "GetObject" OSSPutObjectAction Action = OSSActionPrefix + "PutObject" OSSCopyObjectAction Action = OSSActionPrefix + "CopyObject" OSSListObjectsAction Action = OSSActionPrefix + "ListObjects" OSSDeleteObjectAction Action = OSSActionPrefix + "DeleteObject" OSSDeleteObjectsAction Action = OSSActionPrefix + "DeleteObjects" OSSHeadObjectAction Action = OSSActionPrefix + "HeadObject" // Bucket actions OSSCreateBucketAction Action = OSSActionPrefix + "CreateBucket" OSSDeleteBucketAction Action = OSSActionPrefix + "DeleteBucket" OSSHeadBucketAction Action = OSSActionPrefix + "HeadBucket" OSSListBucketsAction Action = OSSActionPrefix + "ListBuckets" // Bucket policy actions OSSGetBucketPolicyAction Action = OSSActionPrefix + "GetBucketPolicy" OSSPutBucketPolicyAction Action = OSSActionPrefix + "PutBucketPolicy" OSSDeleteBucketPolicyAction Action = OSSActionPrefix + "DeleteBucketPolicy" OSSGetBucketPolicyStatusAction Action = OSSActionPrefix + "GetBucketPolicyStatus" // unsupported // Bucket ACL actions OSSGetBucketAclAction Action = OSSActionPrefix + "GetBucketAcl" OSSPutBucketAclAction Action = OSSActionPrefix + "PutBucketAcl" // Bucket CORS actions OSSGetBucketCorsAction Action = OSSActionPrefix + "GetBucketCors" OSSPutBucketCorsAction Action = OSSActionPrefix + "PutBucketCors" OSSDeleteBucketCorsAction Action = OSSActionPrefix + "DeleteBucketCors" OSSOptionsObjectAction Action = OSSActionPrefix + "OptionsObject" // Object torrent actions OSSGetObjectTorrentAction Action = OSSActionPrefix + "GetObjectTorrent" // unsupported // Object ACL actions OSSGetObjectAclAction Action = OSSActionPrefix + "GetObjectAcl" OSSPutObjectAclAction Action = OSSActionPrefix + "PutObjectAcl" // Multipart actions OSSCreateMultipartUploadAction Action = OSSActionPrefix + "CreateMultipartUpload" OSSListMultipartUploadsAction Action = OSSActionPrefix + "ListMultipartUploads" OSSUploadPartAction Action = OSSActionPrefix + "UploadPart" OSSUploadPartCopyAction Action = OSSActionPrefix + "UploadPartCopy" // unsupported OSSListPartsAction Action = OSSActionPrefix + "ListParts" OSSCompleteMultipartUploadAction Action = OSSActionPrefix + "CompleteMultipartUpload" OSSAbortMultipartUploadAction Action = OSSActionPrefix + "AbortMultipartUpload" // Bucket location OSSGetBucketLocationAction Action = OSSActionPrefix + "GetBucketLocation" // Object extend attributes (xattr) OSSGetObjectXAttrAction Action = OSSActionPrefix + "GetObjectXAttr" OSSPutObjectXAttrAction Action = OSSActionPrefix + "PutObjectXAttr" OSSListObjectXAttrsAction Action = OSSActionPrefix + "ListObjectXAttrs" OSSDeleteObjectXAttrAction Action = OSSActionPrefix + "DeleteObjectXAttr" // Object tagging actions OSSGetObjectTaggingAction Action = OSSActionPrefix + "GetObjectTagging" OSSPutObjectTaggingAction Action = OSSActionPrefix + "PutObjectTagging" OSSDeleteObjectTaggingAction Action = OSSActionPrefix + "DeleteObjectTagging" // Bucket tagging actions OSSGetBucketTaggingAction Action = OSSActionPrefix + "GetBucketTagging" OSSPutBucketTaggingAction Action = OSSActionPrefix + "PutBucketTagging" OSSDeleteBucketTaggingAction Action = OSSActionPrefix + "DeleteBucketTagging" // Bucket lifecycle actions OSSGetBucketLifecycleAction Action = OSSActionPrefix + "GetBucketLifecycle" // unsupported OSSPutBucketLifecycleAction Action = OSSActionPrefix + "PutBucketLifecycle" // unsupported OSSDeleteBucketLifecycleAction Action = OSSActionPrefix + "DeleteBucketLifecycle" // unsupported // Object storage version actions OSSGetBucketVersioningAction Action = OSSActionPrefix + "GetBucketVersioning" // unsupported OSSPutBucketVersioningAction Action = OSSActionPrefix + "PutBucketVersioning" // unsupported OSSListObjectVersionsAction Action = OSSActionPrefix + "ListObjectVersions" // unsupported // Object legal hold actions OSSGetObjectLegalHoldAction Action = OSSActionPrefix + "GetObjectLegalHold" // unsupported OSSPutObjectLegalHoldAction Action = OSSActionPrefix + "PutObjectLegalHold" // unsupported // Object retention actions OSSGetObjectRetentionAction Action = OSSActionPrefix + "GetObjectRetention" // unsupported OSSPutObjectRetentionAction Action = OSSActionPrefix + "PutObjectRetention" // unsupported // Bucket encryption actions OSSGetBucketEncryptionAction Action = OSSActionPrefix + "GetBucketEncryption" // unsupported OSSPutBucketEncryptionAction Action = OSSActionPrefix + "PutBucketEncryption" // unsupported OSSDeleteBucketEncryptionAction Action = OSSActionPrefix + "DeleteBucketEncryption" // unsupported // Bucket website actions OSSGetBucketWebsiteAction Action = OSSActionPrefix + "GetBucketWebsite" // unsupported OSSPutBucketWebsiteAction Action = OSSActionPrefix + "PutBucketWebsite" // unsupported OSSDeleteBucketWebsiteAction Action = OSSActionPrefix + "DeleteBucketWebsite" // unsupported // Object restore actions OSSRestoreObjectAction Action = OSSActionPrefix + "RestoreObject" // unsupported // Public access block actions OSSGetPublicAccessBlockAction Action = OSSActionPrefix + "GetPublicAccessBlock" // unsupported OSSPutPublicAccessBlockAction Action = OSSActionPrefix + "PutPublicAccessBlock" // unsupported OSSDeletePublicAccessBlockAction Action = OSSActionPrefix + "DeletePulicAccessBlock" // unuspported // Bucket request payment actions OSSGetBucketRequestPaymentAction Action = OSSActionPrefix + "GetBucketRequestPayment" // unsupported OSSPutBucketRequestPaymentAction Action = OSSActionPrefix + "PutBucketRequestPayment" // unsupported // Bucket replication actions OSSGetBucketReplicationAction Action = OSSActionPrefix + "GetBucketReplicationAction" // unsupported OSSPutBucketReplicationAction Action = OSSActionPrefix + "PutBucketReplicationAction" // unsupported OSSDeleteBucketReplicationAction Action = OSSActionPrefix + "DeleteBucketReplicationAction" // unsupported // constants for POSIX file system interface POSIXReadAction Action = POSIXActionPrefix + "Read" POSIXWriteAction Action = POSIXActionPrefix + "Write" NoneAction Action = "" )
func ParseAction ¶
type Actions ¶
type Actions []Action
func BuiltinPermissionActions ¶
func BuiltinPermissionActions(perm Permission) Actions
type AddDataPartitionRaftMemberRequest ¶ added in v1.4.0
AddDataPartitionRaftMemberRequest defines the request of add raftMember a data partition.
type AddMetaPartitionRaftMemberRequest ¶ added in v1.4.0
AddMetaPartitionRaftMemberRequest defines the request of add raftMember a meta partition.
type AddMultipartPartRequest ¶ added in v1.5.0
type AddMultipartPartRequest struct { VolName string `json:"vol"` PartitionId uint64 `json:"pid"` Path string `json:"path"` MultipartId string `json:"mid"` Part *MultipartPartInfo `json:"part"` }
type AdminTask ¶
type AdminTask struct { ID string PartitionID uint64 OpCode uint8 OperatorAddr string Status int8 SendTime int64 CreateTime int64 SendCount uint8 Request interface{} Response interface{} }
AdminTask defines the administration task.
func NewAdminTask ¶
NewAdminTask returns a new adminTask.
func (*AdminTask) CheckTaskNeedSend ¶
CheckTaskNeedSend checks if the task needs to be sent out.
func (*AdminTask) CheckTaskTimeOut ¶
CheckTaskTimeOut checks if the task is timed out.
func (*AdminTask) IsHeartbeatTask ¶
IsHeartbeatTask returns if the task is a heartbeat task.
func (*AdminTask) IsTaskFailed ¶
IsTaskFailed returns if the task failed.
func (*AdminTask) IsTaskSuccessful ¶
IsTaskSuccessful returns if the task has been executed successful.
func (*AdminTask) IsUrgentTask ¶
IsUrgentTask returns if the task is urgent.
type AppendExtentKeyRequest ¶
type AppendExtentKeyRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inode uint64 `json:"ino"` Extent ExtentKey `json:"ek"` }
AppendExtentKeyRequest defines the request to append an extent key.
type AppendExtentKeysRequest ¶ added in v1.5.0
type AppendExtentKeysRequest struct { VolName string `json:"vol"` PartitionId uint64 `json:"pid"` Inode uint64 `json:"ino"` Extents []ExtentKey `json:"eks"` }
AppendExtentKeysRequest defines the request to append an extent key.
type AppendObjExtentKeysRequest ¶
type AppendObjExtentKeysRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inode uint64 `json:"ino"` Extents []ObjExtentKey `json:"ek"` }
AppendObjExtentKeyRequest defines the request to append an obj extent key.
type AuthAPIAccessReq ¶ added in v1.5.0
type AuthAPIAccessReq struct { APIReq APIAccessReq `json:"api_req"` KeyInfo keystore.KeyInfo `json:"key_info"` }
AuthAPIAccessReq defines Auth API request
type AuthAPIAccessResp ¶ added in v1.5.0
type AuthAPIAccessResp struct { APIResp APIAccessResp `json:"api_resp"` KeyInfo keystore.KeyInfo `json:"key_info"` }
AuthAPIAccessResp defines the response for creating an key in authnode
func ParseAuthAPIAccessResp ¶ added in v1.5.0
func ParseAuthAPIAccessResp(body []byte, key []byte) (resp AuthAPIAccessResp, err error)
ParseAuthAPIAccessResp parse and validate the auth api access resp
type AuthGetTicketReq ¶ added in v1.5.0
type AuthGetTicketReq struct { Type MsgType `json:"type"` ClientID string `json:"client_id"` ServiceID string `json:"service_id"` Verifier string `json:"verifier"` }
AuthGetTicketReq defines the message from client to authnode use Timestamp as verifier for MITM mitigation verifier is also used to verify the server identity
type AuthGetTicketResp ¶ added in v1.5.0
type AuthGetTicketResp struct { Type MsgType `json:"type"` ClientID string `json:"client_id"` ServiceID string `json:"service_id"` Verifier int64 `json:"verifier"` Ticket string `json:"ticket"` SessionKey cryptoutil.CryptoKey `json:"session_key"` }
AuthGetTicketResp defines the message from authnode to client
func ParseAuthGetTicketResp ¶ added in v1.5.0
func ParseAuthGetTicketResp(body []byte, key []byte) (resp AuthGetTicketResp, err error)
ParseAuthGetTicketResp parse and validate the auth get ticket resp
type AuthOSAccessKeyReq ¶ added in v1.5.0
type AuthOSAccessKeyReq struct { APIReq APIAccessReq `json:"api_req"` AKCaps keystore.AccessKeyCaps `json:"access_key_caps"` }
AuthAPIAccessKeystoreReq defines Auth API for put/delete Access Keystore vols
type AuthOSAccessKeyResp ¶ added in v1.5.0
type AuthOSAccessKeyResp struct { APIResp APIAccessResp `json:"api_resp"` AKCaps keystore.AccessKeyCaps `json:"access_key_caps"` }
AuthAPIAccessKeystoreResp defines the response for put/delete Access Keystore vols
func ParseAuthOSAKResp ¶ added in v1.5.0
func ParseAuthOSAKResp(body []byte, key []byte) (resp AuthOSAccessKeyResp, err error)
type AuthRaftNodeInfo ¶ added in v1.5.0
AuthRaftNodeInfo defines raft node information
type AuthRaftNodeReq ¶ added in v1.5.0
type AuthRaftNodeReq struct { APIReq APIAccessReq `json:"api_req"` RaftNodeInfo AuthRaftNodeInfo `json:"node_info"` }
AuthRaftNodeReq defines Auth API request for add/remove a raft node
type AuthRaftNodeResp ¶ added in v1.5.0
type AuthRaftNodeResp struct { APIResp APIAccessResp `json:"api_resp"` Msg string `json:"msg"` }
AuthRaftNodeResp defines Auth API response for add/remove a raft node
func ParseAuthRaftNodeResp ¶ added in v1.5.0
func ParseAuthRaftNodeResp(body []byte, key []byte) (resp AuthRaftNodeResp, err error)
ParseAuthRaftNodeResp parse and validate the auth raft node resp
type BadPartitionView ¶ added in v1.5.0
type BatchDeleteDentryResponse ¶
type BatchDeleteDentryResponse struct { Items []*struct { Inode uint64 `json:"ino"` Status uint8 `json:"status"` } `json:"items"` }
BatchDeleteDentryResponse defines the response to the request of deleting a dentry.
type BatchEvictInodeRequest ¶
type BatchEvictInodeRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inodes []uint64 `json:"inos"` }
EvictInodeRequest defines the request to evict some inode.
type BatchGetXAttrRequest ¶ added in v1.5.0
type BatchGetXAttrResponse ¶ added in v1.5.0
type BatchInodeGetRequest ¶
type BatchInodeGetRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inodes []uint64 `json:"inos"` }
BatchInodeGetRequest defines the request to get the inode in batch.
type BatchInodeGetResponse ¶
type BatchInodeGetResponse struct {
Infos []*InodeInfo `json:"infos"`
}
BatchInodeGetResponse defines the response to the request of getting the inode in batch.
type BatchUnlinkInodeRequest ¶
type BatchUnlinkInodeRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inodes []uint64 `json:"inos"` }
UnlinkInodeRequest defines the request to unlink an inode.
type BatchUnlinkInodeResponse ¶
type BatchUnlinkInodeResponse struct { Items []*struct { Info *InodeInfo `json:"info"` Status uint8 `json:"status"` } `json:"items"` }
batch UnlinkInodeResponse defines the response to the request of unlinking an inode.
type ClearInodeCacheRequest ¶
type ClearInodeCacheResponse ¶
type ClearInodeCacheResponse struct {
Info *InodeInfo `json:"info"`
}
type ClusterInfo ¶
type ClusterInfo struct { Cluster string Ip string MetaNodeDeleteBatchCount uint64 MetaNodeDeleteWorkerSleepMs uint64 DataNodeDeleteLimitRate uint64 DataNodeAutoRepairLimitRate uint64 EbsAddr string ServicePath string }
ClusterInfo defines the cluster infomation.
type ClusterStatInfo ¶
type ClusterStatInfo struct { DataNodeStatInfo *NodeStatInfo MetaNodeStatInfo *NodeStatInfo ZoneStatInfo map[string]*ZoneStat }
type ClusterView ¶ added in v1.5.0
type ClusterView struct { Name string LeaderAddr string DisableAutoAlloc bool MetaNodeThreshold float32 Applied uint64 MaxDataPartitionID uint64 MaxMetaNodeID uint64 MaxMetaPartitionID uint64 DataNodeStatInfo *NodeStatInfo MetaNodeStatInfo *NodeStatInfo VolStatInfo []*VolStatInfo BadPartitionIDs []BadPartitionView BadMetaPartitionIDs []BadPartitionView MetaNodes []NodeView DataNodes []NodeView }
ClusterView provides the view of a cluster.
type CreateDataPartitionRequest ¶
type CreateDataPartitionRequest struct { PartitionTyp int PartitionId uint64 PartitionSize int VolumeId string IsRandomWrite bool Members []Peer Hosts []string CreateType int }
CreateDataPartitionRequest defines the request to create a data partition.
type CreateDataPartitionResponse ¶
CreateDataPartitionResponse defines the response to the request of creating a data partition.
type CreateDentryRequest ¶
type CreateDentryRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` ParentID uint64 `json:"pino"` Inode uint64 `json:"ino"` Name string `json:"name"` Mode uint32 `json:"mode"` }
CreateDentryRequest defines the request to create a dentry.
type CreateInodeRequest ¶
type CreateInodeRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Mode uint32 `json:"mode"` Uid uint32 `json:"uid"` Gid uint32 `json:"gid"` Target []byte `json:"tgt"` }
CreateInodeRequest defines the request to create an inode.
type CreateInodeResponse ¶
type CreateInodeResponse struct {
Info *InodeInfo `json:"info"`
}
CreateInodeResponse defines the response to the request of creating an inode.
type CreateMetaPartitionRequest ¶
type CreateMetaPartitionRequest struct { MetaId string VolName string Start uint64 End uint64 PartitionID uint64 Members []Peer }
CreateMetaPartitionRequest defines the request to create a meta partition.
type CreateMetaPartitionResponse ¶
type CreateMetaPartitionResponse struct { VolName string PartitionID uint64 Status uint8 Result string }
CreateMetaPartitionResponse defines the response to the request of creating a meta partition.
type CreateMultipartRequest ¶ added in v1.5.0
type CreateMultipartResponse ¶ added in v1.5.0
type CreateMultipartResponse struct {
Info *MultipartInfo `json:"info"`
}
type CreateNameSpaceRequest ¶
type CreateNameSpaceRequest struct {
Name string
}
CreateNameSpaceRequest defines the request to create a name space.
type CreateNameSpaceResponse ¶
CreateNameSpaceResponse defines the response to the request of creating a name space.
type DataNodeHeartbeatResponse ¶
type DataNodeHeartbeatResponse struct { Total uint64 Used uint64 Available uint64 TotalPartitionSize uint64 // volCnt * volsize RemainingCapacity uint64 // remaining capacity to create partition CreatedPartitionCnt uint32 MaxCapacity uint64 // maximum capacity to create partition StartTime int64 ZoneName string PartitionReports []*PartitionReport Status uint8 Result string BadDisks []string }
DataNodeHeartbeatResponse defines the response to the data node heartbeat.
type DataNodeInfo ¶ added in v1.5.0
type DataNodeInfo struct { Total uint64 `json:"TotalWeight"` Used uint64 `json:"UsedWeight"` AvailableSpace uint64 ID uint64 ZoneName string `json:"Zone"` Addr string ReportTime time.Time IsActive bool IsWriteAble bool UsageRatio float64 // used / total space SelectedTimes uint64 // number times that this datanode has been selected as the location for a data partition. Carry float64 // carry is a factor used in cacluate the node's weight DataPartitionReports []*PartitionReport DataPartitionCount uint32 NodeSetID uint64 PersistenceDataPartitions []uint64 BadDisks []string }
DataNode stores all the information about a data node
type DataPartitionDecommissionRequest ¶
DataPartitionDecommissionRequest defines the request of decommissioning a data partition.
type DataPartitionDiagnosis ¶
type DataPartitionDiagnosis struct { InactiveDataNodes []string CorruptDataPartitionIDs []uint64 LackReplicaDataPartitionIDs []uint64 BadDataPartitionIDs []BadPartitionView }
data partition diagnosis represents the inactive data nodes, corrupt data partitions, and data partitions lack of replicas
type DataPartitionInfo ¶ added in v1.5.0
type DataPartitionInfo struct { PartitionID uint64 PartitionTTL int64 PartitionType int LastLoadedTime int64 ReplicaNum uint8 Status int8 Replicas []*DataReplica Hosts []string // host addresses Peers []Peer Zones []string 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 }
DataPartition represents the structure of storing the file contents.
type DataPartitionResponse ¶
type DataPartitionResponse struct { PartitionType int PartitionID uint64 Status int8 ReplicaNum uint8 Hosts []string LeaderAddr string Epoch uint64 IsRecover bool PartitionTTL int64 }
DataPartitionResponse defines the response from a data node to the master that is related to a data partition.
type DataPartitionsView ¶
type DataPartitionsView struct {
DataPartitions []*DataPartitionResponse
}
DataPartitionsView defines the view of a data partition
func NewDataPartitionsView ¶
func NewDataPartitionsView() (dataPartitionsView *DataPartitionsView)
type DataReplica ¶ added in v1.5.0
type DataReplica struct { Addr string ReportTime int64 FileCount uint32 Status int8 HasLoadResponse bool // if there is any response when loading Total uint64 `json:"TotalSize"` Used uint64 `json:"UsedSize"` IsLeader bool NeedsToCompare bool DiskPath string }
DataReplica represents the replica of a data partition
type DelExtentKeyRequest ¶
type DeleteDataPartitionRequest ¶
type DeleteDataPartitionRequest struct { DataPartitionType string PartitionId uint64 PartitionSize int }
DeleteDataPartitionRequest defines the request to delete a data partition.
type DeleteDataPartitionResponse ¶
DeleteDataPartitionResponse defines the response to the request of deleting a data partition.
type DeleteDentryRequest ¶
type DeleteDentryRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` ParentID uint64 `json:"pino"` Name string `json:"name"` }
DeleteDentryRequest define the request tp delete a dentry.
type DeleteDentryResponse ¶
type DeleteDentryResponse struct {
Inode uint64 `json:"ino"`
}
DeleteDentryResponse defines the response to the request of deleting a dentry.
type DeleteFileRequest ¶
DeleteFileRequest defines the request to delete a file.
type DeleteFileResponse ¶
DeleteFileResponse defines the response to the request of deleting a file.
type DeleteInodeBatchRequest ¶
type DeleteInodeBatchRequest struct { VolName string `json:"vol"` PartitionId uint64 `json:"pid"` Inodes []uint64 `json:"ino"` }
DeleteInodeRequest defines the request to delete an inode.
type DeleteInodeRequest ¶ added in v1.5.0
type DeleteInodeRequest struct { VolName string `json:"vol"` PartitionId uint64 `json:"pid"` Inode uint64 `json:"ino"` }
DeleteInodeRequest defines the request to delete an inode.
type DeleteMetaPartitionRequest ¶
type DeleteMetaPartitionRequest struct {
PartitionID uint64
}
DeleteMetaPartitionRequest defines the request of deleting a meta partition.
type DeleteMetaPartitionResponse ¶
DeleteMetaPartitionResponse defines the response to the request of deleting a meta partition.
type Dentry ¶
type Dentry struct { Name string `json:"name"` Inode uint64 `json:"ino"` Type uint32 `json:"type"` }
Dentry defines the dentry struct.
type EmptyExtentKeyRequest ¶
type EvictInodeRequest ¶
type EvictInodeRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inode uint64 `json:"ino"` }
EvictInodeRequest defines the request to evict an inode.
type ExtentKey ¶
type ExtentKey struct { FileOffset uint64 PartitionId uint64 ExtentId uint64 ExtentOffset uint64 Size uint32 CRC uint32 }
ExtentKey defines the extent key struct.
func (*ExtentKey) MarshalBinary ¶
MarshalBinary marshals the binary format of the extent key.
func (*ExtentKey) MarshalBinaryWithCheckSum ¶
marshal extentkey to []bytes with v2 of magic head
func (*ExtentKey) UnmarshalBinary ¶
UnmarshalBinary unmarshals the binary format of the extent key.
type FileInCore ¶ added in v1.5.0
type FileInCore struct { Name string LastModify int64 MetadataArray []*FileMetadata }
FileInCore define file in data partition
type FileMetadata ¶ added in v1.5.0
FileMetadata defines the file metadata on a dataNode
type GeneralResp ¶
func Success ¶
func Success(msg string) *GeneralResp
type GetExtentsRequest ¶
type GetExtentsRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inode uint64 `json:"ino"` }
GetExtentsRequest defines the reques to get extents.
type GetExtentsResponse ¶
type GetExtentsResponse struct { Generation uint64 `json:"gen"` Size uint64 `json:"sz"` Extents []ExtentKey `json:"eks"` }
GetExtentsResponse defines the response to the request of getting extents.
type GetMultipartRequest ¶ added in v1.5.0
type GetMultipartResponse ¶ added in v1.5.0
type GetMultipartResponse struct {
Info *MultipartInfo `json:"info"`
}
type GetObjExtentsResponse ¶
type GetObjExtentsResponse struct { Generation uint64 `json:"gen"` Size uint64 `json:"sz"` Extents []ExtentKey `json:"eks"` ObjExtents []ObjExtentKey `json:"objeks"` }
GetObjExtentsResponse defines the response to the request of getting obj extents.
type GetXAttrRequest ¶ added in v1.5.0
type GetXAttrResponse ¶ added in v1.5.0
type HTTPAuthReply ¶ added in v1.5.0
type HTTPAuthReply struct { Code int32 `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
HTTPAuthReply uniform response structure
func ParseAuthReply ¶ added in v1.5.0
func ParseAuthReply(body []byte) (jobj HTTPAuthReply, err error)
ParseAuthReply parse the response from auth
type HTTPReply ¶
type HTTPReply struct { Code int32 `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
HTTPReply uniform response structure
type HeartBeatRequest ¶
HeartBeatRequest define the heartbeat request.
type InodeGetRequest ¶
type InodeGetRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inode uint64 `json:"ino"` }
InodeGetRequest defines the request to get the inode.
type InodeGetResponse ¶
type InodeGetResponse struct {
Info *InodeInfo `json:"info"`
}
InodeGetResponse defines the response to the InodeGetRequest.
type InodeInfo ¶
type InodeInfo struct { Inode uint64 `json:"ino"` Mode uint32 `json:"mode"` Nlink uint32 `json:"nlink"` Size uint64 `json:"sz"` Uid uint32 `json:"uid"` Gid uint32 `json:"gid"` Generation uint64 `json:"gen"` ModifyTime time.Time `json:"mt"` CreateTime time.Time `json:"ct"` AccessTime time.Time `json:"at"` Target []byte `json:"tgt"` // contains filtered or unexported fields }
InodeInfo defines the inode struct.
func (*InodeInfo) Expiration ¶
func (*InodeInfo) SetExpiration ¶
type LinkInodeRequest ¶
type LinkInodeRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inode uint64 `json:"ino"` }
LinkInodeRequest defines the request to link an inode.
type LinkInodeResponse ¶
type LinkInodeResponse struct {
Info *InodeInfo `json:"info"`
}
LinkInodeResponse defines the response to the request of linking an inode.
type ListMultipartRequest ¶ added in v1.5.0
type ListMultipartResponse ¶ added in v1.5.0
type ListMultipartResponse struct {
Multiparts []*MultipartInfo `json:"mps"`
}
type ListXAttrRequest ¶ added in v1.5.0
type ListXAttrResponse ¶ added in v1.5.0
type LoadDataPartitionRequest ¶
type LoadDataPartitionRequest struct {
PartitionId uint64
}
LoadDataPartitionRequest defines the request of loading a data partition.
type LoadDataPartitionResponse ¶
type LoadDataPartitionResponse struct { PartitionId uint64 Used uint64 PartitionSnapshot []*File Status uint8 PartitionStatus int Result string VolName string }
LoadDataPartitionResponse defines the response to the request of loading a data partition.
type LoadMetaPartitionMetricRequest ¶
LoadMetaPartitionMetricRequest defines the request of loading the meta partition metrics.
type LoadMetaPartitionMetricResponse ¶
type LoadMetaPartitionMetricResponse struct { Start uint64 End uint64 MaxInode uint64 Status uint8 Result string }
LoadMetaPartitionMetricResponse defines the response to the request of loading the meta partition metrics.
type LookupRequest ¶
type LookupRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` ParentID uint64 `json:"pino"` Name string `json:"name"` }
LookupRequest defines the request for lookup.
type LookupResponse ¶
LookupResponse defines the response for the loopup request.
type MasterAPIAccessResp ¶ added in v1.5.0
type MasterAPIAccessResp struct { APIResp APIAccessResp `json:"api_resp"` Data []byte `json:"data"` }
MasterAPIAccessResp defines the response for getting meta partition
type MetaNodeHeartbeatResponse ¶
type MetaNodeHeartbeatResponse struct { ZoneName string Total uint64 Used uint64 MetaPartitionReports []*MetaPartitionReport Status uint8 Result string }
MetaNodeHeartbeatResponse defines the response to the meta node heartbeat request.
type MetaNodeInfo ¶ added in v1.5.0
type MetaNodeInfo struct { ID uint64 Addr string IsActive bool IsWriteAble bool ZoneName string `json:"Zone"` MaxMemAvailWeight uint64 `json:"MaxMemAvailWeight"` Total uint64 `json:"TotalWeight"` Used uint64 `json:"UsedWeight"` Ratio float64 SelectCount uint64 Carry float64 Threshold float32 ReportTime time.Time MetaPartitionCount int NodeSetID uint64 PersistenceMetaPartitions []uint64 }
MetaNode defines the structure of a meta node
type MetaPartitionDecommissionRequest ¶
type MetaPartitionDecommissionRequest struct { PartitionID uint64 VolName string RemovePeer Peer AddPeer Peer }
MetaPartitionDecommissionRequest defines the request of decommissioning a meta partition.
type MetaPartitionDecommissionResponse ¶
type MetaPartitionDecommissionResponse struct { PartitionID uint64 VolName string Status uint8 Result string }
MetaPartitionDecommissionResponse defines the response to the request of decommissioning a meta partition.
type MetaPartitionDiagnosis ¶
type MetaPartitionDiagnosis struct { InactiveMetaNodes []string CorruptMetaPartitionIDs []uint64 LackReplicaMetaPartitionIDs []uint64 BadMetaPartitionIDs []BadPartitionView }
meta partition diagnosis represents the inactive meta nodes, corrupt meta partitions, and meta partitions lack of replicas
type MetaPartitionInfo ¶ added in v1.5.0
type MetaPartitionInfo struct { PartitionID uint64 Start uint64 End uint64 MaxInodeID uint64 InodeCount uint64 DentryCount uint64 VolName string Replicas []*MetaReplicaInfo ReplicaNum uint8 Status int8 IsRecover bool Hosts []string Peers []Peer Zones []string OfflinePeerID uint64 MissNodes map[string]int64 LoadResponse []*MetaPartitionLoadResponse }
MetaPartition defines the structure of a meta partition
type MetaPartitionLoadRequest ¶
type MetaPartitionLoadRequest struct {
PartitionID uint64
}
MetaPartitionLoadRequest defines the request to load meta partition.
type MetaPartitionLoadResponse ¶
type MetaPartitionLoadResponse struct { PartitionID uint64 DoCompare bool ApplyID uint64 MaxInode uint64 DentryCount uint64 InodeCount uint64 Addr string }
MetaPartitionLoadResponse defines the response to the request of loading meta partition.
type MetaPartitionReport ¶
type MetaPartitionReport struct { PartitionID uint64 Start uint64 End uint64 Status int Size uint64 MaxInodeID uint64 IsLeader bool VolName string InodeCnt uint64 DentryCnt uint64 }
MetaPartitionReport defines the meta partition report.
type MetaPartitionView ¶
type MetaPartitionView struct { PartitionID uint64 Start uint64 End uint64 MaxInodeID uint64 InodeCount uint64 DentryCount uint64 IsRecover bool Members []string LeaderAddr string Status int8 }
MetaPartitionView defines the view of a meta partition
func NewMetaPartitionView ¶
func NewMetaPartitionView(partitionID, start, end uint64, status int8) (mpView *MetaPartitionView)
type MetaReplicaInfo ¶ added in v1.5.0
type MetaReplicaInfo struct { Addr string ReportTime int64 Status int8 // unavailable, readOnly, readWrite IsLeader bool }
MetaReplica defines the replica of a meta partition
type MountOption ¶
type MountOption struct {
// contains filtered or unexported fields
}
func NewMountOptions ¶
func NewMountOptions() []MountOption
func (*MountOption) GetBool ¶
func (opt *MountOption) GetBool() bool
func (*MountOption) GetInt64 ¶
func (opt *MountOption) GetInt64() int64
func (*MountOption) GetString ¶
func (opt *MountOption) GetString() string
func (MountOption) String ¶
func (opt MountOption) String() string
type MountOptions ¶
type MountOptions struct { Config *config.Config MountPoint string Volname string Owner string Master string Logpath string Loglvl string Profport string IcacheTimeout int64 LookupValid int64 AttrValid int64 ReadRate int64 WriteRate int64 EnSyncWrite int64 AutoInvalData int64 UmpDatadir string Rdonly bool WriteCache bool KeepCache bool FollowerRead bool Authenticate bool TicketMess auth.TicketMess TokenKey string AccessKey string SecretKey string DisableDcache bool SubDir string FsyncOnClose bool MaxCPUs int64 EnableXattr bool NearRead bool EnablePosixACL bool VolType int EbsEndpoint string EbsServicePath string CacheAction int CacheThreshold int EbsBlockSize int EnableBcache bool ReadThreads int64 WriteThreads int64 EnableSummary bool }
type MsgType ¶ added in v1.5.0
type MsgType uint32
MsgType defines the type of req/resp for message
const ( // MsgAuthBase define the starting value for auth message MsgAuthBase MsgType = 0x100000 // MsgAuthTicketReq request type for an auth ticket MsgAuthTicketReq MsgType = MsgAuthBase + 0x10000 // MsgAuthTicketResp respose type for an auth ticket MsgAuthTicketResp MsgType = MsgAuthBase + 0x10001 // MsgMasterTicketReq request type for a master ticket MsgMasterTicketReq MsgType = MsgAuthBase + 0x20000 // MsgMasterTicketResp response type for a master ticket MsgMasterTicketResp MsgType = MsgAuthBase + 0x20001 // MsgMetaTicketReq request type for a metanode ticket MsgMetaTicketReq MsgType = MsgAuthBase + 0x30000 // MsgMetaTicketResp response type for a metanode ticket MsgMetaTicketResp MsgType = MsgAuthBase + 0x30001 // MsgDataTicketReq request type for a datanode ticket MsgDataTicketReq MsgType = MsgAuthBase + 0x40000 // MsgDataTicketResp response type for a datanode ticket MsgDataTicketResp MsgType = MsgAuthBase + 0x40001 // MsgAuthCreateKeyReq request type for authnode add key MsgAuthCreateKeyReq MsgType = MsgAuthBase + 0x51000 // MsgAuthCreateKeyResp response type for authnode add key MsgAuthCreateKeyResp MsgType = MsgAuthBase + 0x51001 // MsgAuthDeleteKeyReq request type for authnode delete key MsgAuthDeleteKeyReq MsgType = MsgAuthBase + 0x52000 // MsgAuthDeleteKeyResp response type for authnode delete key MsgAuthDeleteKeyResp MsgType = MsgAuthBase + 0x52001 // MsgAuthGetKeyReq request type for authnode get key info MsgAuthGetKeyReq MsgType = MsgAuthBase + 0x53000 // MsgAuthGetKeyResp response type for authnode get key info MsgAuthGetKeyResp MsgType = MsgAuthBase + 0x53001 // MsgAuthAddCapsReq request type for authnode add caps MsgAuthAddCapsReq MsgType = MsgAuthBase + 0x54000 // MsgAuthAddCapsResp response type for authnode add caps MsgAuthAddCapsResp MsgType = MsgAuthBase + 0x54001 // MsgAuthDeleteCapsReq request type for authnode add caps MsgAuthDeleteCapsReq MsgType = MsgAuthBase + 0x55000 // MsgAuthDeleteCapsResp response type for authnode add caps MsgAuthDeleteCapsResp MsgType = MsgAuthBase + 0x55001 // MsgAuthGetCapsReq request type for authnode add caps MsgAuthGetCapsReq MsgType = MsgAuthBase + 0x56000 // MsgAuthGetCapsResp response type for authnode add caps MsgAuthGetCapsResp MsgType = MsgAuthBase + 0x56001 // MsgAuthAddRaftNodeReq request type for authnode add node MsgAuthAddRaftNodeReq MsgType = MsgAuthBase + 0x57000 // MsgAuthAddRaftNodeResp response type for authnode remove node MsgAuthAddRaftNodeResp MsgType = MsgAuthBase + 0x57001 // MsgAuthRemoveRaftNodeReq request type for authnode remove node MsgAuthRemoveRaftNodeReq MsgType = MsgAuthBase + 0x58000 // MsgAuthRemoveRaftNodeResp response type for authnode remove node MsgAuthRemoveRaftNodeResp MsgType = MsgAuthBase + 0x58001 // MsgAuthOSAddCapsReq request type from ObjectNode to add caps MsgAuthOSAddCapsReq MsgType = MsgAuthBase + 0x61000 // MsgAuthOSAddCapsResp request type from ObjectNode to add caps MsgAuthOSAddCapsResp MsgType = MsgAuthBase + 0x61001 // MsgAuthOSDeleteCapsReq request type from ObjectNode to delete caps MsgAuthOSDeleteCapsReq MsgType = MsgAuthBase + 0x62000 // MsgAuthOSDeleteCapsResp request type from ObjectNode to delete caps MsgAuthOSDeleteCapsResp MsgType = MsgAuthBase + 0x62001 // MsgAuthOSGetCapsReq request type from ObjectNode to get caps MsgAuthOSGetCapsReq MsgType = MsgAuthBase + 0x63000 // MsgAuthOSGetCapsResp response type from ObjectNode to get caps MsgAuthOSGetCapsResp MsgType = MsgAuthBase + 0x63001 // MsgMasterAPIAccessReq request type for master api access MsgMasterAPIAccessReq MsgType = 0x60000 // MsgMasterAPIAccessResp response type for master api access MsgMasterAPIAccessResp MsgType = 0x60001 //Master API ClientVol MsgMasterFetchVolViewReq MsgType = MsgMasterAPIAccessReq + 0x10000 )
type MultipartInfo ¶ added in v1.5.0
type MultipartPartInfo ¶ added in v1.5.0
type NodeSetInfo ¶
type NodeSetView ¶
type NodeStatInfo ¶ added in v1.5.0
type Nonce ¶ added in v1.5.0
type Nonce uint64
Nonce defines the nonce to mitigate the replay attack
type ObjExtentKey ¶
type ObjExtentKey struct { Cid uint64 // cluster id CodeMode uint8 // EC encode and decode mode BlobSize uint32 // block size BlobsLen uint32 // blob array length Size uint64 // objExtentKey size Blobs []Blob FileOffset uint64 // obj offset in file Crc uint32 }
ExtentKey defines the extent key struct.
func (*ObjExtentKey) Copy ¶
func (k *ObjExtentKey) Copy() btree.Item
Marshal marshals the obj extent key.
func (*ObjExtentKey) IsEquals ¶
func (k *ObjExtentKey) IsEquals(obj *ObjExtentKey) bool
func (*ObjExtentKey) Less ¶
func (k *ObjExtentKey) Less(than btree.Item) bool
Less defines the less comparator.
func (*ObjExtentKey) MarshalBinary ¶
func (k *ObjExtentKey) MarshalBinary() ([]byte, error)
MarshalBinary marshals the binary format of the extent key.
func (ObjExtentKey) String ¶
func (k ObjExtentKey) String() string
String returns the string format of the extentKey.
func (*ObjExtentKey) UnmarshalBinary ¶
func (k *ObjExtentKey) UnmarshalBinary(buf *bytes.Buffer) (err error)
type Packet ¶
type Packet struct { Magic uint8 ExtentType uint8 Opcode uint8 ResultCode uint8 RemainingFollowers uint8 CRC uint32 Size uint32 ArgLen uint32 KernelOffset uint64 PartitionID uint64 ExtentID uint64 ExtentOffset int64 ReqID int64 Arg []byte // for create or append ops, the data contains the address Data []byte StartT int64 HasPrepare bool // contains filtered or unexported fields }
Packet defines the packet structure.
func NewPacketReqID ¶
func NewPacketReqID() *Packet
NewPacketReqID returns a new packet with ReqID assigned.
func (*Packet) AddMesgLog ¶ added in v1.4.0
func (*Packet) GetOpMsgWithReqAndResult ¶
func (*Packet) GetResultMsg ¶
GetResultMsg returns the result message.
func (*Packet) GetStoreType ¶
GetStoreType returns the store type.
func (*Packet) GetUniqueLogId ¶
GetUniqueLogId returns the unique log ID.
func (*Packet) IsBatchDeleteExtents ¶
func (*Packet) IsForwardPkt ¶
IsForwardPkt returns if the packet is the forward packet (a packet that will be forwarded to the followers).
func (*Packet) LogMessage ¶
LogMessage logs the given message.
func (*Packet) MarshalData ¶
MarshalData marshals the packet data.
func (*Packet) MarshalHeader ¶
MarshalHeader marshals the packet header.
func (*Packet) PacketErrorWithBody ¶
PacketErrorWithBody sets the packet with error code whose body is filled with the given data.
func (*Packet) PacketOkReply ¶
func (p *Packet) PacketOkReply()
PacketOkReply sets the result code as OpOk, and sets the body as empty.
func (*Packet) PacketOkWithBody ¶
PacketOkWithBody sets the result code as OpOk, and sets the body with the give data.
func (*Packet) ReadFromConn ¶
ReadFromConn reads the data from the given connection.
func (*Packet) SetPacketHasPrepare ¶ added in v1.4.0
func (p *Packet) SetPacketHasPrepare()
func (*Packet) SetPacketRePrepare ¶ added in v1.4.0
func (p *Packet) SetPacketRePrepare()
func (*Packet) ShouldRetry ¶
ShallRetry returns if we should retry the packet.
func (*Packet) UnmarshalData ¶
UnmarshalData unmarshals the packet data.
func (*Packet) UnmarshalHeader ¶
UnmarshalHeader unmarshals the packet header.
func (*Packet) WriteToConn ¶
WriteToConn writes through the given connection.
type PartitionReport ¶
type PartitionReport struct { VolName string PartitionID uint64 PartitionStatus int Total uint64 Used uint64 DiskPath string IsLeader bool ExtentCount int NeedCompare bool }
PartitionReport defines the partition report.
type Permission ¶
type Permission string
const ( // prefixes for value organization PermissionPrefix Permission = "perm:" BuiltinPermissionPrefix Permission = PermissionPrefix + "builtin:" CustomPermissionPrefix Permission = PermissionPrefix + "custom:" // constants for builtin permissions BuiltinPermissionReadOnly Permission = BuiltinPermissionPrefix + "ReadOnly" BuiltinPermissionWritable Permission = BuiltinPermissionPrefix + "Writable" // constants for unknown permission NonePermission Permission = "" )
func NewCustomPermission ¶
func NewCustomPermission(name string) Permission
func ParsePermission ¶
func ParsePermission(value string) Permission
func (Permission) IsBuiltin ¶
func (p Permission) IsBuiltin() bool
func (Permission) IsCustom ¶
func (p Permission) IsCustom() bool
func (Permission) IsNone ¶
func (p Permission) IsNone() bool
func (Permission) MatchSubdir ¶
func (p Permission) MatchSubdir(subdir string) bool
func (Permission) ReadableString ¶
func (p Permission) ReadableString() string
func (Permission) String ¶
func (p Permission) String() string
func (Permission) Valid ¶
func (p Permission) Valid() bool
type ReadDirLimitRequest ¶
type ReadDirLimitRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` ParentID uint64 `json:"pino"` Marker string `json:"marker"` Limit uint64 `json:"limit"` }
ReadDirLimitRequest defines the request to read dir with limited dentries.
type ReadDirLimitResponse ¶
type ReadDirLimitResponse struct {
Children []Dentry `json:"children"`
}
type ReadDirOnlyRequest ¶
type ReadDirOnlyResponse ¶
type ReadDirOnlyResponse struct {
Children []Dentry `json:"children"`
}
type ReadDirRequest ¶
type ReadDirRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` ParentID uint64 `json:"pino"` }
ReadDirRequest defines the request to read dir.
type ReadDirResponse ¶
type ReadDirResponse struct {
Children []Dentry `json:"children"`
}
ReadDirResponse defines the response to the request of reading dir.
type RegisterMetaNodeResp ¶
type RegisterMetaNodeResp struct {
ID uint64
}
RegisterMetaNodeResp defines the response to register a meta node.
type RemoveDataPartitionRaftMemberRequest ¶ added in v1.4.0
RemoveDataPartitionRaftMemberRequest defines the request of add raftMember a data partition.
type RemoveMetaPartitionRaftMemberRequest ¶ added in v1.4.0
RemoveMetaPartitionRaftMemberRequest defines the request of add raftMember a meta partition.
type RemoveMultipartRequest ¶ added in v1.5.0
type RemoveXAttrRequest ¶ added in v1.5.0
type SetAttrRequest ¶
type SetAttrRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inode uint64 `json:"ino"` Mode uint32 `json:"mode"` Uid uint32 `json:"uid"` Gid uint32 `json:"gid"` ModifyTime int64 `json:"mt"` AccessTime int64 `json:"at"` Valid uint32 `json:"valid"` }
SetAttrRequest defines the request to set attribute.
type SetXAttrRequest ¶ added in v1.5.0
type SimpleNodeSetGrpInfo ¶
type SimpleNodeSetGrpInfo struct { ID uint64 Status uint8 NodeSetInfo []NodeSetInfo }
type SimpleNodeSetGrpInfoList ¶
type SimpleNodeSetGrpInfoList struct { DomainId uint64 Status uint8 SimpleNodeSetGrpInfo []*SimpleNodeSetGrpInfo }
type SimpleVolView ¶
type SimpleVolView struct { ID uint64 Name string Owner string ZoneName string DpReplicaNum uint8 MpReplicaNum uint8 InodeCount uint64 DentryCount uint64 MaxMetaPartitionID uint64 Status uint8 Capacity uint64 // GB RwDpCnt int MpCnt int DpCnt int FollowerRead bool NeedToLowerReplica bool Authenticate bool CrossZone bool DefaultPriority bool DomainOn bool CreateTime string EnableToken bool Description string DpSelectorName string DpSelectorParm string DefaultZonePrior bool VolType int ObjBlockSize int CacheCapacity uint64 CacheAction int CacheThreshold int CacheHighWater int CacheLowWater int CacheLruInterval int CacheTtl int CacheRule string PreloadCapacity uint64 }
SimpleVolView defines the simple view of a volume
type TinyExtentDeleteRecord ¶
type TopologyView ¶
type TopologyView struct {
Zones []*ZoneView
}
TopologyView provides the view of the topology view of the cluster
type TruncateRequest ¶
type TruncateRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inode uint64 `json:"ino"` Size uint64 `json:"sz"` }
TruncateRequest defines the request to truncate.
type UnlinkInodeRequest ¶
type UnlinkInodeRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` Inode uint64 `json:"ino"` }
UnlinkInodeRequest defines the request to unlink an inode.
type UnlinkInodeResponse ¶
type UnlinkInodeResponse struct {
Info *InodeInfo `json:"info"`
}
UnlinkInodeResponse defines the response to the request of unlinking an inode.
type UpdateDentryRequest ¶
type UpdateDentryRequest struct { VolName string `json:"vol"` PartitionID uint64 `json:"pid"` ParentID uint64 `json:"pino"` Name string `json:"name"` Inode uint64 `json:"ino"` // new inode number }
UpdateDentryRequest defines the request to update a dentry.
type UpdateDentryResponse ¶
type UpdateDentryResponse struct {
Inode uint64 `json:"ino"` // old inode number
}
UpdateDentryResponse defines the response to the request of updating a dentry.
type UpdateMetaPartitionRequest ¶
type UpdateMetaPartitionRequest struct { PartitionID uint64 VolName string Start uint64 End uint64 }
UpdateMetaPartitionRequest defines the request to update a meta partition.
type UpdateMetaPartitionResponse ¶
type UpdateMetaPartitionResponse struct { PartitionID uint64 VolName string End uint64 Status uint8 Result string }
UpdateMetaPartitionResponse defines the response to the request of updating the meta partition.
type UpdateXAttrRequest ¶
type UserCreateParam ¶
type UserInfo ¶
type UserInfo struct { UserID string `json:"user_id" graphql:"user_id"` AccessKey string `json:"access_key" graphql:"access_key"` SecretKey string `json:"secret_key" graphql:"secret_key"` Policy *UserPolicy `json:"policy" graphql:"policy"` UserType UserType `json:"user_type" graphql:"user_type"` CreateTime string `json:"create_time" graphql:"create_time"` Description string `json:"description" graphql:"description"` Mu sync.RWMutex `json:"-" graphql:"-"` EMPTY bool //graphql need ??? }
func NewUserInfo ¶
func NewUserInfo() *UserInfo
type UserPermRemoveParam ¶
func NewUserPermRemoveParam ¶
func NewUserPermRemoveParam(userID, volmue string) *UserPermRemoveParam
type UserPermUpdateParam ¶
type UserPermUpdateParam struct { UserID string `json:"user_id"` Volume string `json:"volume"` Subdir string `json:"subdir"` Policy []string `json:"policy"` }
func NewUserPermUpdateParam ¶
func NewUserPermUpdateParam(userID, volmue string) *UserPermUpdateParam
func (*UserPermUpdateParam) SetPolicy ¶
func (param *UserPermUpdateParam) SetPolicy(policy string)
type UserPolicy ¶
type UserPolicy struct { OwnVols []string `json:"own_vols" graphql:"own_vols"` AuthorizedVols map[string][]string `json:"authorized_vols" graphql:"-"` // mapping: volume -> actions // contains filtered or unexported fields }
func CleanPolicy ¶
func CleanPolicy(policy *UserPolicy) (newUserPolicy *UserPolicy)
func NewUserPolicy ¶
func NewUserPolicy() *UserPolicy
func (*UserPolicy) Add ¶
func (policy *UserPolicy) Add(addPolicy *UserPolicy)
func (*UserPolicy) AddAuthorizedVol ¶
func (policy *UserPolicy) AddAuthorizedVol(volume string, policies []string)
func (*UserPolicy) AddOwnVol ¶
func (policy *UserPolicy) AddOwnVol(volume string)
func (*UserPolicy) Delete ¶
func (policy *UserPolicy) Delete(deletePolicy *UserPolicy)
func (*UserPolicy) IsAuthorized ¶
func (policy *UserPolicy) IsAuthorized(volume, subdir string, action Action) bool
func (*UserPolicy) IsOwn ¶
func (policy *UserPolicy) IsOwn(volume string) bool
func (*UserPolicy) RemoveAuthorizedVol ¶
func (policy *UserPolicy) RemoveAuthorizedVol(volume string)
func (*UserPolicy) RemoveOwnVol ¶
func (policy *UserPolicy) RemoveOwnVol(volume string)
func (*UserPolicy) SetActions ¶
func (policy *UserPolicy) SetActions(volume string, actions Actions)
func (*UserPolicy) SetPerm ¶
func (policy *UserPolicy) SetPerm(volume string, perm Permission)
type UserTransferVolParam ¶
type UserUpdateParam ¶
type VolInfo ¶
type VolStatInfo ¶
type VolView ¶
type VolView struct { Name string Owner string Status uint8 FollowerRead bool MetaPartitions []*MetaPartitionView DataPartitions []*DataPartitionResponse DomainOn bool OSSSecure *OSSSecure CreateTime int64 CacheTTL int VolType int }
VolView defines the view of a volume
func NewVolView ¶
func (*VolView) SetOSSSecure ¶ added in v1.5.0
type ZoneNodesStat ¶
type ZoneStat ¶
type ZoneStat struct { DataNodeStat *ZoneNodesStat MetaNodeStat *ZoneNodesStat }