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.

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