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.

340 lines
7.9 KiB

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