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.

366 lines
8.0 KiB

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