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.

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