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.

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