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.

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