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.

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