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

204 lines
4.6 KiB

7 years ago
7 years ago
7 years ago
7 years ago
  1. syntax = "proto3";
  2. package master_pb;
  3. //////////////////////////////////////////////////
  4. service Seaweed {
  5. rpc SendHeartbeat (stream Heartbeat) returns (stream HeartbeatResponse) {
  6. }
  7. rpc KeepConnected (stream ClientListenRequest) returns (stream VolumeLocation) {
  8. }
  9. rpc LookupVolume (LookupVolumeRequest) returns (LookupVolumeResponse) {
  10. }
  11. rpc Assign (AssignRequest) returns (AssignResponse) {
  12. }
  13. rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
  14. }
  15. rpc CollectionList (CollectionListRequest) returns (CollectionListResponse) {
  16. }
  17. rpc CollectionDelete (CollectionDeleteRequest) returns (CollectionDeleteResponse) {
  18. }
  19. rpc VolumeList (VolumeListRequest) returns (VolumeListResponse) {
  20. }
  21. }
  22. //////////////////////////////////////////////////
  23. message Heartbeat {
  24. string ip = 1;
  25. uint32 port = 2;
  26. string public_url = 3;
  27. uint32 max_volume_count = 4;
  28. uint64 max_file_key = 5;
  29. string data_center = 6;
  30. string rack = 7;
  31. uint32 admin_port = 8;
  32. repeated VolumeInformationMessage volumes = 9;
  33. // delta volumes
  34. repeated VolumeShortInformationMessage new_volumes = 10;
  35. repeated VolumeShortInformationMessage deleted_volumes = 11;
  36. }
  37. message HeartbeatResponse {
  38. uint64 volumeSizeLimit = 1;
  39. string leader = 3;
  40. }
  41. message VolumeInformationMessage {
  42. uint32 id = 1;
  43. uint64 size = 2;
  44. string collection = 3;
  45. uint64 file_count = 4;
  46. uint64 delete_count = 5;
  47. uint64 deleted_byte_count = 6;
  48. bool read_only = 7;
  49. uint32 replica_placement = 8;
  50. uint32 version = 9;
  51. uint32 ttl = 10;
  52. uint32 compact_revision = 11;
  53. }
  54. message VolumeShortInformationMessage {
  55. uint32 id = 1;
  56. string collection = 3;
  57. uint32 replica_placement = 8;
  58. uint32 ttl = 10;
  59. }
  60. message Empty {
  61. }
  62. message SuperBlockExtra {
  63. message ErasureCoding {
  64. uint32 data = 1;
  65. uint32 parity = 2;
  66. repeated uint32 volume_ids = 3;
  67. }
  68. ErasureCoding erasure_coding = 1;
  69. }
  70. message ClientListenRequest {
  71. string name = 1;
  72. }
  73. message VolumeLocation {
  74. string url = 1;
  75. string public_url = 2;
  76. repeated uint32 new_vids = 3;
  77. repeated uint32 deleted_vids = 4;
  78. }
  79. message LookupVolumeRequest {
  80. repeated string volume_ids = 1;
  81. string collection = 2; // optional, a bit faster if provided.
  82. }
  83. message LookupVolumeResponse {
  84. message VolumeIdLocation {
  85. string volume_id = 1;
  86. repeated Location locations = 2;
  87. string error = 3;
  88. }
  89. repeated VolumeIdLocation volume_id_locations = 1;
  90. }
  91. message Location {
  92. string url = 1;
  93. string public_url = 2;
  94. }
  95. message AssignRequest {
  96. uint64 count = 1;
  97. string replication = 2;
  98. string collection = 3;
  99. string ttl = 4;
  100. string data_center = 5;
  101. string rack = 6;
  102. string data_node = 7;
  103. }
  104. message AssignResponse {
  105. string fid = 1;
  106. string url = 2;
  107. string public_url = 3;
  108. uint64 count = 4;
  109. string error = 5;
  110. string auth = 6;
  111. }
  112. message StatisticsRequest {
  113. string replication = 1;
  114. string collection = 2;
  115. string ttl = 3;
  116. }
  117. message StatisticsResponse {
  118. string replication = 1;
  119. string collection = 2;
  120. string ttl = 3;
  121. uint64 total_size = 4;
  122. uint64 used_size = 5;
  123. uint64 file_count = 6;
  124. }
  125. //
  126. // collection related
  127. //
  128. message StorageType {
  129. string replication = 1;
  130. string ttl = 2;
  131. }
  132. message Collection {
  133. string name = 1;
  134. }
  135. message CollectionListRequest {
  136. }
  137. message CollectionListResponse {
  138. repeated Collection collections = 1;
  139. }
  140. message CollectionDeleteRequest {
  141. string name = 1;
  142. }
  143. message CollectionDeleteResponse {
  144. }
  145. //
  146. // volume related
  147. //
  148. message DataNodeInfo {
  149. string id = 1;
  150. uint64 volume_count = 2;
  151. uint64 max_volume_count = 3;
  152. uint64 free_volume_count = 4;
  153. uint64 active_volume_count = 5;
  154. repeated VolumeInformationMessage volume_infos = 6;
  155. }
  156. message RackInfo {
  157. string id = 1;
  158. uint64 volume_count = 2;
  159. uint64 max_volume_count = 3;
  160. uint64 free_volume_count = 4;
  161. uint64 active_volume_count = 5;
  162. repeated DataNodeInfo data_node_infos = 6;
  163. }
  164. message DataCenterInfo {
  165. string id = 1;
  166. uint64 volume_count = 2;
  167. uint64 max_volume_count = 3;
  168. uint64 free_volume_count = 4;
  169. uint64 active_volume_count = 5;
  170. repeated RackInfo rack_infos = 6;
  171. }
  172. message TopologyInfo {
  173. string id = 1;
  174. uint64 volume_count = 2;
  175. uint64 max_volume_count = 3;
  176. uint64 free_volume_count = 4;
  177. uint64 active_volume_count = 5;
  178. repeated DataCenterInfo data_center_infos = 6;
  179. }
  180. message VolumeListRequest {
  181. }
  182. message VolumeListResponse {
  183. TopologyInfo topology_info = 1;
  184. }