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.

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