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.

297 lines
7.2 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 KeepConnectedRequest) 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. rpc LookupEcVolume (LookupEcVolumeRequest) returns (LookupEcVolumeResponse) {
  22. }
  23. rpc GetMasterConfiguration (GetMasterConfigurationRequest) returns (GetMasterConfigurationResponse) {
  24. }
  25. rpc ListMasterClients (ListMasterClientsRequest) returns (ListMasterClientsResponse) {
  26. }
  27. rpc LeaseAdminToken (LeaseAdminTokenRequest) returns (LeaseAdminTokenResponse) {
  28. }
  29. rpc ReleaseAdminToken (ReleaseAdminTokenRequest) returns (ReleaseAdminTokenResponse) {
  30. }
  31. }
  32. //////////////////////////////////////////////////
  33. message Heartbeat {
  34. string ip = 1;
  35. uint32 port = 2;
  36. string public_url = 3;
  37. uint32 max_volume_count = 4;
  38. uint64 max_file_key = 5;
  39. string data_center = 6;
  40. string rack = 7;
  41. uint32 admin_port = 8;
  42. repeated VolumeInformationMessage volumes = 9;
  43. // delta volumes
  44. repeated VolumeShortInformationMessage new_volumes = 10;
  45. repeated VolumeShortInformationMessage deleted_volumes = 11;
  46. bool has_no_volumes = 12;
  47. // erasure coding
  48. repeated VolumeEcShardInformationMessage ec_shards = 16;
  49. // delta erasure coding shards
  50. repeated VolumeEcShardInformationMessage new_ec_shards = 17;
  51. repeated VolumeEcShardInformationMessage deleted_ec_shards = 18;
  52. bool has_no_ec_shards = 19;
  53. }
  54. message HeartbeatResponse {
  55. uint64 volume_size_limit = 1;
  56. string leader = 2;
  57. string metrics_address = 3;
  58. uint32 metrics_interval_seconds = 4;
  59. repeated StorageBackend storage_backends = 5;
  60. }
  61. message VolumeInformationMessage {
  62. uint32 id = 1;
  63. uint64 size = 2;
  64. string collection = 3;
  65. uint64 file_count = 4;
  66. uint64 delete_count = 5;
  67. uint64 deleted_byte_count = 6;
  68. bool read_only = 7;
  69. uint32 replica_placement = 8;
  70. uint32 version = 9;
  71. uint32 ttl = 10;
  72. uint32 compact_revision = 11;
  73. int64 modified_at_second = 12;
  74. string remote_storage_name = 13;
  75. string remote_storage_key = 14;
  76. }
  77. message VolumeShortInformationMessage {
  78. uint32 id = 1;
  79. string collection = 3;
  80. uint32 replica_placement = 8;
  81. uint32 version = 9;
  82. uint32 ttl = 10;
  83. }
  84. message VolumeEcShardInformationMessage {
  85. uint32 id = 1;
  86. string collection = 2;
  87. uint32 ec_index_bits = 3;
  88. }
  89. message StorageBackend {
  90. string type = 1;
  91. string id = 2;
  92. map<string, string> properties = 3;
  93. }
  94. message Empty {
  95. }
  96. message SuperBlockExtra {
  97. message ErasureCoding {
  98. uint32 data = 1;
  99. uint32 parity = 2;
  100. repeated uint32 volume_ids = 3;
  101. }
  102. ErasureCoding erasure_coding = 1;
  103. }
  104. message KeepConnectedRequest {
  105. string name = 1;
  106. uint32 grpc_port = 2;
  107. }
  108. message VolumeLocation {
  109. string url = 1;
  110. string public_url = 2;
  111. repeated uint32 new_vids = 3;
  112. repeated uint32 deleted_vids = 4;
  113. string leader = 5; // optional when leader is not itself
  114. }
  115. message LookupVolumeRequest {
  116. repeated string volume_ids = 1;
  117. string collection = 2; // optional, a bit faster if provided.
  118. }
  119. message LookupVolumeResponse {
  120. message VolumeIdLocation {
  121. string volume_id = 1;
  122. repeated Location locations = 2;
  123. string error = 3;
  124. }
  125. repeated VolumeIdLocation volume_id_locations = 1;
  126. }
  127. message Location {
  128. string url = 1;
  129. string public_url = 2;
  130. }
  131. message AssignRequest {
  132. uint64 count = 1;
  133. string replication = 2;
  134. string collection = 3;
  135. string ttl = 4;
  136. string data_center = 5;
  137. string rack = 6;
  138. string data_node = 7;
  139. uint32 memory_map_max_size_mb = 8;
  140. uint32 Writable_volume_count = 9;
  141. }
  142. message AssignResponse {
  143. string fid = 1;
  144. string url = 2;
  145. string public_url = 3;
  146. uint64 count = 4;
  147. string error = 5;
  148. string auth = 6;
  149. }
  150. message StatisticsRequest {
  151. string replication = 1;
  152. string collection = 2;
  153. string ttl = 3;
  154. }
  155. message StatisticsResponse {
  156. string replication = 1;
  157. string collection = 2;
  158. string ttl = 3;
  159. uint64 total_size = 4;
  160. uint64 used_size = 5;
  161. uint64 file_count = 6;
  162. }
  163. //
  164. // collection related
  165. //
  166. message StorageType {
  167. string replication = 1;
  168. string ttl = 2;
  169. }
  170. message Collection {
  171. string name = 1;
  172. }
  173. message CollectionListRequest {
  174. bool include_normal_volumes = 1;
  175. bool include_ec_volumes = 2;
  176. }
  177. message CollectionListResponse {
  178. repeated Collection collections = 1;
  179. }
  180. message CollectionDeleteRequest {
  181. string name = 1;
  182. }
  183. message CollectionDeleteResponse {
  184. }
  185. //
  186. // volume related
  187. //
  188. message DataNodeInfo {
  189. string id = 1;
  190. uint64 volume_count = 2;
  191. uint64 max_volume_count = 3;
  192. uint64 free_volume_count = 4;
  193. uint64 active_volume_count = 5;
  194. repeated VolumeInformationMessage volume_infos = 6;
  195. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  196. uint64 remote_volume_count = 8;
  197. }
  198. message RackInfo {
  199. string id = 1;
  200. uint64 volume_count = 2;
  201. uint64 max_volume_count = 3;
  202. uint64 free_volume_count = 4;
  203. uint64 active_volume_count = 5;
  204. repeated DataNodeInfo data_node_infos = 6;
  205. uint64 remote_volume_count = 7;
  206. }
  207. message DataCenterInfo {
  208. string id = 1;
  209. uint64 volume_count = 2;
  210. uint64 max_volume_count = 3;
  211. uint64 free_volume_count = 4;
  212. uint64 active_volume_count = 5;
  213. repeated RackInfo rack_infos = 6;
  214. uint64 remote_volume_count = 7;
  215. }
  216. message TopologyInfo {
  217. string id = 1;
  218. uint64 volume_count = 2;
  219. uint64 max_volume_count = 3;
  220. uint64 free_volume_count = 4;
  221. uint64 active_volume_count = 5;
  222. repeated DataCenterInfo data_center_infos = 6;
  223. uint64 remote_volume_count = 7;
  224. }
  225. message VolumeListRequest {
  226. }
  227. message VolumeListResponse {
  228. TopologyInfo topology_info = 1;
  229. uint64 volume_size_limit_mb = 2;
  230. }
  231. message LookupEcVolumeRequest {
  232. uint32 volume_id = 1;
  233. }
  234. message LookupEcVolumeResponse {
  235. uint32 volume_id = 1;
  236. message EcShardIdLocation {
  237. uint32 shard_id = 1;
  238. repeated Location locations = 2;
  239. }
  240. repeated EcShardIdLocation shard_id_locations = 2;
  241. }
  242. message GetMasterConfigurationRequest {
  243. }
  244. message GetMasterConfigurationResponse {
  245. string metrics_address = 1;
  246. uint32 metrics_interval_seconds = 2;
  247. }
  248. message ListMasterClientsRequest {
  249. string client_type = 1;
  250. }
  251. message ListMasterClientsResponse {
  252. repeated string grpc_addresses = 1;
  253. }
  254. message LeaseAdminTokenRequest {
  255. int64 previous_token = 1;
  256. int64 previous_lock_time = 2;
  257. }
  258. message LeaseAdminTokenResponse {
  259. int64 token = 1;
  260. int64 lock_ts_ns = 2;
  261. }
  262. message ReleaseAdminTokenRequest {
  263. int64 previous_token = 1;
  264. int64 previous_lock_time = 2;
  265. }
  266. message ReleaseAdminTokenResponse {
  267. }