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.

319 lines
7.9 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. uint32 max_volume_count = 4;
  56. uint32 max_ssd_volume_count = 20;
  57. }
  58. message HeartbeatResponse {
  59. uint64 volume_size_limit = 1;
  60. string leader = 2;
  61. string metrics_address = 3;
  62. uint32 metrics_interval_seconds = 4;
  63. repeated StorageBackend storage_backends = 5;
  64. }
  65. message VolumeInformationMessage {
  66. uint32 id = 1;
  67. uint64 size = 2;
  68. string collection = 3;
  69. uint64 file_count = 4;
  70. uint64 delete_count = 5;
  71. uint64 deleted_byte_count = 6;
  72. bool read_only = 7;
  73. uint32 replica_placement = 8;
  74. uint32 version = 9;
  75. uint32 ttl = 10;
  76. uint32 compact_revision = 11;
  77. int64 modified_at_second = 12;
  78. string remote_storage_name = 13;
  79. string remote_storage_key = 14;
  80. string disk_type = 15;
  81. }
  82. message VolumeShortInformationMessage {
  83. uint32 id = 1;
  84. string collection = 3;
  85. uint32 replica_placement = 8;
  86. uint32 version = 9;
  87. uint32 ttl = 10;
  88. string disk_type = 15;
  89. }
  90. message VolumeEcShardInformationMessage {
  91. uint32 id = 1;
  92. string collection = 2;
  93. uint32 ec_index_bits = 3;
  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 DataNodeInfo {
  191. string id = 1;
  192. uint64 volume_count = 2;
  193. uint64 max_volume_count = 3;
  194. uint64 free_volume_count = 4;
  195. uint64 active_volume_count = 5;
  196. repeated VolumeInformationMessage volume_infos = 6;
  197. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  198. uint64 remote_volume_count = 8;
  199. uint64 max_ssd_volume_count = 9;
  200. uint64 ssd_volume_count = 10;
  201. }
  202. message RackInfo {
  203. string id = 1;
  204. uint64 volume_count = 2;
  205. uint64 max_volume_count = 3;
  206. uint64 free_volume_count = 4;
  207. uint64 active_volume_count = 5;
  208. repeated DataNodeInfo data_node_infos = 6;
  209. uint64 remote_volume_count = 7;
  210. uint64 max_ssd_volume_count = 8;
  211. uint64 ssd_volume_count = 9;
  212. }
  213. message DataCenterInfo {
  214. string id = 1;
  215. uint64 volume_count = 2;
  216. uint64 max_volume_count = 3;
  217. uint64 free_volume_count = 4;
  218. uint64 active_volume_count = 5;
  219. repeated RackInfo rack_infos = 6;
  220. uint64 remote_volume_count = 7;
  221. uint64 max_ssd_volume_count = 8;
  222. uint64 ssd_volume_count = 9;
  223. }
  224. message TopologyInfo {
  225. string id = 1;
  226. uint64 volume_count = 2;
  227. uint64 max_volume_count = 3;
  228. uint64 free_volume_count = 4;
  229. uint64 active_volume_count = 5;
  230. repeated DataCenterInfo data_center_infos = 6;
  231. uint64 remote_volume_count = 7;
  232. uint64 max_ssd_volume_count = 8;
  233. uint64 ssd_volume_count = 9;
  234. }
  235. message VolumeListRequest {
  236. }
  237. message VolumeListResponse {
  238. TopologyInfo topology_info = 1;
  239. uint64 volume_size_limit_mb = 2;
  240. }
  241. message LookupEcVolumeRequest {
  242. uint32 volume_id = 1;
  243. }
  244. message LookupEcVolumeResponse {
  245. uint32 volume_id = 1;
  246. message EcShardIdLocation {
  247. uint32 shard_id = 1;
  248. repeated Location locations = 2;
  249. }
  250. repeated EcShardIdLocation shard_id_locations = 2;
  251. }
  252. message VacuumVolumeRequest {
  253. float garbage_threshold = 1;
  254. }
  255. message VacuumVolumeResponse {
  256. }
  257. message GetMasterConfigurationRequest {
  258. }
  259. message GetMasterConfigurationResponse {
  260. string metrics_address = 1;
  261. uint32 metrics_interval_seconds = 2;
  262. repeated StorageBackend storage_backends = 3;
  263. string default_replication = 4;
  264. string leader = 5;
  265. }
  266. message ListMasterClientsRequest {
  267. string client_type = 1;
  268. }
  269. message ListMasterClientsResponse {
  270. repeated string grpc_addresses = 1;
  271. }
  272. message LeaseAdminTokenRequest {
  273. int64 previous_token = 1;
  274. int64 previous_lock_time = 2;
  275. string lock_name = 3;
  276. }
  277. message LeaseAdminTokenResponse {
  278. int64 token = 1;
  279. int64 lock_ts_ns = 2;
  280. }
  281. message ReleaseAdminTokenRequest {
  282. int64 previous_token = 1;
  283. int64 previous_lock_time = 2;
  284. string lock_name = 3;
  285. }
  286. message ReleaseAdminTokenResponse {
  287. }