master.proto 7.3 KB

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