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.

513 lines
11 KiB

5 years ago
1 year ago
1 year ago
1 year ago
9 months ago
4 years ago
4 years ago
9 months ago
4 years ago
5 years ago
9 months ago
9 months ago
9 months ago
9 months ago
4 years ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
5 years ago
9 months ago
5 years ago
9 months ago
9 months ago
9 months ago
9 months ago
4 years ago
9 months ago
1 year ago
9 months ago
9 months ago
9 months ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
1 year ago
9 months ago
9 months ago
  1. syntax = "proto3";
  2. package filer_pb;
  3. option go_package = "github.com/seaweedfs/seaweedfs/weed/pb/filer_pb";
  4. option java_package = "seaweedfs.client";
  5. option java_outer_classname = "FilerProto";
  6. //////////////////////////////////////////////////
  7. service SeaweedFiler {
  8. rpc LookupDirectoryEntry (LookupDirectoryEntryRequest) returns (LookupDirectoryEntryResponse) {
  9. }
  10. rpc ListEntries (ListEntriesRequest) returns (stream ListEntriesResponse) {
  11. }
  12. rpc CreateEntry (CreateEntryRequest) returns (CreateEntryResponse) {
  13. }
  14. rpc UpdateEntry (UpdateEntryRequest) returns (UpdateEntryResponse) {
  15. }
  16. rpc AppendToEntry (AppendToEntryRequest) returns (AppendToEntryResponse) {
  17. }
  18. rpc DeleteEntry (DeleteEntryRequest) returns (DeleteEntryResponse) {
  19. }
  20. rpc AtomicRenameEntry (AtomicRenameEntryRequest) returns (AtomicRenameEntryResponse) {
  21. }
  22. rpc StreamRenameEntry (StreamRenameEntryRequest) returns (stream StreamRenameEntryResponse) {
  23. }
  24. rpc AssignVolume (AssignVolumeRequest) returns (AssignVolumeResponse) {
  25. }
  26. rpc LookupVolume (LookupVolumeRequest) returns (LookupVolumeResponse) {
  27. }
  28. rpc CollectionList (CollectionListRequest) returns (CollectionListResponse) {
  29. }
  30. rpc DeleteCollection (DeleteCollectionRequest) returns (DeleteCollectionResponse) {
  31. }
  32. rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
  33. }
  34. rpc Ping (PingRequest) returns (PingResponse) {
  35. }
  36. rpc GetFilerConfiguration (GetFilerConfigurationRequest) returns (GetFilerConfigurationResponse) {
  37. }
  38. rpc SubscribeMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  39. }
  40. rpc SubscribeLocalMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  41. }
  42. rpc KvGet (KvGetRequest) returns (KvGetResponse) {
  43. }
  44. rpc KvPut (KvPutRequest) returns (KvPutResponse) {
  45. }
  46. rpc CacheRemoteObjectToLocalCluster (CacheRemoteObjectToLocalClusterRequest) returns (CacheRemoteObjectToLocalClusterResponse) {
  47. }
  48. rpc DistributedLock(LockRequest) returns (LockResponse) {
  49. }
  50. rpc DistributedUnlock(UnlockRequest) returns (UnlockResponse) {
  51. }
  52. rpc FindLockOwner(FindLockOwnerRequest) returns (FindLockOwnerResponse) {
  53. }
  54. // distributed lock management internal use only
  55. rpc TransferLocks(TransferLocksRequest) returns (TransferLocksResponse) {
  56. }
  57. }
  58. //////////////////////////////////////////////////
  59. message LookupDirectoryEntryRequest {
  60. string directory = 1;
  61. string name = 2;
  62. }
  63. message LookupDirectoryEntryResponse {
  64. Entry entry = 1;
  65. }
  66. message ListEntriesRequest {
  67. string directory = 1;
  68. string prefix = 2;
  69. string startFromFileName = 3;
  70. bool inclusiveStartFrom = 4;
  71. uint32 limit = 5;
  72. bool recursive = 6;
  73. }
  74. message ListEntriesResponse {
  75. Entry entry = 1;
  76. }
  77. message RemoteEntry {
  78. string storage_name = 1;
  79. int64 last_local_sync_ts_ns = 2;
  80. string remote_e_tag = 3;
  81. int64 remote_mtime = 4;
  82. int64 remote_size = 5;
  83. }
  84. message Entry {
  85. string name = 1;
  86. bool is_directory = 2;
  87. repeated FileChunk chunks = 3;
  88. FuseAttributes attributes = 4;
  89. map<string, bytes> extended = 5;
  90. bytes hard_link_id = 7;
  91. int32 hard_link_counter = 8; // only exists in hard link meta data
  92. bytes content = 9; // if not empty, the file content
  93. RemoteEntry remote_entry = 10;
  94. int64 quota = 11; // for bucket only. Positive/Negative means enabled/disabled.
  95. }
  96. message FullEntry {
  97. string dir = 1;
  98. Entry entry = 2;
  99. }
  100. message EventNotification {
  101. Entry old_entry = 1;
  102. Entry new_entry = 2;
  103. bool delete_chunks = 3;
  104. string new_parent_path = 4;
  105. bool is_from_other_cluster = 5;
  106. repeated int32 signatures = 6;
  107. }
  108. message FileChunk {
  109. string file_id = 1; // to be deprecated
  110. int64 offset = 2;
  111. uint64 size = 3;
  112. int64 modified_ts_ns = 4;
  113. string e_tag = 5;
  114. string source_file_id = 6; // to be deprecated
  115. FileId fid = 7;
  116. FileId source_fid = 8;
  117. bytes cipher_key = 9;
  118. bool is_compressed = 10;
  119. bool is_chunk_manifest = 11; // content is a list of FileChunks
  120. }
  121. message FileChunkManifest {
  122. repeated FileChunk chunks = 1;
  123. }
  124. message FileId {
  125. uint32 volume_id = 1;
  126. uint64 file_key = 2;
  127. fixed32 cookie = 3;
  128. }
  129. message FuseAttributes {
  130. uint64 file_size = 1;
  131. int64 mtime = 2; // unix time in seconds
  132. uint32 file_mode = 3;
  133. uint32 uid = 4;
  134. uint32 gid = 5;
  135. int64 crtime = 6; // unix time in seconds
  136. string mime = 7;
  137. int32 ttl_sec = 10;
  138. string user_name = 11; // for hdfs
  139. repeated string group_name = 12; // for hdfs
  140. string symlink_target = 13;
  141. bytes md5 = 14;
  142. uint32 rdev = 16;
  143. uint64 inode = 17;
  144. }
  145. message CreateEntryRequest {
  146. string directory = 1;
  147. Entry entry = 2;
  148. bool o_excl = 3;
  149. bool is_from_other_cluster = 4;
  150. repeated int32 signatures = 5;
  151. bool skip_check_parent_directory = 6;
  152. }
  153. message CreateEntryResponse {
  154. string error = 1;
  155. }
  156. message UpdateEntryRequest {
  157. string directory = 1;
  158. Entry entry = 2;
  159. bool is_from_other_cluster = 3;
  160. repeated int32 signatures = 4;
  161. }
  162. message UpdateEntryResponse {
  163. }
  164. message AppendToEntryRequest {
  165. string directory = 1;
  166. string entry_name = 2;
  167. repeated FileChunk chunks = 3;
  168. }
  169. message AppendToEntryResponse {
  170. }
  171. message DeleteEntryRequest {
  172. string directory = 1;
  173. string name = 2;
  174. // bool is_directory = 3;
  175. bool is_delete_data = 4;
  176. bool is_recursive = 5;
  177. bool ignore_recursive_error = 6;
  178. bool is_from_other_cluster = 7;
  179. repeated int32 signatures = 8;
  180. }
  181. message DeleteEntryResponse {
  182. string error = 1;
  183. }
  184. message AtomicRenameEntryRequest {
  185. string old_directory = 1;
  186. string old_name = 2;
  187. string new_directory = 3;
  188. string new_name = 4;
  189. repeated int32 signatures = 5;
  190. }
  191. message AtomicRenameEntryResponse {
  192. }
  193. message StreamRenameEntryRequest {
  194. string old_directory = 1;
  195. string old_name = 2;
  196. string new_directory = 3;
  197. string new_name = 4;
  198. repeated int32 signatures = 5;
  199. }
  200. message StreamRenameEntryResponse {
  201. string directory = 1;
  202. EventNotification event_notification = 2;
  203. int64 ts_ns = 3;
  204. }
  205. message AssignVolumeRequest {
  206. int32 count = 1;
  207. string collection = 2;
  208. string replication = 3;
  209. int32 ttl_sec = 4;
  210. string data_center = 5;
  211. string path = 6;
  212. string rack = 7;
  213. string data_node = 9;
  214. string disk_type = 8;
  215. }
  216. message AssignVolumeResponse {
  217. string file_id = 1;
  218. int32 count = 4;
  219. string auth = 5;
  220. string collection = 6;
  221. string replication = 7;
  222. string error = 8;
  223. Location location = 9;
  224. }
  225. message LookupVolumeRequest {
  226. repeated string volume_ids = 1;
  227. }
  228. message Locations {
  229. repeated Location locations = 1;
  230. }
  231. message Location {
  232. string url = 1;
  233. string public_url = 2;
  234. uint32 grpc_port = 3;
  235. string data_center = 4;
  236. }
  237. message LookupVolumeResponse {
  238. map<string, Locations> locations_map = 1;
  239. }
  240. message Collection {
  241. string name = 1;
  242. }
  243. message CollectionListRequest {
  244. bool include_normal_volumes = 1;
  245. bool include_ec_volumes = 2;
  246. }
  247. message CollectionListResponse {
  248. repeated Collection collections = 1;
  249. }
  250. message DeleteCollectionRequest {
  251. string collection = 1;
  252. }
  253. message DeleteCollectionResponse {
  254. }
  255. message StatisticsRequest {
  256. string replication = 1;
  257. string collection = 2;
  258. string ttl = 3;
  259. string disk_type = 4;
  260. }
  261. message StatisticsResponse {
  262. uint64 total_size = 4;
  263. uint64 used_size = 5;
  264. uint64 file_count = 6;
  265. }
  266. message PingRequest {
  267. string target = 1; // default to ping itself
  268. string target_type = 2;
  269. }
  270. message PingResponse {
  271. int64 start_time_ns = 1;
  272. int64 remote_time_ns = 2;
  273. int64 stop_time_ns = 3;
  274. }
  275. message GetFilerConfigurationRequest {
  276. }
  277. message GetFilerConfigurationResponse {
  278. repeated string masters = 1;
  279. string replication = 2;
  280. string collection = 3;
  281. uint32 max_mb = 4;
  282. string dir_buckets = 5;
  283. bool cipher = 7;
  284. int32 signature = 8;
  285. string metrics_address = 9;
  286. int32 metrics_interval_sec = 10;
  287. string version = 11;
  288. string cluster_id = 12;
  289. string filer_group = 13;
  290. }
  291. message SubscribeMetadataRequest {
  292. string client_name = 1;
  293. string path_prefix = 2;
  294. int64 since_ns = 3;
  295. int32 signature = 4;
  296. repeated string path_prefixes = 6;
  297. int32 client_id = 7;
  298. int64 until_ns = 8;
  299. int32 client_epoch = 9;
  300. repeated string directories = 10; // exact directory to watch
  301. }
  302. message SubscribeMetadataResponse {
  303. string directory = 1;
  304. EventNotification event_notification = 2;
  305. int64 ts_ns = 3;
  306. }
  307. message LogEntry {
  308. int64 ts_ns = 1;
  309. int32 partition_key_hash = 2;
  310. bytes data = 3;
  311. bytes key = 4;
  312. }
  313. message KeepConnectedRequest {
  314. string name = 1;
  315. uint32 grpc_port = 2;
  316. repeated string resources = 3;
  317. }
  318. message KeepConnectedResponse {
  319. }
  320. message LocateBrokerRequest {
  321. string resource = 1;
  322. }
  323. message LocateBrokerResponse {
  324. bool found = 1;
  325. // if found, send the exact address
  326. // if not found, send the full list of existing brokers
  327. message Resource {
  328. string grpc_addresses = 1;
  329. int32 resource_count = 2;
  330. }
  331. repeated Resource resources = 2;
  332. }
  333. /////////////////////////
  334. // Key-Value operations
  335. /////////////////////////
  336. message KvGetRequest {
  337. bytes key = 1;
  338. }
  339. message KvGetResponse {
  340. bytes value = 1;
  341. string error = 2;
  342. }
  343. message KvPutRequest {
  344. bytes key = 1;
  345. bytes value = 2;
  346. }
  347. message KvPutResponse {
  348. string error = 1;
  349. }
  350. /////////////////////////
  351. // path-based configurations
  352. /////////////////////////
  353. message FilerConf {
  354. int32 version = 1;
  355. message PathConf {
  356. string location_prefix = 1;
  357. string collection = 2;
  358. string replication = 3;
  359. string ttl = 4;
  360. string disk_type = 5;
  361. bool fsync = 6;
  362. uint32 volume_growth_count = 7;
  363. bool read_only = 8;
  364. string data_center = 9;
  365. string rack = 10;
  366. string data_node = 11;
  367. uint32 max_file_name_length = 12;
  368. }
  369. repeated PathConf locations = 2;
  370. }
  371. /////////////////////////
  372. // Remote Storage related
  373. /////////////////////////
  374. message CacheRemoteObjectToLocalClusterRequest {
  375. string directory = 1;
  376. string name = 2;
  377. }
  378. message CacheRemoteObjectToLocalClusterResponse {
  379. Entry entry = 1;
  380. }
  381. /////////////////////////
  382. // distributed lock management
  383. /////////////////////////
  384. message LockRequest {
  385. string name = 1;
  386. int64 seconds_to_lock = 2;
  387. string renew_token = 3;
  388. bool is_moved = 4;
  389. string owner = 5;
  390. }
  391. message LockResponse {
  392. string renew_token = 1;
  393. string lock_owner = 2;
  394. string lock_host_moved_to = 3;
  395. string error = 4;
  396. }
  397. message UnlockRequest {
  398. string name = 1;
  399. string renew_token = 2;
  400. bool is_moved = 3;
  401. }
  402. message UnlockResponse {
  403. string error = 1;
  404. string moved_to = 2;
  405. }
  406. message FindLockOwnerRequest {
  407. string name = 1;
  408. bool is_moved = 2;
  409. }
  410. message FindLockOwnerResponse {
  411. string owner = 1;
  412. }
  413. message Lock {
  414. string name = 1;
  415. string renew_token = 2;
  416. int64 expired_at_ns = 3;
  417. string owner = 4;
  418. }
  419. message TransferLocksRequest {
  420. repeated Lock locks = 1;
  421. }
  422. message TransferLocksResponse {
  423. }