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.

296 lines
6.3 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. bool is_from_other_cluster = 5;
  74. }
  75. message FileChunk {
  76. string file_id = 1; // to be deprecated
  77. int64 offset = 2;
  78. uint64 size = 3;
  79. int64 mtime = 4;
  80. string e_tag = 5;
  81. string source_file_id = 6; // to be deprecated
  82. FileId fid = 7;
  83. FileId source_fid = 8;
  84. bytes cipher_key = 9;
  85. bool is_compressed = 10;
  86. }
  87. message FileId {
  88. uint32 volume_id = 1;
  89. uint64 file_key = 2;
  90. fixed32 cookie = 3;
  91. }
  92. message FuseAttributes {
  93. uint64 file_size = 1;
  94. int64 mtime = 2; // unix time in seconds
  95. uint32 file_mode = 3;
  96. uint32 uid = 4;
  97. uint32 gid = 5;
  98. int64 crtime = 6; // unix time in seconds
  99. string mime = 7;
  100. string replication = 8;
  101. string collection = 9;
  102. int32 ttl_sec = 10;
  103. string user_name = 11; // for hdfs
  104. repeated string group_name = 12; // for hdfs
  105. string symlink_target = 13;
  106. bytes md5 = 14;
  107. }
  108. message CreateEntryRequest {
  109. string directory = 1;
  110. Entry entry = 2;
  111. bool o_excl = 3;
  112. bool is_from_other_cluster = 4;
  113. }
  114. message CreateEntryResponse {
  115. string error = 1;
  116. }
  117. message UpdateEntryRequest {
  118. string directory = 1;
  119. Entry entry = 2;
  120. bool is_from_other_cluster = 3;
  121. }
  122. message UpdateEntryResponse {
  123. }
  124. message AppendToEntryRequest {
  125. string directory = 1;
  126. string entry_name = 2;
  127. repeated FileChunk chunks = 3;
  128. }
  129. message AppendToEntryResponse {
  130. }
  131. message DeleteEntryRequest {
  132. string directory = 1;
  133. string name = 2;
  134. // bool is_directory = 3;
  135. bool is_delete_data = 4;
  136. bool is_recursive = 5;
  137. bool ignore_recursive_error = 6;
  138. bool is_from_other_cluster = 7;
  139. }
  140. message DeleteEntryResponse {
  141. string error = 1;
  142. }
  143. message AtomicRenameEntryRequest {
  144. string old_directory = 1;
  145. string old_name = 2;
  146. string new_directory = 3;
  147. string new_name = 4;
  148. }
  149. message AtomicRenameEntryResponse {
  150. }
  151. message AssignVolumeRequest {
  152. int32 count = 1;
  153. string collection = 2;
  154. string replication = 3;
  155. int32 ttl_sec = 4;
  156. string data_center = 5;
  157. string parent_path = 6;
  158. }
  159. message AssignVolumeResponse {
  160. string file_id = 1;
  161. string url = 2;
  162. string public_url = 3;
  163. int32 count = 4;
  164. string auth = 5;
  165. string collection = 6;
  166. string replication = 7;
  167. string error = 8;
  168. }
  169. message LookupVolumeRequest {
  170. repeated string volume_ids = 1;
  171. }
  172. message Locations {
  173. repeated Location locations = 1;
  174. }
  175. message Location {
  176. string url = 1;
  177. string public_url = 2;
  178. }
  179. message LookupVolumeResponse {
  180. map<string, Locations> locations_map = 1;
  181. }
  182. message DeleteCollectionRequest {
  183. string collection = 1;
  184. }
  185. message DeleteCollectionResponse {
  186. }
  187. message StatisticsRequest {
  188. string replication = 1;
  189. string collection = 2;
  190. string ttl = 3;
  191. }
  192. message StatisticsResponse {
  193. string replication = 1;
  194. string collection = 2;
  195. string ttl = 3;
  196. uint64 total_size = 4;
  197. uint64 used_size = 5;
  198. uint64 file_count = 6;
  199. }
  200. message GetFilerConfigurationRequest {
  201. }
  202. message GetFilerConfigurationResponse {
  203. repeated string masters = 1;
  204. string replication = 2;
  205. string collection = 3;
  206. uint32 max_mb = 4;
  207. string dir_buckets = 5;
  208. bool cipher = 7;
  209. }
  210. message SubscribeMetadataRequest {
  211. string client_name = 1;
  212. string path_prefix = 2;
  213. int64 since_ns = 3;
  214. }
  215. message SubscribeMetadataResponse {
  216. string directory = 1;
  217. EventNotification event_notification = 2;
  218. int64 ts_ns = 3;
  219. }
  220. message LogEntry {
  221. int64 ts_ns = 1;
  222. int32 partition_key_hash = 2;
  223. bytes data = 3;
  224. }
  225. message KeepConnectedRequest {
  226. string name = 1;
  227. uint32 grpc_port = 2;
  228. repeated string resources = 3;
  229. }
  230. message KeepConnectedResponse {
  231. }
  232. message LocateBrokerRequest {
  233. string resource = 1;
  234. }
  235. message LocateBrokerResponse {
  236. bool found = 1;
  237. // if found, send the exact address
  238. // if not found, send the full list of existing brokers
  239. message Resource {
  240. string grpc_addresses = 1;
  241. int32 resource_count = 2;
  242. }
  243. repeated Resource resources = 2;
  244. }