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.

307 lines
7.5 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. }
  159. message StatisticsRequest {
  160. string replication = 1;
  161. string collection = 2;
  162. string ttl = 3;
  163. string disk_type = 4;
  164. }
  165. message StatisticsResponse {
  166. uint64 total_size = 4;
  167. uint64 used_size = 5;
  168. uint64 file_count = 6;
  169. }
  170. //
  171. // collection related
  172. //
  173. message Collection {
  174. string name = 1;
  175. }
  176. message CollectionListRequest {
  177. bool include_normal_volumes = 1;
  178. bool include_ec_volumes = 2;
  179. }
  180. message CollectionListResponse {
  181. repeated Collection collections = 1;
  182. }
  183. message CollectionDeleteRequest {
  184. string name = 1;
  185. }
  186. message CollectionDeleteResponse {
  187. }
  188. //
  189. // volume related
  190. //
  191. message DiskInfo {
  192. string type = 1;
  193. int64 volume_count = 2;
  194. int64 max_volume_count = 3;
  195. int64 free_volume_count = 4;
  196. int64 active_volume_count = 5;
  197. repeated VolumeInformationMessage volume_infos = 6;
  198. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  199. int64 remote_volume_count = 8;
  200. }
  201. message DataNodeInfo {
  202. string id = 1;
  203. map<string, DiskInfo> diskInfos = 2;
  204. }
  205. message RackInfo {
  206. string id = 1;
  207. repeated DataNodeInfo data_node_infos = 2;
  208. map<string, DiskInfo> diskInfos = 3;
  209. }
  210. message DataCenterInfo {
  211. string id = 1;
  212. repeated RackInfo rack_infos = 2;
  213. map<string, DiskInfo> diskInfos = 3;
  214. }
  215. message TopologyInfo {
  216. string id = 1;
  217. repeated DataCenterInfo data_center_infos = 2;
  218. map<string, DiskInfo> diskInfos = 3;
  219. }
  220. message VolumeListRequest {
  221. }
  222. message VolumeListResponse {
  223. TopologyInfo topology_info = 1;
  224. uint64 volume_size_limit_mb = 2;
  225. }
  226. message LookupEcVolumeRequest {
  227. uint32 volume_id = 1;
  228. }
  229. message LookupEcVolumeResponse {
  230. uint32 volume_id = 1;
  231. message EcShardIdLocation {
  232. uint32 shard_id = 1;
  233. repeated Location locations = 2;
  234. }
  235. repeated EcShardIdLocation shard_id_locations = 2;
  236. }
  237. message VacuumVolumeRequest {
  238. float garbage_threshold = 1;
  239. }
  240. message VacuumVolumeResponse {
  241. }
  242. message GetMasterConfigurationRequest {
  243. }
  244. message GetMasterConfigurationResponse {
  245. string metrics_address = 1;
  246. uint32 metrics_interval_seconds = 2;
  247. repeated StorageBackend storage_backends = 3;
  248. string default_replication = 4;
  249. string leader = 5;
  250. uint32 volume_size_limit_m_b = 6;
  251. bool volume_preallocate = 7;
  252. }
  253. message ListMasterClientsRequest {
  254. string client_type = 1;
  255. }
  256. message ListMasterClientsResponse {
  257. repeated string grpc_addresses = 1;
  258. }
  259. message LeaseAdminTokenRequest {
  260. int64 previous_token = 1;
  261. int64 previous_lock_time = 2;
  262. string lock_name = 3;
  263. string client_name = 4;
  264. }
  265. message LeaseAdminTokenResponse {
  266. int64 token = 1;
  267. int64 lock_ts_ns = 2;
  268. }
  269. message ReleaseAdminTokenRequest {
  270. int64 previous_token = 1;
  271. int64 previous_lock_time = 2;
  272. string lock_name = 3;
  273. }
  274. message ReleaseAdminTokenResponse {
  275. }