master.proto 7.6 KB

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