filer.proto 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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. }
  87. message FullEntry {
  88. string dir = 1;
  89. Entry entry = 2;
  90. }
  91. message EventNotification {
  92. Entry old_entry = 1;
  93. Entry new_entry = 2;
  94. bool delete_chunks = 3;
  95. string new_parent_path = 4;
  96. bool is_from_other_cluster = 5;
  97. repeated int32 signatures = 6;
  98. }
  99. message FileChunk {
  100. string file_id = 1; // to be deprecated
  101. int64 offset = 2;
  102. uint64 size = 3;
  103. int64 mtime = 4;
  104. string e_tag = 5;
  105. string source_file_id = 6; // to be deprecated
  106. FileId fid = 7;
  107. FileId source_fid = 8;
  108. bytes cipher_key = 9;
  109. bool is_compressed = 10;
  110. bool is_chunk_manifest = 11; // content is a list of FileChunks
  111. }
  112. message FileChunkManifest {
  113. repeated FileChunk chunks = 1;
  114. }
  115. message FileId {
  116. uint32 volume_id = 1;
  117. uint64 file_key = 2;
  118. fixed32 cookie = 3;
  119. }
  120. message FuseAttributes {
  121. uint64 file_size = 1;
  122. int64 mtime = 2; // unix time in seconds
  123. uint32 file_mode = 3;
  124. uint32 uid = 4;
  125. uint32 gid = 5;
  126. int64 crtime = 6; // unix time in seconds
  127. string mime = 7;
  128. string replication = 8;
  129. string collection = 9;
  130. int32 ttl_sec = 10;
  131. string user_name = 11; // for hdfs
  132. repeated string group_name = 12; // for hdfs
  133. string symlink_target = 13;
  134. bytes md5 = 14;
  135. string disk_type = 15;
  136. }
  137. message CreateEntryRequest {
  138. string directory = 1;
  139. Entry entry = 2;
  140. bool o_excl = 3;
  141. bool is_from_other_cluster = 4;
  142. repeated int32 signatures = 5;
  143. }
  144. message CreateEntryResponse {
  145. string error = 1;
  146. }
  147. message UpdateEntryRequest {
  148. string directory = 1;
  149. Entry entry = 2;
  150. bool is_from_other_cluster = 3;
  151. repeated int32 signatures = 4;
  152. }
  153. message UpdateEntryResponse {
  154. }
  155. message AppendToEntryRequest {
  156. string directory = 1;
  157. string entry_name = 2;
  158. repeated FileChunk chunks = 3;
  159. }
  160. message AppendToEntryResponse {
  161. }
  162. message DeleteEntryRequest {
  163. string directory = 1;
  164. string name = 2;
  165. // bool is_directory = 3;
  166. bool is_delete_data = 4;
  167. bool is_recursive = 5;
  168. bool ignore_recursive_error = 6;
  169. bool is_from_other_cluster = 7;
  170. repeated int32 signatures = 8;
  171. }
  172. message DeleteEntryResponse {
  173. string error = 1;
  174. }
  175. message AtomicRenameEntryRequest {
  176. string old_directory = 1;
  177. string old_name = 2;
  178. string new_directory = 3;
  179. string new_name = 4;
  180. repeated int32 signatures = 5;
  181. }
  182. message AtomicRenameEntryResponse {
  183. }
  184. message StreamRenameEntryRequest {
  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 StreamRenameEntryResponse {
  192. string directory = 1;
  193. EventNotification event_notification = 2;
  194. int64 ts_ns = 3;
  195. }
  196. message AssignVolumeRequest {
  197. int32 count = 1;
  198. string collection = 2;
  199. string replication = 3;
  200. int32 ttl_sec = 4;
  201. string data_center = 5;
  202. string path = 6;
  203. string rack = 7;
  204. string data_node = 9;
  205. string disk_type = 8;
  206. }
  207. message AssignVolumeResponse {
  208. string file_id = 1;
  209. int32 count = 4;
  210. string auth = 5;
  211. string collection = 6;
  212. string replication = 7;
  213. string error = 8;
  214. Location location = 9;
  215. }
  216. message LookupVolumeRequest {
  217. repeated string volume_ids = 1;
  218. }
  219. message Locations {
  220. repeated Location locations = 1;
  221. }
  222. message Location {
  223. string url = 1;
  224. string public_url = 2;
  225. uint32 grpc_port = 3;
  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 GetFilerConfigurationRequest {
  257. }
  258. message GetFilerConfigurationResponse {
  259. repeated string masters = 1;
  260. string replication = 2;
  261. string collection = 3;
  262. uint32 max_mb = 4;
  263. string dir_buckets = 5;
  264. bool cipher = 7;
  265. int32 signature = 8;
  266. string metrics_address = 9;
  267. int32 metrics_interval_sec = 10;
  268. string version = 11;
  269. string cluster_id = 12;
  270. }
  271. message SubscribeMetadataRequest {
  272. string client_name = 1;
  273. string path_prefix = 2;
  274. int64 since_ns = 3;
  275. int32 signature = 4;
  276. repeated string path_prefixes = 6;
  277. int32 client_id = 7;
  278. }
  279. message SubscribeMetadataResponse {
  280. string directory = 1;
  281. EventNotification event_notification = 2;
  282. int64 ts_ns = 3;
  283. }
  284. message LogEntry {
  285. int64 ts_ns = 1;
  286. int32 partition_key_hash = 2;
  287. bytes data = 3;
  288. }
  289. message KeepConnectedRequest {
  290. string name = 1;
  291. uint32 grpc_port = 2;
  292. repeated string resources = 3;
  293. }
  294. message KeepConnectedResponse {
  295. }
  296. message LocateBrokerRequest {
  297. string resource = 1;
  298. }
  299. message LocateBrokerResponse {
  300. bool found = 1;
  301. // if found, send the exact address
  302. // if not found, send the full list of existing brokers
  303. message Resource {
  304. string grpc_addresses = 1;
  305. int32 resource_count = 2;
  306. }
  307. repeated Resource resources = 2;
  308. }
  309. /////////////////////////
  310. // Key-Value operations
  311. /////////////////////////
  312. message KvGetRequest {
  313. bytes key = 1;
  314. }
  315. message KvGetResponse {
  316. bytes value = 1;
  317. string error = 2;
  318. }
  319. message KvPutRequest {
  320. bytes key = 1;
  321. bytes value = 2;
  322. }
  323. message KvPutResponse {
  324. string error = 1;
  325. }
  326. /////////////////////////
  327. // path-based configurations
  328. /////////////////////////
  329. message FilerConf {
  330. int32 version = 1;
  331. message PathConf {
  332. string location_prefix = 1;
  333. string collection = 2;
  334. string replication = 3;
  335. string ttl = 4;
  336. string disk_type = 5;
  337. bool fsync = 6;
  338. uint32 volume_growth_count = 7;
  339. bool read_only = 8;
  340. string data_center = 9;
  341. string rack = 10;
  342. string data_node = 11;
  343. }
  344. repeated PathConf locations = 2;
  345. }
  346. /////////////////////////
  347. // Remote Storage related
  348. /////////////////////////
  349. message CacheRemoteObjectToLocalClusterRequest {
  350. string directory = 1;
  351. string name = 2;
  352. }
  353. message CacheRemoteObjectToLocalClusterResponse {
  354. Entry entry = 1;
  355. }