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.

304 lines
7.4 KiB

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