volume_server.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  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. }
  195. message VolumeMarkReadonlyResponse {
  196. }
  197. message VolumeMarkWritableRequest {
  198. uint32 volume_id = 1;
  199. }
  200. message VolumeMarkWritableResponse {
  201. }
  202. message VolumeConfigureRequest {
  203. uint32 volume_id = 1;
  204. string replication = 2;
  205. }
  206. message VolumeConfigureResponse {
  207. string error = 1;
  208. }
  209. message VolumeStatusRequest {
  210. uint32 volume_id = 1;
  211. }
  212. message VolumeStatusResponse {
  213. bool is_read_only = 1;
  214. uint64 volume_size = 2;
  215. }
  216. message VolumeCopyRequest {
  217. uint32 volume_id = 1;
  218. string collection = 2;
  219. string replication = 3;
  220. string ttl = 4;
  221. string source_data_node = 5;
  222. string disk_type = 6;
  223. int64 io_byte_per_second = 7;
  224. }
  225. message VolumeCopyResponse {
  226. uint64 last_append_at_ns = 1;
  227. int64 processed_bytes = 2;
  228. }
  229. message CopyFileRequest {
  230. uint32 volume_id = 1;
  231. string ext = 2;
  232. uint32 compaction_revision = 3;
  233. uint64 stop_offset = 4;
  234. string collection = 5;
  235. bool is_ec_volume = 6;
  236. bool ignore_source_file_not_found = 7;
  237. }
  238. message CopyFileResponse {
  239. bytes file_content = 1;
  240. int64 modified_ts_ns = 2;
  241. }
  242. message ReadNeedleBlobRequest {
  243. uint32 volume_id = 1;
  244. int64 offset = 3; // actual offset
  245. int32 size = 4;
  246. }
  247. message ReadNeedleBlobResponse {
  248. bytes needle_blob = 1;
  249. }
  250. message ReadNeedleMetaRequest {
  251. uint32 volume_id = 1;
  252. uint64 needle_id = 2;
  253. int64 offset = 3; // actual offset
  254. int32 size = 4;
  255. }
  256. message ReadNeedleMetaResponse {
  257. uint32 cookie = 1;
  258. uint64 last_modified = 2;
  259. uint32 crc = 3;
  260. string ttl = 4;
  261. uint64 append_at_ns = 5;
  262. }
  263. message WriteNeedleBlobRequest {
  264. uint32 volume_id = 1;
  265. uint64 needle_id = 2;
  266. int32 size = 3;
  267. bytes needle_blob = 4;
  268. }
  269. message WriteNeedleBlobResponse {
  270. }
  271. message ReadAllNeedlesRequest {
  272. repeated uint32 volume_ids = 1;
  273. }
  274. message ReadAllNeedlesResponse {
  275. uint32 volume_id = 1;
  276. uint64 needle_id = 2;
  277. uint32 cookie = 3;
  278. bytes needle_blob = 5;
  279. bool needle_blob_compressed = 6;
  280. uint64 last_modified = 7;
  281. uint32 crc = 8;
  282. bytes name = 9;
  283. bytes mime = 10;
  284. }
  285. message VolumeTailSenderRequest {
  286. uint32 volume_id = 1;
  287. uint64 since_ns = 2;
  288. uint32 idle_timeout_seconds = 3;
  289. }
  290. message VolumeTailSenderResponse {
  291. bytes needle_header = 1;
  292. bytes needle_body = 2;
  293. bool is_last_chunk = 3;
  294. }
  295. message VolumeTailReceiverRequest {
  296. uint32 volume_id = 1;
  297. uint64 since_ns = 2;
  298. uint32 idle_timeout_seconds = 3;
  299. string source_volume_server = 4;
  300. }
  301. message VolumeTailReceiverResponse {
  302. }
  303. message VolumeEcShardsGenerateRequest {
  304. uint32 volume_id = 1;
  305. string collection = 2;
  306. }
  307. message VolumeEcShardsGenerateResponse {
  308. }
  309. message VolumeEcShardsRebuildRequest {
  310. uint32 volume_id = 1;
  311. string collection = 2;
  312. }
  313. message VolumeEcShardsRebuildResponse {
  314. repeated uint32 rebuilt_shard_ids = 1;
  315. }
  316. message VolumeEcShardsCopyRequest {
  317. uint32 volume_id = 1;
  318. string collection = 2;
  319. repeated uint32 shard_ids = 3;
  320. bool copy_ecx_file = 4;
  321. string source_data_node = 5;
  322. bool copy_ecj_file = 6;
  323. bool copy_vif_file = 7;
  324. }
  325. message VolumeEcShardsCopyResponse {
  326. }
  327. message VolumeEcShardsDeleteRequest {
  328. uint32 volume_id = 1;
  329. string collection = 2;
  330. repeated uint32 shard_ids = 3;
  331. }
  332. message VolumeEcShardsDeleteResponse {
  333. }
  334. message VolumeEcShardsMountRequest {
  335. uint32 volume_id = 1;
  336. string collection = 2;
  337. repeated uint32 shard_ids = 3;
  338. }
  339. message VolumeEcShardsMountResponse {
  340. }
  341. message VolumeEcShardsUnmountRequest {
  342. uint32 volume_id = 1;
  343. repeated uint32 shard_ids = 3;
  344. }
  345. message VolumeEcShardsUnmountResponse {
  346. }
  347. message VolumeEcShardReadRequest {
  348. uint32 volume_id = 1;
  349. uint32 shard_id = 2;
  350. int64 offset = 3;
  351. int64 size = 4;
  352. uint64 file_key = 5;
  353. }
  354. message VolumeEcShardReadResponse {
  355. bytes data = 1;
  356. bool is_deleted = 2;
  357. }
  358. message VolumeEcBlobDeleteRequest {
  359. uint32 volume_id = 1;
  360. string collection = 2;
  361. uint64 file_key = 3;
  362. uint32 version = 4;
  363. }
  364. message VolumeEcBlobDeleteResponse {
  365. }
  366. message VolumeEcShardsToVolumeRequest {
  367. uint32 volume_id = 1;
  368. string collection = 2;
  369. }
  370. message VolumeEcShardsToVolumeResponse {
  371. }
  372. message ReadVolumeFileStatusRequest {
  373. uint32 volume_id = 1;
  374. }
  375. message ReadVolumeFileStatusResponse {
  376. uint32 volume_id = 1;
  377. uint64 idx_file_timestamp_seconds = 2;
  378. uint64 idx_file_size = 3;
  379. uint64 dat_file_timestamp_seconds = 4;
  380. uint64 dat_file_size = 5;
  381. uint64 file_count = 6;
  382. uint32 compaction_revision = 7;
  383. string collection = 8;
  384. string disk_type = 9;
  385. VolumeInfo volume_info = 10;
  386. }
  387. message DiskStatus {
  388. string dir = 1;
  389. uint64 all = 2;
  390. uint64 used = 3;
  391. uint64 free = 4;
  392. float percent_free = 5;
  393. float percent_used = 6;
  394. string disk_type = 7;
  395. }
  396. message MemStatus {
  397. int32 goroutines = 1;
  398. uint64 all = 2;
  399. uint64 used = 3;
  400. uint64 free = 4;
  401. uint64 self = 5;
  402. uint64 heap = 6;
  403. uint64 stack = 7;
  404. }
  405. // tired storage on volume servers
  406. message RemoteFile {
  407. string backend_type = 1;
  408. string backend_id = 2;
  409. string key = 3;
  410. uint64 offset = 4;
  411. uint64 file_size = 5;
  412. uint64 modified_time = 6;
  413. string extension = 7;
  414. }
  415. message VolumeInfo {
  416. repeated RemoteFile files = 1;
  417. uint32 version = 2;
  418. string replication = 3;
  419. uint32 BytesOffset = 4;
  420. }
  421. // tiered storage
  422. message VolumeTierMoveDatToRemoteRequest {
  423. uint32 volume_id = 1;
  424. string collection = 2;
  425. string destination_backend_name = 3;
  426. bool keep_local_dat_file = 4;
  427. }
  428. message VolumeTierMoveDatToRemoteResponse {
  429. int64 processed = 1;
  430. float processedPercentage = 2;
  431. }
  432. message VolumeTierMoveDatFromRemoteRequest {
  433. uint32 volume_id = 1;
  434. string collection = 2;
  435. bool keep_remote_dat_file = 3;
  436. }
  437. message VolumeTierMoveDatFromRemoteResponse {
  438. int64 processed = 1;
  439. float processedPercentage = 2;
  440. }
  441. message VolumeServerStatusRequest {
  442. }
  443. message VolumeServerStatusResponse {
  444. repeated DiskStatus disk_statuses = 1;
  445. MemStatus memory_status = 2;
  446. string version = 3;
  447. string data_center = 4;
  448. string rack = 5;
  449. }
  450. message VolumeServerLeaveRequest {
  451. }
  452. message VolumeServerLeaveResponse {
  453. }
  454. // remote storage
  455. message FetchAndWriteNeedleRequest {
  456. uint32 volume_id = 1;
  457. uint64 needle_id = 2;
  458. uint32 cookie = 3;
  459. int64 offset = 4;
  460. int64 size = 5;
  461. message Replica {
  462. string url = 1;
  463. string public_url = 2;
  464. int32 grpc_port = 3;
  465. }
  466. repeated Replica replicas = 6;
  467. string auth = 7;
  468. // remote conf
  469. remote_pb.RemoteConf remote_conf = 15;
  470. remote_pb.RemoteStorageLocation remote_location = 16;
  471. }
  472. message FetchAndWriteNeedleResponse {
  473. string e_tag = 1;
  474. }
  475. // select on volume servers
  476. message QueryRequest {
  477. repeated string selections = 1;
  478. repeated string from_file_ids = 2;
  479. message Filter {
  480. string field = 1;
  481. string operand = 2;
  482. string value = 3;
  483. }
  484. Filter filter = 3;
  485. message InputSerialization {
  486. // NONE | GZIP | BZIP2
  487. string compression_type = 1;
  488. message CSVInput {
  489. string file_header_info = 1; // Valid values: NONE | USE | IGNORE
  490. string record_delimiter = 2; // Default: \n
  491. string field_delimiter = 3; // Default: ,
  492. string quote_character = 4; // Default: "
  493. string quote_escape_character = 5; // Default: "
  494. string comments = 6; // Default: #
  495. // If true, records might contain record delimiters within quote characters
  496. bool allow_quoted_record_delimiter = 7; // default False.
  497. }
  498. message JSONInput {
  499. string type = 1; // Valid values: DOCUMENT | LINES
  500. }
  501. message ParquetInput {
  502. }
  503. CSVInput csv_input = 2;
  504. JSONInput json_input = 3;
  505. ParquetInput parquet_input = 4;
  506. }
  507. InputSerialization input_serialization = 4;
  508. message OutputSerialization {
  509. message CSVOutput {
  510. string quote_fields = 1; // Valid values: ALWAYS | ASNEEDED
  511. string record_delimiter = 2; // Default: \n
  512. string field_delimiter = 3; // Default: ,
  513. string quote_character = 4; // Default: "
  514. string quote_escape_character = 5; // Default: "
  515. }
  516. message JSONOutput {
  517. string record_delimiter = 1;
  518. }
  519. CSVOutput csv_output = 2;
  520. JSONOutput json_output = 3;
  521. }
  522. OutputSerialization output_serialization = 5;
  523. }
  524. message QueriedStripe {
  525. bytes records = 1;
  526. }
  527. message VolumeNeedleStatusRequest {
  528. uint32 volume_id = 1;
  529. uint64 needle_id = 2;
  530. }
  531. message VolumeNeedleStatusResponse {
  532. uint64 needle_id = 1;
  533. uint32 cookie = 2;
  534. uint32 size = 3;
  535. uint64 last_modified = 4;
  536. uint32 crc = 5;
  537. string ttl = 6;
  538. }
  539. message PingRequest {
  540. string target = 1; // default to ping itself
  541. string target_type = 2;
  542. }
  543. message PingResponse {
  544. int64 start_time_ns = 1;
  545. int64 remote_time_ns = 2;
  546. int64 stop_time_ns = 3;
  547. }