Browse Source

增加 根据packageid查询node信息

gitlink
songjc 2 years ago
parent
commit
f3a60e6572
1 changed files with 64 additions and 0 deletions
  1. +64
    -0
      pkgs/mq/coordinator/package.go

+ 64
- 0
pkgs/mq/coordinator/package.go View File

@@ -18,6 +18,10 @@ type PackageService interface {
UpdateECPackage(msg *UpdateECPackage) (*UpdateECPackageResp, *mq.CodeMessage) UpdateECPackage(msg *UpdateECPackage) (*UpdateECPackageResp, *mq.CodeMessage)


DeletePackage(msg *DeletePackage) (*DeletePackageResp, *mq.CodeMessage) DeletePackage(msg *DeletePackage) (*DeletePackageResp, *mq.CodeMessage)

GetCacheNodesByPackage(msg *GetCacheNodesByPackage) (*GetCacheNodesByPackageResp, *mq.CodeMessage)

GetStorageNodesByPackage(msg *GetStorageNodesByPackage) (*GetStorageNodesByPackageResp, *mq.CodeMessage)
} }


// 获取Package基本信息 // 获取Package基本信息
@@ -199,3 +203,63 @@ func NewDeletePackageResp() DeletePackageResp {
func (client *Client) DeletePackage(msg DeletePackage) (*DeletePackageResp, error) { func (client *Client) DeletePackage(msg DeletePackage) (*DeletePackageResp, error) {
return mq.Request[DeletePackageResp](client.rabbitCli, msg) return mq.Request[DeletePackageResp](client.rabbitCli, msg)
} }

// 根据PackageID获取object分布情况
var _ = Register(PackageService.GetCacheNodesByPackage)

type GetCacheNodesByPackage struct {
UserID int64 `json:"userID"`
PackageID int64 `json:"packageID"`
}

type GetCacheNodesByPackageResp struct {
NodeIDs []int64 `json:"nodeIDs"`
RedundancyType string `json:"redundancyType"`
}

func NewGetCacheNodesByPackage(userID int64, packageID int64) GetCacheNodesByPackage {
return GetCacheNodesByPackage{
UserID: userID,
PackageID: packageID,
}
}

func NewGetCacheNodesByPackageResp(nodeIDs []int64, redundancyType string) GetCacheNodesByPackageResp {
return GetCacheNodesByPackageResp{
NodeIDs: nodeIDs,
RedundancyType: redundancyType,
}
}

func (client *Client) GetCacheNodesByPackage(msg GetCacheNodesByPackage) (*GetCacheNodesByPackageResp, error) {
return mq.Request[GetCacheNodesByPackageResp](client.rabbitCli, msg)
}

// 根据PackageID获取storage分布情况
var _ = Register(PackageService.GetStorageNodesByPackage)

type GetStorageNodesByPackage struct {
UserID int64 `json:"userID"`
PackageID int64 `json:"packageID"`
}

type GetStorageNodesByPackageResp struct {
NodeIDs []int64 `json:"nodeIDs"`
}

func NewGetStorageNodesByPackage(userID int64, packageID int64) GetStorageNodesByPackage {
return GetStorageNodesByPackage{
UserID: userID,
PackageID: packageID,
}
}

func NewGetStorageNodesByPackageResp(nodeIDs []int64) GetStorageNodesByPackageResp {
return GetStorageNodesByPackageResp{
NodeIDs: nodeIDs,
}
}

func (client *Client) GetStorageNodesByPackage(msg GetStorageNodesByPackage) (*GetStorageNodesByPackageResp, error) {
return mq.Request[GetStorageNodesByPackageResp](client.rabbitCli, msg)
}

Loading…
Cancel
Save