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.

291 lines
6.1 KiB

5 years ago
5 years ago
5 years ago
  1. syntax = "proto3";
  2. package filer_pb;
  3. option java_package = "seaweedfs.client";
  4. option java_outer_classname = "FilerProto";
  5. //////////////////////////////////////////////////
  6. service SeaweedFiler {
  7. rpc LookupDirectoryEntry (LookupDirectoryEntryRequest) returns (LookupDirectoryEntryResponse) {
  8. }
  9. rpc ListEntries (ListEntriesRequest) returns (stream ListEntriesResponse) {
  10. }
  11. rpc CreateEntry (CreateEntryRequest) returns (CreateEntryResponse) {
  12. }
  13. rpc UpdateEntry (UpdateEntryRequest) returns (UpdateEntryResponse) {
  14. }
  15. rpc AppendToEntry (AppendToEntryRequest) returns (AppendToEntryResponse) {
  16. }
  17. rpc DeleteEntry (DeleteEntryRequest) returns (DeleteEntryResponse) {
  18. }
  19. rpc AtomicRenameEntry (AtomicRenameEntryRequest) returns (AtomicRenameEntryResponse) {
  20. }
  21. rpc AssignVolume (AssignVolumeRequest) returns (AssignVolumeResponse) {
  22. }
  23. rpc LookupVolume (LookupVolumeRequest) returns (LookupVolumeResponse) {
  24. }
  25. rpc DeleteCollection (DeleteCollectionRequest) returns (DeleteCollectionResponse) {
  26. }
  27. rpc Statistics (StatisticsRequest) returns (StatisticsResponse) {
  28. }
  29. rpc GetFilerConfiguration (GetFilerConfigurationRequest) returns (GetFilerConfigurationResponse) {
  30. }
  31. rpc SubscribeMetadata (SubscribeMetadataRequest) returns (stream SubscribeMetadataResponse) {
  32. }
  33. rpc KeepConnected (stream KeepConnectedRequest) returns (stream KeepConnectedResponse) {
  34. }
  35. rpc LocateBroker (LocateBrokerRequest) returns (LocateBrokerResponse) {
  36. }
  37. }
  38. //////////////////////////////////////////////////
  39. message LookupDirectoryEntryRequest {
  40. string directory = 1;
  41. string name = 2;
  42. }
  43. message LookupDirectoryEntryResponse {
  44. Entry entry = 1;
  45. }
  46. message ListEntriesRequest {
  47. string directory = 1;
  48. string prefix = 2;
  49. string startFromFileName = 3;
  50. bool inclusiveStartFrom = 4;
  51. uint32 limit = 5;
  52. }
  53. message ListEntriesResponse {
  54. Entry entry = 1;
  55. }
  56. message Entry {
  57. string name = 1;
  58. bool is_directory = 2;
  59. repeated FileChunk chunks = 3;
  60. FuseAttributes attributes = 4;
  61. map<string, bytes> extended = 5;
  62. }
  63. message FullEntry {
  64. string dir = 1;
  65. Entry entry = 2;
  66. }
  67. message EventNotification {
  68. Entry old_entry = 1;
  69. Entry new_entry = 2;
  70. bool delete_chunks = 3;
  71. string new_parent_path = 4;
  72. }
  73. message FileChunk {
  74. string file_id = 1; // to be deprecated
  75. int64 offset = 2;
  76. uint64 size = 3;
  77. int64 mtime = 4;
  78. string e_tag = 5;
  79. string source_file_id = 6; // to be deprecated
  80. FileId fid = 7;
  81. FileId source_fid = 8;
  82. bytes cipher_key = 9;
  83. bool is_gzipped = 10;
  84. }
  85. message FileId {
  86. uint32 volume_id = 1;
  87. uint64 file_key = 2;
  88. fixed32 cookie = 3;
  89. }
  90. message FuseAttributes {
  91. uint64 file_size = 1;
  92. int64 mtime = 2; // unix time in seconds
  93. uint32 file_mode = 3;
  94. uint32 uid = 4;
  95. uint32 gid = 5;
  96. int64 crtime = 6; // unix time in seconds
  97. string mime = 7;
  98. string replication = 8;
  99. string collection = 9;
  100. int32 ttl_sec = 10;
  101. string user_name = 11; // for hdfs
  102. repeated string group_name = 12; // for hdfs
  103. string symlink_target = 13;
  104. bytes md5 = 14;
  105. }
  106. message CreateEntryRequest {
  107. string directory = 1;
  108. Entry entry = 2;
  109. bool o_excl = 3;
  110. }
  111. message CreateEntryResponse {
  112. string error = 1;
  113. }
  114. message UpdateEntryRequest {
  115. string directory = 1;
  116. Entry entry = 2;
  117. }
  118. message UpdateEntryResponse {
  119. }
  120. message AppendToEntryRequest {
  121. string directory = 1;
  122. string entry_name = 2;
  123. repeated FileChunk chunks = 3;
  124. }
  125. message AppendToEntryResponse {
  126. }
  127. message DeleteEntryRequest {
  128. string directory = 1;
  129. string name = 2;
  130. // bool is_directory = 3;
  131. bool is_delete_data = 4;
  132. bool is_recursive = 5;
  133. bool ignore_recursive_error = 6;
  134. }
  135. message DeleteEntryResponse {
  136. string error = 1;
  137. }
  138. message AtomicRenameEntryRequest {
  139. string old_directory = 1;
  140. string old_name = 2;
  141. string new_directory = 3;
  142. string new_name = 4;
  143. }
  144. message AtomicRenameEntryResponse {
  145. }
  146. message AssignVolumeRequest {
  147. int32 count = 1;
  148. string collection = 2;
  149. string replication = 3;
  150. int32 ttl_sec = 4;
  151. string data_center = 5;
  152. string parent_path = 6;
  153. }
  154. message AssignVolumeResponse {
  155. string file_id = 1;
  156. string url = 2;
  157. string public_url = 3;
  158. int32 count = 4;
  159. string auth = 5;
  160. string collection = 6;
  161. string replication = 7;
  162. string error = 8;
  163. }
  164. message LookupVolumeRequest {
  165. repeated string volume_ids = 1;
  166. }
  167. message Locations {
  168. repeated Location locations = 1;
  169. }
  170. message Location {
  171. string url = 1;
  172. string public_url = 2;
  173. }
  174. message LookupVolumeResponse {
  175. map<string, Locations> locations_map = 1;
  176. }
  177. message DeleteCollectionRequest {
  178. string collection = 1;
  179. }
  180. message DeleteCollectionResponse {
  181. }
  182. message StatisticsRequest {
  183. string replication = 1;
  184. string collection = 2;
  185. string ttl = 3;
  186. }
  187. message StatisticsResponse {
  188. string replication = 1;
  189. string collection = 2;
  190. string ttl = 3;
  191. uint64 total_size = 4;
  192. uint64 used_size = 5;
  193. uint64 file_count = 6;
  194. }
  195. message GetFilerConfigurationRequest {
  196. }
  197. message GetFilerConfigurationResponse {
  198. repeated string masters = 1;
  199. string replication = 2;
  200. string collection = 3;
  201. uint32 max_mb = 4;
  202. string dir_buckets = 5;
  203. bool cipher = 7;
  204. }
  205. message SubscribeMetadataRequest {
  206. string client_name = 1;
  207. string path_prefix = 2;
  208. int64 since_ns = 3;
  209. }
  210. message SubscribeMetadataResponse {
  211. string directory = 1;
  212. EventNotification event_notification = 2;
  213. int64 ts_ns = 3;
  214. }
  215. message LogEntry {
  216. int64 ts_ns = 1;
  217. int32 partition_key_hash = 2;
  218. bytes data = 3;
  219. }
  220. message KeepConnectedRequest {
  221. string name = 1;
  222. uint32 grpc_port = 2;
  223. repeated string resources = 3;
  224. }
  225. message KeepConnectedResponse {
  226. }
  227. message LocateBrokerRequest {
  228. string resource = 1;
  229. }
  230. message LocateBrokerResponse {
  231. bool found = 1;
  232. // if found, send the exact address
  233. // if not found, send the full list of existing brokers
  234. message Resource {
  235. string grpc_addresses = 1;
  236. int32 resource_count = 2;
  237. }
  238. repeated Resource resources = 2;
  239. }