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(AgentService.TempCacheReport)
  9. type TempCacheReport struct {
  10. NodeID int64 `json:"nodeID"`
  11. Hashes []string `json:"hashes"`
  12. }
  13. func NewTempCacheReportBody(nodeID int64, hashes []string) TempCacheReport {
  14. return TempCacheReport{
  15. NodeID: nodeID,
  16. Hashes: hashes,
  17. }
  18. }
  19. func (client *Client) TempCacheReport(msg TempCacheReport) error {
  20. return mq.Send(client.rabbitCli, msg)
  21. }
  22. // 代理端发给协调端,告知延迟、ipfs和资源目录的可达性
  23. var _ = RegisterNoReply(AgentService.AgentStatusReport)
  24. type AgentStatusReport struct {
  25. NodeID int64 `json:"nodeID"`
  26. NodeDelayIDs []int64 `json:"nodeDelayIDs"`
  27. NodeDelays []int `json:"nodeDelays"`
  28. IPFSStatus string `json:"ipfsStatus"`
  29. LocalDirStatus string `json:"localDirStatus"`
  30. }
  31. func NewAgentStatusReportBody(nodeID int64, nodeDelayIDs []int64, nodeDelays []int, ipfsStatus string, localDirStatus string) AgentStatusReport {
  32. return AgentStatusReport{
  33. NodeID: nodeID,
  34. NodeDelayIDs: nodeDelayIDs,
  35. NodeDelays: nodeDelays,
  36. IPFSStatus: ipfsStatus,
  37. LocalDirStatus: localDirStatus,
  38. }
  39. }
  40. func (client *Client) AgentStatusReport(msg AgentStatusReport) error {
  41. return mq.Send(client.rabbitCli, msg)
  42. }

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