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.

387 lines
9.0 KiB

5 years ago
7 years ago
3 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. string data_center = 6;
  127. string rack = 7;
  128. }
  129. message VolumeLocation {
  130. string url = 1;
  131. string public_url = 2;
  132. repeated uint32 new_vids = 3;
  133. repeated uint32 deleted_vids = 4;
  134. string leader = 5; // optional when leader is not itself
  135. string data_center = 6; // optional when DataCenter is in use
  136. uint32 grpc_port = 7;
  137. repeated uint32 new_ec_vids = 8;
  138. repeated uint32 deleted_ec_vids = 9;
  139. }
  140. message ClusterNodeUpdate {
  141. string node_type = 1;
  142. string address = 2;
  143. bool is_leader = 3;
  144. bool is_add = 4;
  145. string filer_group = 5;
  146. int64 created_at_ns = 6;
  147. }
  148. message KeepConnectedResponse {
  149. VolumeLocation volume_location = 1;
  150. ClusterNodeUpdate cluster_node_update = 2;
  151. }
  152. message LookupVolumeRequest {
  153. repeated string volume_or_file_ids = 1;
  154. string collection = 2; // optional, a bit faster if provided.
  155. }
  156. message LookupVolumeResponse {
  157. message VolumeIdLocation {
  158. string volume_or_file_id = 1;
  159. repeated Location locations = 2;
  160. string error = 3;
  161. string auth = 4;
  162. }
  163. repeated VolumeIdLocation volume_id_locations = 1;
  164. }
  165. message Location {
  166. string url = 1;
  167. string public_url = 2;
  168. uint32 grpc_port = 3;
  169. }
  170. message AssignRequest {
  171. uint64 count = 1;
  172. string replication = 2;
  173. string collection = 3;
  174. string ttl = 4;
  175. string data_center = 5;
  176. string rack = 6;
  177. string data_node = 7;
  178. uint32 memory_map_max_size_mb = 8;
  179. uint32 Writable_volume_count = 9;
  180. string disk_type = 10;
  181. }
  182. message AssignResponse {
  183. string fid = 1;
  184. uint64 count = 4;
  185. string error = 5;
  186. string auth = 6;
  187. repeated Location replicas = 7;
  188. Location location = 8;
  189. }
  190. message StatisticsRequest {
  191. string replication = 1;
  192. string collection = 2;
  193. string ttl = 3;
  194. string disk_type = 4;
  195. }
  196. message StatisticsResponse {
  197. uint64 total_size = 4;
  198. uint64 used_size = 5;
  199. uint64 file_count = 6;
  200. }
  201. //
  202. // collection related
  203. //
  204. message Collection {
  205. string name = 1;
  206. }
  207. message CollectionListRequest {
  208. bool include_normal_volumes = 1;
  209. bool include_ec_volumes = 2;
  210. }
  211. message CollectionListResponse {
  212. repeated Collection collections = 1;
  213. }
  214. message CollectionDeleteRequest {
  215. string name = 1;
  216. }
  217. message CollectionDeleteResponse {
  218. }
  219. //
  220. // volume related
  221. //
  222. message DiskInfo {
  223. string type = 1;
  224. int64 volume_count = 2;
  225. int64 max_volume_count = 3;
  226. int64 free_volume_count = 4;
  227. int64 active_volume_count = 5;
  228. repeated VolumeInformationMessage volume_infos = 6;
  229. repeated VolumeEcShardInformationMessage ec_shard_infos = 7;
  230. int64 remote_volume_count = 8;
  231. }
  232. message DataNodeInfo {
  233. string id = 1;
  234. map<string, DiskInfo> diskInfos = 2;
  235. uint32 grpc_port = 3;
  236. }
  237. message RackInfo {
  238. string id = 1;
  239. repeated DataNodeInfo data_node_infos = 2;
  240. map<string, DiskInfo> diskInfos = 3;
  241. }
  242. message DataCenterInfo {
  243. string id = 1;
  244. repeated RackInfo rack_infos = 2;
  245. map<string, DiskInfo> diskInfos = 3;
  246. }
  247. message TopologyInfo {
  248. string id = 1;
  249. repeated DataCenterInfo data_center_infos = 2;
  250. map<string, DiskInfo> diskInfos = 3;
  251. }
  252. message VolumeListRequest {
  253. }
  254. message VolumeListResponse {
  255. TopologyInfo topology_info = 1;
  256. uint64 volume_size_limit_mb = 2;
  257. }
  258. message LookupEcVolumeRequest {
  259. uint32 volume_id = 1;
  260. }
  261. message LookupEcVolumeResponse {
  262. uint32 volume_id = 1;
  263. message EcShardIdLocation {
  264. uint32 shard_id = 1;
  265. repeated Location locations = 2;
  266. }
  267. repeated EcShardIdLocation shard_id_locations = 2;
  268. }
  269. message VacuumVolumeRequest {
  270. float garbage_threshold = 1;
  271. uint32 volume_id = 2;
  272. string collection = 3;
  273. }
  274. message VacuumVolumeResponse {
  275. }
  276. message GetMasterConfigurationRequest {
  277. }
  278. message GetMasterConfigurationResponse {
  279. string metrics_address = 1;
  280. uint32 metrics_interval_seconds = 2;
  281. repeated StorageBackend storage_backends = 3;
  282. string default_replication = 4;
  283. string leader = 5;
  284. uint32 volume_size_limit_m_b = 6;
  285. bool volume_preallocate = 7;
  286. }
  287. message ListClusterNodesRequest {
  288. string client_type = 1;
  289. string filer_group = 2;
  290. }
  291. message ListClusterNodesResponse {
  292. message ClusterNode {
  293. string address = 1;
  294. string version = 2;
  295. bool is_leader = 3;
  296. int64 created_at_ns = 4;
  297. string data_center = 5;
  298. string rack = 6;
  299. }
  300. repeated ClusterNode cluster_nodes = 1;
  301. }
  302. message LeaseAdminTokenRequest {
  303. int64 previous_token = 1;
  304. int64 previous_lock_time = 2;
  305. string lock_name = 3;
  306. string client_name = 4;
  307. string message = 5;
  308. }
  309. message LeaseAdminTokenResponse {
  310. int64 token = 1;
  311. int64 lock_ts_ns = 2;
  312. }
  313. message ReleaseAdminTokenRequest {
  314. int64 previous_token = 1;
  315. int64 previous_lock_time = 2;
  316. string lock_name = 3;
  317. }
  318. message ReleaseAdminTokenResponse {
  319. }
  320. message PingRequest {
  321. string target = 1; // default to ping itself
  322. string target_type = 2;
  323. }
  324. message PingResponse {
  325. int64 start_time_ns = 1;
  326. int64 remote_time_ns = 2;
  327. int64 stop_time_ns = 3;
  328. }
  329. message RaftAddServerRequest {
  330. string id = 1;
  331. string address = 2;
  332. bool voter = 3;
  333. }
  334. message RaftAddServerResponse {
  335. }
  336. message RaftRemoveServerRequest {
  337. string id = 1;
  338. bool force = 2;
  339. }
  340. message RaftRemoveServerResponse {
  341. }
  342. message RaftListClusterServersRequest {
  343. }
  344. message RaftListClusterServersResponse {
  345. message ClusterServers {
  346. string id = 1;
  347. string address = 2;
  348. string suffrage = 3; //
  349. }
  350. repeated ClusterServers cluster_servers = 1;
  351. }