filer.proto 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  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. string data_center = 4;
  226. }
  227. message LookupVolumeResponse {
  228. map<string, Locations> locations_map = 1;
  229. }
  230. message Collection {
  231. string name = 1;
  232. }
  233. message CollectionListRequest {
  234. bool include_normal_volumes = 1;
  235. bool include_ec_volumes = 2;
  236. }
  237. message CollectionListResponse {
  238. repeated Collection collections = 1;
  239. }
  240. message DeleteCollectionRequest {
  241. string collection = 1;
  242. }
  243. message DeleteCollectionResponse {
  244. }
  245. message StatisticsRequest {
  246. string replication = 1;
  247. string collection = 2;
  248. string ttl = 3;
  249. string disk_type = 4;
  250. }
  251. message StatisticsResponse {
  252. uint64 total_size = 4;
  253. uint64 used_size = 5;
  254. uint64 file_count = 6;
  255. }
  256. message PingRequest {
  257. string target = 1; // default to ping itself
  258. string target_type = 2;
  259. }
  260. message PingResponse {
  261. int64 start_time_ns = 1;
  262. int64 remote_time_ns = 2;
  263. int64 stop_time_ns = 3;
  264. }
  265. message GetFilerConfigurationRequest {
  266. }
  267. message GetFilerConfigurationResponse {
  268. repeated string masters = 1;
  269. string replication = 2;
  270. string collection = 3;
  271. uint32 max_mb = 4;
  272. string dir_buckets = 5;
  273. bool cipher = 7;
  274. int32 signature = 8;
  275. string metrics_address = 9;
  276. int32 metrics_interval_sec = 10;
  277. string version = 11;
  278. string cluster_id = 12;
  279. string filer_group = 13;
  280. }
  281. message SubscribeMetadataRequest {
  282. string client_name = 1;
  283. string path_prefix = 2;
  284. int64 since_ns = 3;
  285. int32 signature = 4;
  286. repeated string path_prefixes = 6;
  287. int32 client_id = 7;
  288. int64 until_ns = 8;
  289. int32 client_epoch = 9;
  290. repeated string directories = 10; // exact directory to watch
  291. }
  292. message SubscribeMetadataResponse {
  293. string directory = 1;
  294. EventNotification event_notification = 2;
  295. int64 ts_ns = 3;
  296. }
  297. message LogEntry {
  298. int64 ts_ns = 1;
  299. int32 partition_key_hash = 2;
  300. bytes data = 3;
  301. }
  302. message KeepConnectedRequest {
  303. string name = 1;
  304. uint32 grpc_port = 2;
  305. repeated string resources = 3;
  306. }
  307. message KeepConnectedResponse {
  308. }
  309. message LocateBrokerRequest {
  310. string resource = 1;
  311. }
  312. message LocateBrokerResponse {
  313. bool found = 1;
  314. // if found, send the exact address
  315. // if not found, send the full list of existing brokers
  316. message Resource {
  317. string grpc_addresses = 1;
  318. int32 resource_count = 2;
  319. }
  320. repeated Resource resources = 2;
  321. }
  322. /////////////////////////
  323. // Key-Value operations
  324. /////////////////////////
  325. message KvGetRequest {
  326. bytes key = 1;
  327. }
  328. message KvGetResponse {
  329. bytes value = 1;
  330. string error = 2;
  331. }
  332. message KvPutRequest {
  333. bytes key = 1;
  334. bytes value = 2;
  335. }
  336. message KvPutResponse {
  337. string error = 1;
  338. }
  339. /////////////////////////
  340. // path-based configurations
  341. /////////////////////////
  342. message FilerConf {
  343. int32 version = 1;
  344. message PathConf {
  345. string location_prefix = 1;
  346. string collection = 2;
  347. string replication = 3;
  348. string ttl = 4;
  349. string disk_type = 5;
  350. bool fsync = 6;
  351. uint32 volume_growth_count = 7;
  352. bool read_only = 8;
  353. string data_center = 9;
  354. string rack = 10;
  355. string data_node = 11;
  356. }
  357. repeated PathConf locations = 2;
  358. }
  359. /////////////////////////
  360. // Remote Storage related
  361. /////////////////////////
  362. message CacheRemoteObjectToLocalClusterRequest {
  363. string directory = 1;
  364. string name = 2;
  365. }
  366. message CacheRemoteObjectToLocalClusterResponse {
  367. Entry entry = 1;
  368. }