JCS-pub/common/pkgs/rpc/coordinator/storage.go

33 lines
955 B
Go

package corrpc
import (
context "context"
"gitlink.org.cn/cloudream/jcs-pub/common/pkgs/rpc"
jcstypes "gitlink.org.cn/cloudream/jcs-pub/common/types"
)
type StorageService interface {
SelectStorageHub(ctx context.Context, msg *SelectStorageHub) (*SelectStorageHubResp, *rpc.CodeError)
}
// 为指定的Storage选择一个适合通信的Hub
type SelectStorageHub struct {
Storages []jcstypes.StorageType
}
type SelectStorageHubResp struct {
Hubs []*jcstypes.Hub
}
var _ = TokenAuth(Coordinator_SelectStorageHub_FullMethodName)
func (c *Client) SelectStorageHub(ctx context.Context, msg *SelectStorageHub) (*SelectStorageHubResp, *rpc.CodeError) {
if c.fusedErr != nil {
return nil, c.fusedErr
}
return rpc.UnaryClient[*SelectStorageHubResp](c.cli.SelectStorageHub, ctx, msg)
}
func (s *Server) SelectStorageHub(ctx context.Context, msg *rpc.Request) (*rpc.Response, error) {
return rpc.UnaryServer(s.svrImpl.SelectStorageHub, ctx, msg)
}