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.

334 lines
7.2 KiB

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