volume_server.proto 16 KB

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