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.

312 lines
7.6 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_or_file_ids = 1;
  124. string collection = 2; // optional, a bit faster if provided.
  125. }
  126. message LookupVolumeResponse {
  127. message VolumeIdLocation {
  128. string volume_or_file_id = 1;
  129. repeated Location locations = 2;
  130. string error = 3;
  131. string auth = 4;
  132. }
  133. repeated VolumeIdLocation volume_id_locations = 1;
  134. }
  135. message Location {
  136. string url = 1;
  137. string public_url = 2;
  138. }
  139. message AssignRequest {
  140. uint64 count = 1;
  141. string replication = 2;
  142. string collection = 3;
  143. string ttl = 4;
  144. string data_center = 5;
  145. string rack = 6;
  146. string data_node = 7;
  147. uint32 memory_map_max_size_mb = 8;
  148. uint32 Writable_volume_count = 9;
  149. string disk_type = 10;
  150. }
  151. message AssignResponse {
  152. string fid = 1;
  153. string url = 2;
  154. string public_url = 3;
  155. uint64 count = 4;
  156. string error = 5;
  157. string auth = 6;
  158. message Replica {
  159. string url = 1;
  160. string public_url = 2;
  161. }
  162. repeated Replica replicas = 7;
  163. }
  164. message StatisticsRequest {
  165. string replication = 1;
  166. string collection = 2;
  167. string ttl = 3;
  168. string disk_type = 4;
  169. }
  170. message StatisticsResponse {
  171. uint64 total_size = 4;
  172. uint64 used_size = 5;
  173. uint64 file_count = 6;
  174. }
  175. //
  176. // collection related
  177. //
  178. message Collection {
  179. string name = 1;
  180. }
  181. message CollectionListRequest {
  182. bool include_normal_volumes = 1;
  183. bool include_ec_volumes = 2;
  184. }
  185. message CollectionListResponse {
  186. repeated Collection collections = 1;
  187. }
  188. message CollectionDeleteRequest {
  189. string name = 1;
  190. }
  191. message CollectionDeleteResponse {
  192. }
  193. //
  194. // volume related
  195. //
  196. message DiskInfo {
  197. string type = 1;
  198. int64 volume_count = 2;
  199. int64 max_volume_count = 3;
  200. int64 free_volume_count = 4;
  201. int64 active_volume_count = 5;
  202. repeated VolumeInformationMessage volume_infos = 6;
  203. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  204. int64 remote_volume_count = 8;
  205. }
  206. message DataNodeInfo {
  207. string id = 1;
  208. map<string, DiskInfo> diskInfos = 2;
  209. }
  210. message RackInfo {
  211. string id = 1;
  212. repeated DataNodeInfo data_node_infos = 2;
  213. map<string, DiskInfo> diskInfos = 3;
  214. }
  215. message DataCenterInfo {
  216. string id = 1;
  217. repeated RackInfo rack_infos = 2;
  218. map<string, DiskInfo> diskInfos = 3;
  219. }
  220. message TopologyInfo {
  221. string id = 1;
  222. repeated DataCenterInfo data_center_infos = 2;
  223. map<string, DiskInfo> diskInfos = 3;
  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 VacuumVolumeRequest {
  243. float garbage_threshold = 1;
  244. }
  245. message VacuumVolumeResponse {
  246. }
  247. message GetMasterConfigurationRequest {
  248. }
  249. message GetMasterConfigurationResponse {
  250. string metrics_address = 1;
  251. uint32 metrics_interval_seconds = 2;
  252. repeated StorageBackend storage_backends = 3;
  253. string default_replication = 4;
  254. string leader = 5;
  255. uint32 volume_size_limit_m_b = 6;
  256. bool volume_preallocate = 7;
  257. }
  258. message ListMasterClientsRequest {
  259. string client_type = 1;
  260. }
  261. message ListMasterClientsResponse {
  262. repeated string grpc_addresses = 1;
  263. }
  264. message LeaseAdminTokenRequest {
  265. int64 previous_token = 1;
  266. int64 previous_lock_time = 2;
  267. string lock_name = 3;
  268. string client_name = 4;
  269. }
  270. message LeaseAdminTokenResponse {
  271. int64 token = 1;
  272. int64 lock_ts_ns = 2;
  273. }
  274. message ReleaseAdminTokenRequest {
  275. int64 previous_token = 1;
  276. int64 previous_lock_time = 2;
  277. string lock_name = 3;
  278. }
  279. message ReleaseAdminTokenResponse {
  280. }