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.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. IPFSStatus string `json:"ipfsStatus"`
  31. LocalDirStatus string `json:"localDirStatus"`
  32. }
  33. func NewAgentStatusReportBody(nodeID int64, nodeDelayIDs []int64, nodeDelays []int, ipfsStatus string, localDirStatus string) *AgentStatusReport {
  34. return &AgentStatusReport{
  35. NodeID: nodeID,
  36. NodeDelayIDs: nodeDelayIDs,
  37. NodeDelays: nodeDelays,
  38. IPFSStatus: ipfsStatus,
  39. LocalDirStatus: localDirStatus,
  40. }
  41. }
  42. func (client *Client) AgentStatusReport(msg *AgentStatusReport) error {
  43. return mq.Send(AgentService.AgentStatusReport, client.rabbitCli, msg)
  44. }

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