filer.proto 9.5 KB

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