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.

292 lines
6.2 KiB

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