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.

311 lines
7.6 KiB

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