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.

560 lines
14 KiB

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