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.

553 lines
14 KiB

5 years ago
6 years ago
6 years ago
6 years ago
5 years ago
5 years ago
3 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
5 years ago
5 years ago
5 years ago
5 years ago
3 years ago
5 years ago
5 years ago
5 years ago
3 years ago
3 years ago
3 years ago
5 years ago
  1. syntax = "proto3";
  2. package volume_server_pb;
  3. option go_package = "github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb";
  4. import "remote.proto";
  5. //////////////////////////////////////////////////
  6. service VolumeServer {
  7. //Experts only: takes multiple fid parameters. This function does not propagate deletes to replicas.
  8. rpc BatchDelete (BatchDeleteRequest) returns (BatchDeleteResponse) {
  9. }
  10. rpc VacuumVolumeCheck (VacuumVolumeCheckRequest) returns (VacuumVolumeCheckResponse) {
  11. }
  12. rpc VacuumVolumeCompact (VacuumVolumeCompactRequest) returns (VacuumVolumeCompactResponse) {
  13. }
  14. rpc VacuumVolumeCommit (VacuumVolumeCommitRequest) returns (VacuumVolumeCommitResponse) {
  15. }
  16. rpc VacuumVolumeCleanup (VacuumVolumeCleanupRequest) returns (VacuumVolumeCleanupResponse) {
  17. }
  18. rpc DeleteCollection (DeleteCollectionRequest) returns (DeleteCollectionResponse) {
  19. }
  20. rpc AllocateVolume (AllocateVolumeRequest) returns (AllocateVolumeResponse) {
  21. }
  22. rpc VolumeSyncStatus (VolumeSyncStatusRequest) returns (VolumeSyncStatusResponse) {
  23. }
  24. rpc VolumeIncrementalCopy (VolumeIncrementalCopyRequest) returns (stream VolumeIncrementalCopyResponse) {
  25. }
  26. rpc VolumeMount (VolumeMountRequest) returns (VolumeMountResponse) {
  27. }
  28. rpc VolumeUnmount (VolumeUnmountRequest) returns (VolumeUnmountResponse) {
  29. }
  30. rpc VolumeDelete (VolumeDeleteRequest) returns (VolumeDeleteResponse) {
  31. }
  32. rpc VolumeMarkReadonly (VolumeMarkReadonlyRequest) returns (VolumeMarkReadonlyResponse) {
  33. }
  34. rpc VolumeMarkWritable (VolumeMarkWritableRequest) returns (VolumeMarkWritableResponse) {
  35. }
  36. rpc VolumeConfigure (VolumeConfigureRequest) returns (VolumeConfigureResponse) {
  37. }
  38. rpc VolumeStatus (VolumeStatusRequest) returns (VolumeStatusResponse) {
  39. }
  40. // copy the .idx .dat files, and mount this volume
  41. rpc VolumeCopy (VolumeCopyRequest) returns (VolumeCopyResponse) {
  42. }
  43. rpc ReadVolumeFileStatus (ReadVolumeFileStatusRequest) returns (ReadVolumeFileStatusResponse) {
  44. }
  45. rpc CopyFile (CopyFileRequest) returns (stream CopyFileResponse) {
  46. }
  47. rpc ReadNeedleBlob (ReadNeedleBlobRequest) returns (ReadNeedleBlobResponse) {
  48. }
  49. rpc WriteNeedleBlob (WriteNeedleBlobRequest) returns (WriteNeedleBlobResponse) {
  50. }
  51. rpc VolumeTailSender (VolumeTailSenderRequest) returns (stream VolumeTailSenderResponse) {
  52. }
  53. rpc VolumeTailReceiver (VolumeTailReceiverRequest) returns (VolumeTailReceiverResponse) {
  54. }
  55. // erasure coding
  56. rpc VolumeEcShardsGenerate (VolumeEcShardsGenerateRequest) returns (VolumeEcShardsGenerateResponse) {
  57. }
  58. rpc VolumeEcShardsRebuild (VolumeEcShardsRebuildRequest) returns (VolumeEcShardsRebuildResponse) {
  59. }
  60. rpc VolumeEcShardsCopy (VolumeEcShardsCopyRequest) returns (VolumeEcShardsCopyResponse) {
  61. }
  62. rpc VolumeEcShardsDelete (VolumeEcShardsDeleteRequest) returns (VolumeEcShardsDeleteResponse) {
  63. }
  64. rpc VolumeEcShardsMount (VolumeEcShardsMountRequest) returns (VolumeEcShardsMountResponse) {
  65. }
  66. rpc VolumeEcShardsUnmount (VolumeEcShardsUnmountRequest) returns (VolumeEcShardsUnmountResponse) {
  67. }
  68. rpc VolumeEcShardRead (VolumeEcShardReadRequest) returns (stream VolumeEcShardReadResponse) {
  69. }
  70. rpc VolumeEcBlobDelete (VolumeEcBlobDeleteRequest) returns (VolumeEcBlobDeleteResponse) {
  71. }
  72. rpc VolumeEcShardsToVolume (VolumeEcShardsToVolumeRequest) returns (VolumeEcShardsToVolumeResponse) {
  73. }
  74. // tiered storage
  75. rpc VolumeTierMoveDatToRemote (VolumeTierMoveDatToRemoteRequest) returns (stream VolumeTierMoveDatToRemoteResponse) {
  76. }
  77. rpc VolumeTierMoveDatFromRemote (VolumeTierMoveDatFromRemoteRequest) returns (stream VolumeTierMoveDatFromRemoteResponse) {
  78. }
  79. rpc VolumeServerStatus (VolumeServerStatusRequest) returns (VolumeServerStatusResponse) {
  80. }
  81. rpc VolumeServerLeave (VolumeServerLeaveRequest) returns (VolumeServerLeaveResponse) {
  82. }
  83. // remote storage
  84. rpc FetchAndWriteNeedle (FetchAndWriteNeedleRequest) returns (FetchAndWriteNeedleResponse) {
  85. }
  86. // <experimental> query
  87. rpc Query (QueryRequest) returns (stream QueriedStripe) {
  88. }
  89. rpc VolumeNeedleStatus (VolumeNeedleStatusRequest) returns (VolumeNeedleStatusResponse) {
  90. }
  91. }
  92. //////////////////////////////////////////////////
  93. message BatchDeleteRequest {
  94. repeated string file_ids = 1;
  95. bool skip_cookie_check = 2;
  96. }
  97. message BatchDeleteResponse {
  98. repeated DeleteResult results = 1;
  99. }
  100. message DeleteResult {
  101. string file_id = 1;
  102. int32 status = 2;
  103. string error = 3;
  104. uint32 size = 4;
  105. uint32 version = 5;
  106. }
  107. message Empty {
  108. }
  109. message VacuumVolumeCheckRequest {
  110. uint32 volume_id = 1;
  111. }
  112. message VacuumVolumeCheckResponse {
  113. double garbage_ratio = 1;
  114. }
  115. message VacuumVolumeCompactRequest {
  116. uint32 volume_id = 1;
  117. int64 preallocate = 2;
  118. }
  119. message VacuumVolumeCompactResponse {
  120. }
  121. message VacuumVolumeCommitRequest {
  122. uint32 volume_id = 1;
  123. }
  124. message VacuumVolumeCommitResponse {
  125. bool is_read_only = 1;
  126. }
  127. message VacuumVolumeCleanupRequest {
  128. uint32 volume_id = 1;
  129. }
  130. message VacuumVolumeCleanupResponse {
  131. }
  132. message DeleteCollectionRequest {
  133. string collection = 1;
  134. }
  135. message DeleteCollectionResponse {
  136. }
  137. message AllocateVolumeRequest {
  138. uint32 volume_id = 1;
  139. string collection = 2;
  140. int64 preallocate = 3;
  141. string replication = 4;
  142. string ttl = 5;
  143. uint32 memory_map_max_size_mb = 6;
  144. string disk_type = 7;
  145. }
  146. message AllocateVolumeResponse {
  147. }
  148. message VolumeSyncStatusRequest {
  149. uint32 volume_id = 1;
  150. }
  151. message VolumeSyncStatusResponse {
  152. uint32 volume_id = 1;
  153. string collection = 2;
  154. string replication = 4;
  155. string ttl = 5;
  156. uint64 tail_offset = 6;
  157. uint32 compact_revision = 7;
  158. uint64 idx_file_size = 8;
  159. }
  160. message VolumeIncrementalCopyRequest {
  161. uint32 volume_id = 1;
  162. uint64 since_ns = 2;
  163. }
  164. message VolumeIncrementalCopyResponse {
  165. bytes file_content = 1;
  166. }
  167. message VolumeMountRequest {
  168. uint32 volume_id = 1;
  169. }
  170. message VolumeMountResponse {
  171. }
  172. message VolumeUnmountRequest {
  173. uint32 volume_id = 1;
  174. }
  175. message VolumeUnmountResponse {
  176. }
  177. message VolumeDeleteRequest {
  178. uint32 volume_id = 1;
  179. }
  180. message VolumeDeleteResponse {
  181. }
  182. message VolumeMarkReadonlyRequest {
  183. uint32 volume_id = 1;
  184. }
  185. message VolumeMarkReadonlyResponse {
  186. }
  187. message VolumeMarkWritableRequest {
  188. uint32 volume_id = 1;
  189. }
  190. message VolumeMarkWritableResponse {
  191. }
  192. message VolumeConfigureRequest {
  193. uint32 volume_id = 1;
  194. string replication = 2;
  195. }
  196. message VolumeConfigureResponse {
  197. string error = 1;
  198. }
  199. message VolumeStatusRequest {
  200. uint32 volume_id = 1;
  201. }
  202. message VolumeStatusResponse {
  203. bool is_read_only = 1;
  204. }
  205. message VolumeCopyRequest {
  206. uint32 volume_id = 1;
  207. string collection = 2;
  208. string replication = 3;
  209. string ttl = 4;
  210. string source_data_node = 5;
  211. string disk_type = 6;
  212. }
  213. message VolumeCopyResponse {
  214. uint64 last_append_at_ns = 1;
  215. }
  216. message CopyFileRequest {
  217. uint32 volume_id = 1;
  218. string ext = 2;
  219. uint32 compaction_revision = 3;
  220. uint64 stop_offset = 4;
  221. string collection = 5;
  222. bool is_ec_volume = 6;
  223. bool ignore_source_file_not_found = 7;
  224. }
  225. message CopyFileResponse {
  226. bytes file_content = 1;
  227. }
  228. message ReadNeedleBlobRequest {
  229. uint32 volume_id = 1;
  230. uint64 needle_id = 2;
  231. int64 offset = 3; // actual offset
  232. int32 size = 4;
  233. }
  234. message ReadNeedleBlobResponse {
  235. bytes needle_blob = 1;
  236. }
  237. message WriteNeedleBlobRequest {
  238. uint32 volume_id = 1;
  239. uint64 needle_id = 2;
  240. int32 size = 3;
  241. bytes needle_blob = 4;
  242. }
  243. message WriteNeedleBlobResponse {
  244. }
  245. message VolumeTailSenderRequest {
  246. uint32 volume_id = 1;
  247. uint64 since_ns = 2;
  248. uint32 idle_timeout_seconds = 3;
  249. }
  250. message VolumeTailSenderResponse {
  251. bytes needle_header = 1;
  252. bytes needle_body = 2;
  253. bool is_last_chunk = 3;
  254. }
  255. message VolumeTailReceiverRequest {
  256. uint32 volume_id = 1;
  257. uint64 since_ns = 2;
  258. uint32 idle_timeout_seconds = 3;
  259. string source_volume_server = 4;
  260. }
  261. message VolumeTailReceiverResponse {
  262. }
  263. message VolumeEcShardsGenerateRequest {
  264. uint32 volume_id = 1;
  265. string collection = 2;
  266. }
  267. message VolumeEcShardsGenerateResponse {
  268. }
  269. message VolumeEcShardsRebuildRequest {
  270. uint32 volume_id = 1;
  271. string collection = 2;
  272. }
  273. message VolumeEcShardsRebuildResponse {
  274. repeated uint32 rebuilt_shard_ids = 1;
  275. }
  276. message VolumeEcShardsCopyRequest {
  277. uint32 volume_id = 1;
  278. string collection = 2;
  279. repeated uint32 shard_ids = 3;
  280. bool copy_ecx_file = 4;
  281. string source_data_node = 5;
  282. bool copy_ecj_file = 6;
  283. bool copy_vif_file = 7;
  284. }
  285. message VolumeEcShardsCopyResponse {
  286. }
  287. message VolumeEcShardsDeleteRequest {
  288. uint32 volume_id = 1;
  289. string collection = 2;
  290. repeated uint32 shard_ids = 3;
  291. }
  292. message VolumeEcShardsDeleteResponse {
  293. }
  294. message VolumeEcShardsMountRequest {
  295. uint32 volume_id = 1;
  296. string collection = 2;
  297. repeated uint32 shard_ids = 3;
  298. }
  299. message VolumeEcShardsMountResponse {
  300. }
  301. message VolumeEcShardsUnmountRequest {
  302. uint32 volume_id = 1;
  303. repeated uint32 shard_ids = 3;
  304. }
  305. message VolumeEcShardsUnmountResponse {
  306. }
  307. message VolumeEcShardReadRequest {
  308. uint32 volume_id = 1;
  309. uint32 shard_id = 2;
  310. int64 offset = 3;
  311. int64 size = 4;
  312. uint64 file_key = 5;
  313. }
  314. message VolumeEcShardReadResponse {
  315. bytes data = 1;
  316. bool is_deleted = 2;
  317. }
  318. message VolumeEcBlobDeleteRequest {
  319. uint32 volume_id = 1;
  320. string collection = 2;
  321. uint64 file_key = 3;
  322. uint32 version = 4;
  323. }
  324. message VolumeEcBlobDeleteResponse {
  325. }
  326. message VolumeEcShardsToVolumeRequest {
  327. uint32 volume_id = 1;
  328. string collection = 2;
  329. }
  330. message VolumeEcShardsToVolumeResponse {
  331. }
  332. message ReadVolumeFileStatusRequest {
  333. uint32 volume_id = 1;
  334. }
  335. message ReadVolumeFileStatusResponse {
  336. uint32 volume_id = 1;
  337. uint64 idx_file_timestamp_seconds = 2;
  338. uint64 idx_file_size = 3;
  339. uint64 dat_file_timestamp_seconds = 4;
  340. uint64 dat_file_size = 5;
  341. uint64 file_count = 6;
  342. uint32 compaction_revision = 7;
  343. string collection = 8;
  344. string disk_type = 9;
  345. }
  346. message DiskStatus {
  347. string dir = 1;
  348. uint64 all = 2;
  349. uint64 used = 3;
  350. uint64 free = 4;
  351. float percent_free = 5;
  352. float percent_used = 6;
  353. string disk_type = 7;
  354. }
  355. message MemStatus {
  356. int32 goroutines = 1;
  357. uint64 all = 2;
  358. uint64 used = 3;
  359. uint64 free = 4;
  360. uint64 self = 5;
  361. uint64 heap = 6;
  362. uint64 stack = 7;
  363. }
  364. // tired storage on volume servers
  365. message RemoteFile {
  366. string backend_type = 1;
  367. string backend_id = 2;
  368. string key = 3;
  369. uint64 offset = 4;
  370. uint64 file_size = 5;
  371. uint64 modified_time = 6;
  372. string extension = 7;
  373. }
  374. message VolumeInfo {
  375. repeated RemoteFile files = 1;
  376. uint32 version = 2;
  377. string replication = 3;
  378. }
  379. // tiered storage
  380. message VolumeTierMoveDatToRemoteRequest {
  381. uint32 volume_id = 1;
  382. string collection = 2;
  383. string destination_backend_name = 3;
  384. bool keep_local_dat_file = 4;
  385. }
  386. message VolumeTierMoveDatToRemoteResponse {
  387. int64 processed = 1;
  388. float processedPercentage = 2;
  389. }
  390. message VolumeTierMoveDatFromRemoteRequest {
  391. uint32 volume_id = 1;
  392. string collection = 2;
  393. bool keep_remote_dat_file = 3;
  394. }
  395. message VolumeTierMoveDatFromRemoteResponse {
  396. int64 processed = 1;
  397. float processedPercentage = 2;
  398. }
  399. message VolumeServerStatusRequest {
  400. }
  401. message VolumeServerStatusResponse {
  402. repeated DiskStatus disk_statuses = 1;
  403. MemStatus memory_status = 2;
  404. }
  405. message VolumeServerLeaveRequest {
  406. }
  407. message VolumeServerLeaveResponse {
  408. }
  409. // remote storage
  410. message FetchAndWriteNeedleRequest {
  411. uint32 volume_id = 1;
  412. uint64 needle_id = 2;
  413. uint32 cookie = 3;
  414. int64 offset = 4;
  415. int64 size = 5;
  416. // remote conf
  417. remote_pb.RemoteConf remote_conf = 15;
  418. remote_pb.RemoteStorageLocation remote_location = 16;
  419. }
  420. message FetchAndWriteNeedleResponse {
  421. }
  422. // select on volume servers
  423. message QueryRequest {
  424. repeated string selections = 1;
  425. repeated string from_file_ids = 2;
  426. message Filter {
  427. string field = 1;
  428. string operand = 2;
  429. string value = 3;
  430. }
  431. Filter filter = 3;
  432. message InputSerialization {
  433. // NONE | GZIP | BZIP2
  434. string compression_type = 1;
  435. message CSVInput {
  436. string file_header_info = 1; // Valid values: NONE | USE | IGNORE
  437. string record_delimiter = 2; // Default: \n
  438. string field_delimiter = 3; // Default: ,
  439. string quote_charactoer = 4; // Default: "
  440. string quote_escape_character = 5; // Default: "
  441. string comments = 6; // Default: #
  442. // If true, records might contain record delimiters within quote characters
  443. bool allow_quoted_record_delimiter = 7; // default False.
  444. }
  445. message JSONInput {
  446. string type = 1; // Valid values: DOCUMENT | LINES
  447. }
  448. message ParquetInput {
  449. }
  450. CSVInput csv_input = 2;
  451. JSONInput json_input = 3;
  452. ParquetInput parquet_input = 4;
  453. }
  454. InputSerialization input_serialization = 4;
  455. message OutputSerialization {
  456. message CSVOutput {
  457. string quote_fields = 1; // Valid values: ALWAYS | ASNEEDED
  458. string record_delimiter = 2; // Default: \n
  459. string field_delimiter = 3; // Default: ,
  460. string quote_charactoer = 4; // Default: "
  461. string quote_escape_character = 5; // Default: "
  462. }
  463. message JSONOutput {
  464. string record_delimiter = 1;
  465. }
  466. CSVOutput csv_output = 2;
  467. JSONOutput json_output = 3;
  468. }
  469. OutputSerialization output_serialization = 5;
  470. }
  471. message QueriedStripe {
  472. bytes records = 1;
  473. }
  474. message VolumeNeedleStatusRequest {
  475. uint32 volume_id = 1;
  476. uint64 needle_id = 2;
  477. }
  478. message VolumeNeedleStatusResponse {
  479. uint64 needle_id = 1;
  480. uint32 cookie = 2;
  481. uint32 size = 3;
  482. uint64 last_modified = 4;
  483. uint32 crc = 5;
  484. string ttl = 6;
  485. }