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.

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