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.

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