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.

datamap.go 7.6 kB

10 months ago
10 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. package stgmod
  2. import (
  3. cdssdk "gitlink.org.cn/cloudream/common/sdks/storage"
  4. "time"
  5. )
  6. // HubInfo 节点信息
  7. type SourceHub struct {
  8. Type string `json:"type"`
  9. }
  10. type HubInfoBody struct {
  11. HubID int `json:"hubID"`
  12. HubInfo cdssdk.Hub `json:"hubInfo"`
  13. Type string `json:"type"`
  14. }
  15. type HubInfo struct {
  16. Timestamp time.Time `json:"timestamp"`
  17. Source SourceHub `json:"source"`
  18. Category string `json:"category"`
  19. Body HubInfoBody `json:"body"`
  20. }
  21. //StorageInfo 节点信息
  22. type SourceStorage struct {
  23. Type string `json:"type"`
  24. }
  25. type StorageInfoBody struct {
  26. StorageID int64 `json:"storageID"`
  27. StorageInfo cdssdk.Storage `json:"storageInfo"`
  28. Type string `json:"type"`
  29. }
  30. type StorageInfo struct {
  31. Timestamp time.Time `json:"timestamp"`
  32. Source SourceStorage `json:"source"`
  33. Category string `json:"category"`
  34. Body StorageInfoBody `json:"body"`
  35. }
  36. // StorageStats 节点信息数据
  37. type Source struct {
  38. Type string `json:"type"`
  39. HubID string `json:"hubID"`
  40. HubName string `json:"hubName"`
  41. }
  42. type StorageStatsBody struct {
  43. StorageID int64 `json:"storageID"`
  44. DataCount int64 `json:"dataCount"`
  45. }
  46. type StorageStats struct {
  47. Timestamp time.Time `json:"timestamp"`
  48. Source Source `json:"source"`
  49. Category string `json:"category"`
  50. Body StorageStatsBody `json:"body"`
  51. }
  52. // HubTransferStats 节点传输信息
  53. // 每天一次,各节点统计自身当天向外部各个节点传输的总数据量
  54. type DataTrans struct {
  55. TotalTransfer int64 `json:"totalTransfer"`
  56. RequestCount int64 `json:"requestCount"`
  57. FailedRequestCount int64 `json:"failedRequestCount"`
  58. AvgTransfer int64 `json:"avgTransfer"`
  59. MaxTransfer int64 `json:"maxTransfer"`
  60. MinTransfer int64 `json:"minTransfer"`
  61. }
  62. type HubTransferStatsBody struct {
  63. SourceHubID int64 `json:"sourceHubID"`
  64. TargetHubID int64 `json:"targetHubID"`
  65. Send DataTrans `json:"send"`
  66. StartTimestamp time.Time `json:"startTimestamp"`
  67. EndTimestamp time.Time `json:"endTimestamp"`
  68. }
  69. type HubTransferStats struct {
  70. Timestamp time.Time `json:"timestamp"`
  71. Source Source `json:"source"`
  72. Category string `json:"category"`
  73. Body HubTransferStatsBody `json:"body"`
  74. }
  75. //hubStorageTransferStats 节点-中心间传输信息
  76. type HubStorageTransferStatsBody struct {
  77. HubID int64 `json:"hubID"`
  78. StorageID int64 `json:"storageID"`
  79. Send DataTrans `json:"send"`
  80. Receive DataTrans `json:"receive"`
  81. StartTimestamp time.Time `json:"startTimestamp"`
  82. EndTimestamp time.Time `json:"endTimestamp"`
  83. }
  84. type HubStorageTransferStats struct {
  85. Timestamp time.Time `json:"timestamp"`
  86. Source Source `json:"source"`
  87. Category string `json:"category"`
  88. Body HubStorageTransferStatsBody `json:"body"`
  89. }
  90. // blockTransfer 块传输信息
  91. /*实时日志,当对象的块信息发生变化时推送,共有4种变化类型:
  92. 拷贝
  93. 编解码(一变多、多变一、多变多)
  94. 删除
  95. 更新*/
  96. type Block struct {
  97. BlockType string `json:"blockType"`
  98. Index string `json:"index"`
  99. StorageID string `json:"storageID"`
  100. }
  101. type DataTransfer struct {
  102. SourceStorageID string `json:"sourceStorageID"`
  103. TargetStorageID string `json:"targetStorageID"`
  104. DataTransferCount string `json:"dataTransferCount"`
  105. }
  106. type BlockChange struct {
  107. Type string `json:"type"`
  108. BlockType string `json:"blockType"`
  109. Index string `json:"index"`
  110. SourceStorageID string `json:"sourceStorageID"`
  111. TargetStorageID string `json:"targetStorageID"`
  112. DataTransferCount string `json:"dataTransferCount"`
  113. Timestamp time.Time `json:"timestamp"`
  114. SourceBlocks []Block `json:"sourceBlocks,omitempty"`
  115. TargetBlocks []Block `json:"targetBlocks,omitempty"`
  116. DataTransfers []DataTransfer `json:"dataTransfers,omitempty"`
  117. Blocks []Block `json:"blocks,omitempty"`
  118. }
  119. type BlockTransferBody struct {
  120. Type string `json:"type"`
  121. ObjectID string `json:"objectID"`
  122. PackageID string `json:"packageID"`
  123. BlockChanges []BlockChange `json:"blockChanges"`
  124. }
  125. type BlockTransfer struct {
  126. Timestamp time.Time `json:"timestamp"`
  127. Source Source `json:"source"`
  128. Category string `json:"category"`
  129. Body BlockTransferBody `json:"body"`
  130. }
  131. // BlockDistribution 块传输信息
  132. // 每天一次,在调整完成后,将当天调整前后的布局情况一起推送
  133. type BlockDistributionObjectInfo struct {
  134. Type string `json:"type"`
  135. Index string `json:"index"`
  136. StorageID string `json:"storageID"`
  137. }
  138. type BlockDistributionObject struct {
  139. ObjectID int64 `json:"objectID"`
  140. PackageID int64 `json:"packageID"`
  141. Path string `json:"path"`
  142. Size int64 `json:"size"`
  143. FileHash string `json:"fileHash"`
  144. FaultTolerance string `json:"faultTolerance"`
  145. Redundancy string `json:"redundancy"`
  146. AvgAccessCost string `json:"avgAccessCost"`
  147. BlockDistribution []BlockDistributionObjectInfo `json:"blockDistribution"`
  148. DataTransfers []DataTransfer `json:"dataTransfers"`
  149. }
  150. type BlockDistributionBody struct {
  151. Timestamp time.Time `json:"timestamp"`
  152. Object BlockDistributionObject `json:"object,omitempty"`
  153. }
  154. type BlockDistribution struct {
  155. Timestamp time.Time `json:"timestamp"`
  156. Source Source `json:"source"`
  157. Category string `json:"category"`
  158. Body BlockDistributionBody `json:"body"`
  159. }
  160. // ObjectChange Object变化信息
  161. type ObjectChangeBody struct {
  162. Type string `json:"type"`
  163. ObjectID string `json:"objectID"`
  164. PackageID string `json:"packageID"`
  165. Path string `json:"path"`
  166. Size int `json:"size"`
  167. BlockDistribution []BlockDistribution `json:"blockDistribution"`
  168. Timestamp time.Time `json:"timestamp"`
  169. }
  170. type ObjectChange struct {
  171. Timestamp time.Time `json:"timestamp"`
  172. Source Source `json:"source"`
  173. Category string `json:"category"`
  174. Body ObjectChangeBody `json:"body"`
  175. }
  176. // PackageChange package变化信息
  177. type PackageChangeBody struct {
  178. Type string `json:"type"`
  179. PackageID string `json:"packageID"`
  180. PackageName string `json:"packageName"`
  181. BucketID string `json:"bucketID"`
  182. Timestamp string `json:"timestamp"`
  183. }
  184. type PackageChange struct {
  185. Timestamp time.Time `json:"timestamp"`
  186. Source Source `json:"source"`
  187. Category string `json:"category"`
  188. Body PackageChangeBody `json:"body"`
  189. }
  190. // BucketChange bucket变化信息
  191. type BucketChangeBody struct {
  192. Type string `json:"type"`
  193. BucketID string `json:"bucketID"`
  194. BucketName string `json:"bucketName"`
  195. Timestamp time.Time `json:"timestamp"`
  196. }
  197. type BucketChange struct {
  198. Timestamp time.Time `json:"timestamp"`
  199. Source Source `json:"source"`
  200. Category string `json:"category"`
  201. Body BucketChangeBody `json:"body"`
  202. }

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