You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

common.go 1.6 kB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package coordinator
  2. import (
  3. "gitlink.org.cn/cloudream/common/pkgs/mq"
  4. "gitlink.org.cn/cloudream/storage/common/pkgs/db/model"
  5. )
  6. type CommonService interface {
  7. FindClientLocation(msg *FindClientLocation) (*FindClientLocationResp, *mq.CodeMessage)
  8. GetECConfig(msg *GetECConfig) (*GetECConfigResp, *mq.CodeMessage)
  9. }
  10. // 查询指定IP所属的地域
  11. var _ = Register(Service.FindClientLocation)
  12. type FindClientLocation struct {
  13. mq.MessageBodyBase
  14. IP string `json:"ip"`
  15. }
  16. type FindClientLocationResp struct {
  17. mq.MessageBodyBase
  18. Location model.Location `json:"location"`
  19. }
  20. func NewFindClientLocation(ip string) *FindClientLocation {
  21. return &FindClientLocation{
  22. IP: ip,
  23. }
  24. }
  25. func NewFindClientLocationResp(location model.Location) *FindClientLocationResp {
  26. return &FindClientLocationResp{
  27. Location: location,
  28. }
  29. }
  30. func (client *Client) FindClientLocation(msg *FindClientLocation) (*FindClientLocationResp, error) {
  31. return mq.Request(Service.FindClientLocation, client.rabbitCli, msg)
  32. }
  33. // 获取EC具体配置
  34. var _ = Register(Service.GetECConfig)
  35. type GetECConfig struct {
  36. mq.MessageBodyBase
  37. ECName string `json:"ecName"`
  38. }
  39. type GetECConfigResp struct {
  40. mq.MessageBodyBase
  41. Config model.Ec `json:"config"`
  42. }
  43. func NewGetECConfig(ecName string) *GetECConfig {
  44. return &GetECConfig{
  45. ECName: ecName,
  46. }
  47. }
  48. func NewGetECConfigResp(config model.Ec) *GetECConfigResp {
  49. return &GetECConfigResp{
  50. Config: config,
  51. }
  52. }
  53. func (client *Client) GetECConfig(msg *GetECConfig) (*GetECConfigResp, error) {
  54. return mq.Request(Service.GetECConfig, client.rabbitCli, msg)
  55. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。