filer.proto 8.8 KB

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