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.

428 lines
9.6 KiB

5 years ago
3 years ago
3 years ago
3 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years 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. }
  49. //////////////////////////////////////////////////
  50. message LookupDirectoryEntryRequest {
  51. string directory = 1;
  52. string name = 2;
  53. }
  54. message LookupDirectoryEntryResponse {
  55. Entry entry = 1;
  56. }
  57. message ListEntriesRequest {
  58. string directory = 1;
  59. string prefix = 2;
  60. string startFromFileName = 3;
  61. bool inclusiveStartFrom = 4;
  62. uint32 limit = 5;
  63. }
  64. message ListEntriesResponse {
  65. Entry entry = 1;
  66. }
  67. message RemoteEntry {
  68. string storage_name = 1;
  69. int64 last_local_sync_ts_ns = 2;
  70. string remote_e_tag = 3;
  71. int64 remote_mtime = 4;
  72. int64 remote_size = 5;
  73. }
  74. message Entry {
  75. string name = 1;
  76. bool is_directory = 2;
  77. repeated FileChunk chunks = 3;
  78. FuseAttributes attributes = 4;
  79. map<string, bytes> extended = 5;
  80. bytes hard_link_id = 7;
  81. int32 hard_link_counter = 8; // only exists in hard link meta data
  82. bytes content = 9; // if not empty, the file content
  83. RemoteEntry remote_entry = 10;
  84. int64 quota = 11; // for bucket only. Positive/Negative means enabled/disabled.
  85. }
  86. message FullEntry {
  87. string dir = 1;
  88. Entry entry = 2;
  89. }
  90. message EventNotification {
  91. Entry old_entry = 1;
  92. Entry new_entry = 2;
  93. bool delete_chunks = 3;
  94. string new_parent_path = 4;
  95. bool is_from_other_cluster = 5;
  96. repeated int32 signatures = 6;
  97. }
  98. message FileChunk {
  99. string file_id = 1; // to be deprecated
  100. int64 offset = 2;
  101. uint64 size = 3;
  102. int64 mtime = 4;
  103. string e_tag = 5;
  104. string source_file_id = 6; // to be deprecated
  105. FileId fid = 7;
  106. FileId source_fid = 8;
  107. bytes cipher_key = 9;
  108. bool is_compressed = 10;
  109. bool is_chunk_manifest = 11; // content is a list of FileChunks
  110. }
  111. message FileChunkManifest {
  112. repeated FileChunk chunks = 1;
  113. }
  114. message FileId {
  115. uint32 volume_id = 1;
  116. uint64 file_key = 2;
  117. fixed32 cookie = 3;
  118. }
  119. message FuseAttributes {
  120. uint64 file_size = 1;
  121. int64 mtime = 2; // unix time in seconds
  122. uint32 file_mode = 3;
  123. uint32 uid = 4;
  124. uint32 gid = 5;
  125. int64 crtime = 6; // unix time in seconds
  126. string mime = 7;
  127. int32 ttl_sec = 10;
  128. string user_name = 11; // for hdfs
  129. repeated string group_name = 12; // for hdfs
  130. string symlink_target = 13;
  131. bytes md5 = 14;
  132. uint32 rdev = 16;
  133. uint64 inode = 17;
  134. }
  135. message CreateEntryRequest {
  136. string directory = 1;
  137. Entry entry = 2;
  138. bool o_excl = 3;
  139. bool is_from_other_cluster = 4;
  140. repeated int32 signatures = 5;
  141. bool skip_check_parent_directory = 6;
  142. }
  143. message CreateEntryResponse {
  144. string error = 1;
  145. }
  146. message UpdateEntryRequest {
  147. string directory = 1;
  148. Entry entry = 2;
  149. bool is_from_other_cluster = 3;
  150. repeated int32 signatures = 4;
  151. }
  152. message UpdateEntryResponse {
  153. }
  154. message AppendToEntryRequest {
  155. string directory = 1;
  156. string entry_name = 2;
  157. repeated FileChunk chunks = 3;
  158. }
  159. message AppendToEntryResponse {
  160. }
  161. message DeleteEntryRequest {
  162. string directory = 1;
  163. string name = 2;
  164. // bool is_directory = 3;
  165. bool is_delete_data = 4;
  166. bool is_recursive = 5;
  167. bool ignore_recursive_error = 6;
  168. bool is_from_other_cluster = 7;
  169. repeated int32 signatures = 8;
  170. }
  171. message DeleteEntryResponse {
  172. string error = 1;
  173. }
  174. message AtomicRenameEntryRequest {
  175. string old_directory = 1;
  176. string old_name = 2;
  177. string new_directory = 3;
  178. string new_name = 4;
  179. repeated int32 signatures = 5;
  180. }
  181. message AtomicRenameEntryResponse {
  182. }
  183. message StreamRenameEntryRequest {
  184. string old_directory = 1;
  185. string old_name = 2;
  186. string new_directory = 3;
  187. string new_name = 4;
  188. repeated int32 signatures = 5;
  189. }
  190. message StreamRenameEntryResponse {
  191. string directory = 1;
  192. EventNotification event_notification = 2;
  193. int64 ts_ns = 3;
  194. }
  195. message AssignVolumeRequest {
  196. int32 count = 1;
  197. string collection = 2;
  198. string replication = 3;
  199. int32 ttl_sec = 4;
  200. string data_center = 5;
  201. string path = 6;
  202. string rack = 7;
  203. string data_node = 9;
  204. string disk_type = 8;
  205. }
  206. message AssignVolumeResponse {
  207. string file_id = 1;
  208. int32 count = 4;
  209. string auth = 5;
  210. string collection = 6;
  211. string replication = 7;
  212. string error = 8;
  213. Location location = 9;
  214. }
  215. message LookupVolumeRequest {
  216. repeated string volume_ids = 1;
  217. }
  218. message Locations {
  219. repeated Location locations = 1;
  220. }
  221. message Location {
  222. string url = 1;
  223. string public_url = 2;
  224. uint32 grpc_port = 3;
  225. }
  226. message LookupVolumeResponse {
  227. map<string, Locations> locations_map = 1;
  228. }
  229. message Collection {
  230. string name = 1;
  231. }
  232. message CollectionListRequest {
  233. bool include_normal_volumes = 1;
  234. bool include_ec_volumes = 2;
  235. }
  236. message CollectionListResponse {
  237. repeated Collection collections = 1;
  238. }
  239. message DeleteCollectionRequest {
  240. string collection = 1;
  241. }
  242. message DeleteCollectionResponse {
  243. }
  244. message StatisticsRequest {
  245. string replication = 1;
  246. string collection = 2;
  247. string ttl = 3;
  248. string disk_type = 4;
  249. }
  250. message StatisticsResponse {
  251. uint64 total_size = 4;
  252. uint64 used_size = 5;
  253. uint64 file_count = 6;
  254. }
  255. message PingRequest {
  256. string target = 1; // default to ping itself
  257. string target_type = 2;
  258. }
  259. message PingResponse {
  260. int64 start_time_ns = 1;
  261. int64 remote_time_ns = 2;
  262. int64 stop_time_ns = 3;
  263. }
  264. message GetFilerConfigurationRequest {
  265. }
  266. message GetFilerConfigurationResponse {
  267. repeated string masters = 1;
  268. string replication = 2;
  269. string collection = 3;
  270. uint32 max_mb = 4;
  271. string dir_buckets = 5;
  272. bool cipher = 7;
  273. int32 signature = 8;
  274. string metrics_address = 9;
  275. int32 metrics_interval_sec = 10;
  276. string version = 11;
  277. string cluster_id = 12;
  278. string filer_group = 13;
  279. }
  280. message SubscribeMetadataRequest {
  281. string client_name = 1;
  282. string path_prefix = 2;
  283. int64 since_ns = 3;
  284. int32 signature = 4;
  285. repeated string path_prefixes = 6;
  286. int32 client_id = 7;
  287. int64 until_ns = 8;
  288. int32 client_epoch = 9;
  289. }
  290. message SubscribeMetadataResponse {
  291. string directory = 1;
  292. EventNotification event_notification = 2;
  293. int64 ts_ns = 3;
  294. }
  295. message LogEntry {
  296. int64 ts_ns = 1;
  297. int32 partition_key_hash = 2;
  298. bytes data = 3;
  299. }
  300. message KeepConnectedRequest {
  301. string name = 1;
  302. uint32 grpc_port = 2;
  303. repeated string resources = 3;
  304. }
  305. message KeepConnectedResponse {
  306. }
  307. message LocateBrokerRequest {
  308. string resource = 1;
  309. }
  310. message LocateBrokerResponse {
  311. bool found = 1;
  312. // if found, send the exact address
  313. // if not found, send the full list of existing brokers
  314. message Resource {
  315. string grpc_addresses = 1;
  316. int32 resource_count = 2;
  317. }
  318. repeated Resource resources = 2;
  319. }
  320. /////////////////////////
  321. // Key-Value operations
  322. /////////////////////////
  323. message KvGetRequest {
  324. bytes key = 1;
  325. }
  326. message KvGetResponse {
  327. bytes value = 1;
  328. string error = 2;
  329. }
  330. message KvPutRequest {
  331. bytes key = 1;
  332. bytes value = 2;
  333. }
  334. message KvPutResponse {
  335. string error = 1;
  336. }
  337. /////////////////////////
  338. // path-based configurations
  339. /////////////////////////
  340. message FilerConf {
  341. int32 version = 1;
  342. message PathConf {
  343. string location_prefix = 1;
  344. string collection = 2;
  345. string replication = 3;
  346. string ttl = 4;
  347. string disk_type = 5;
  348. bool fsync = 6;
  349. uint32 volume_growth_count = 7;
  350. bool read_only = 8;
  351. string data_center = 9;
  352. string rack = 10;
  353. string data_node = 11;
  354. }
  355. repeated PathConf locations = 2;
  356. }
  357. /////////////////////////
  358. // Remote Storage related
  359. /////////////////////////
  360. message CacheRemoteObjectToLocalClusterRequest {
  361. string directory = 1;
  362. string name = 2;
  363. }
  364. message CacheRemoteObjectToLocalClusterResponse {
  365. Entry entry = 1;
  366. }