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.

agent.go 1.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package coordinator
  2. import "gitlink.org.cn/cloudream/common/pkgs/mq"
  3. type AgentService interface {
  4. TempCacheReport(msg *TempCacheReport)
  5. AgentStatusReport(msg *AgentStatusReport)
  6. }
  7. // 代理端发给协调端,告知临时缓存的数据
  8. var _ = RegisterNoReply(Service.TempCacheReport)
  9. type TempCacheReport struct {
  10. mq.MessageBodyBase
  11. NodeID int64 `json:"nodeID"`
  12. Hashes []string `json:"hashes"`
  13. }
  14. func NewTempCacheReportBody(nodeID int64, hashes []string) *TempCacheReport {
  15. return &TempCacheReport{
  16. NodeID: nodeID,
  17. Hashes: hashes,
  18. }
  19. }
  20. func (client *Client) TempCacheReport(msg *TempCacheReport) error {
  21. return mq.Send(AgentService.TempCacheReport, client.rabbitCli, msg)
  22. }
  23. // 代理端发给协调端,告知延迟、ipfs和资源目录的可达性
  24. var _ = RegisterNoReply(Service.AgentStatusReport)
  25. type AgentStatusReport struct {
  26. mq.MessageBodyBase
  27. NodeID int64 `json:"nodeID"`
  28. NodeDelayIDs []int64 `json:"nodeDelayIDs"`
  29. NodeDelays []int `json:"nodeDelays"`
  30. LocalDirStatus string `json:"localDirStatus"`
  31. }
  32. func NewAgentStatusReportBody(nodeID int64, nodeDelayIDs []int64, nodeDelays []int, localDirStatus string) *AgentStatusReport {
  33. return &AgentStatusReport{
  34. NodeID: nodeID,
  35. NodeDelayIDs: nodeDelayIDs,
  36. NodeDelays: nodeDelays,
  37. LocalDirStatus: localDirStatus,
  38. }
  39. }
  40. func (client *Client) AgentStatusReport(msg *AgentStatusReport) error {
  41. return mq.Send(AgentService.AgentStatusReport, client.rabbitCli, msg)
  42. }

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