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.

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