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.

196 lines
4.3 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 volume ids
  34. repeated uint32 new_vids = 10;
  35. repeated uint32 deleted_vids = 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. }
  53. message Empty {
  54. }
  55. message SuperBlockExtra {
  56. message ErasureCoding {
  57. uint32 data = 1;
  58. uint32 parity = 2;
  59. repeated uint32 volume_ids = 3;
  60. }
  61. ErasureCoding erasure_coding = 1;
  62. }
  63. message ClientListenRequest {
  64. string name = 1;
  65. }
  66. message VolumeLocation {
  67. string url = 1;
  68. string public_url = 2;
  69. repeated uint32 new_vids = 3;
  70. repeated uint32 deleted_vids = 4;
  71. }
  72. message LookupVolumeRequest {
  73. repeated string volume_ids = 1;
  74. string collection = 2; // optional, a bit faster if provided.
  75. }
  76. message LookupVolumeResponse {
  77. message VolumeIdLocation {
  78. string volume_id = 1;
  79. repeated Location locations = 2;
  80. string error = 3;
  81. }
  82. repeated VolumeIdLocation volume_id_locations = 1;
  83. }
  84. message Location {
  85. string url = 1;
  86. string public_url = 2;
  87. }
  88. message AssignRequest {
  89. uint64 count = 1;
  90. string replication = 2;
  91. string collection = 3;
  92. string ttl = 4;
  93. string data_center = 5;
  94. string rack = 6;
  95. string data_node = 7;
  96. }
  97. message AssignResponse {
  98. string fid = 1;
  99. string url = 2;
  100. string public_url = 3;
  101. uint64 count = 4;
  102. string error = 5;
  103. string auth = 6;
  104. }
  105. message StatisticsRequest {
  106. string replication = 1;
  107. string collection = 2;
  108. string ttl = 3;
  109. }
  110. message StatisticsResponse {
  111. string replication = 1;
  112. string collection = 2;
  113. string ttl = 3;
  114. uint64 total_size = 4;
  115. uint64 used_size = 5;
  116. uint64 file_count = 6;
  117. }
  118. //
  119. // collection related
  120. //
  121. message StorageType {
  122. string replication = 1;
  123. string ttl = 2;
  124. }
  125. message Collection {
  126. string name = 1;
  127. }
  128. message CollectionListRequest {
  129. }
  130. message CollectionListResponse {
  131. repeated Collection collections = 1;
  132. }
  133. message CollectionDeleteRequest {
  134. string name = 1;
  135. }
  136. message CollectionDeleteResponse {
  137. }
  138. //
  139. // volume related
  140. //
  141. message DataNodeInfo {
  142. string id = 1;
  143. uint64 volume_count = 2;
  144. uint64 max_volume_count = 3;
  145. uint64 free_volume_count = 4;
  146. uint64 active_volume_count = 5;
  147. repeated VolumeInformationMessage volume_infos = 6;
  148. }
  149. message RackInfo {
  150. string id = 1;
  151. uint64 volume_count = 2;
  152. uint64 max_volume_count = 3;
  153. uint64 free_volume_count = 4;
  154. uint64 active_volume_count = 5;
  155. repeated DataNodeInfo data_node_infos = 6;
  156. }
  157. message DataCenterInfo {
  158. string id = 1;
  159. uint64 volume_count = 2;
  160. uint64 max_volume_count = 3;
  161. uint64 free_volume_count = 4;
  162. uint64 active_volume_count = 5;
  163. repeated RackInfo rack_infos = 6;
  164. }
  165. message TopologyInfo {
  166. string id = 1;
  167. uint64 volume_count = 2;
  168. uint64 max_volume_count = 3;
  169. uint64 free_volume_count = 4;
  170. uint64 active_volume_count = 5;
  171. repeated DataCenterInfo data_center_infos = 6;
  172. }
  173. message VolumeListRequest {
  174. }
  175. message VolumeListResponse {
  176. TopologyInfo topology_info = 1;
  177. }