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.

639 lines
16 KiB

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