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.

619 lines
15 KiB

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