filer.proto 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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. }
  124. message CreateEntryRequest {
  125. string directory = 1;
  126. Entry entry = 2;
  127. bool o_excl = 3;
  128. bool is_from_other_cluster = 4;
  129. repeated int32 signatures = 5;
  130. }
  131. message CreateEntryResponse {
  132. string error = 1;
  133. }
  134. message UpdateEntryRequest {
  135. string directory = 1;
  136. Entry entry = 2;
  137. bool is_from_other_cluster = 3;
  138. repeated int32 signatures = 4;
  139. }
  140. message UpdateEntryResponse {
  141. }
  142. message AppendToEntryRequest {
  143. string directory = 1;
  144. string entry_name = 2;
  145. repeated FileChunk chunks = 3;
  146. }
  147. message AppendToEntryResponse {
  148. }
  149. message DeleteEntryRequest {
  150. string directory = 1;
  151. string name = 2;
  152. // bool is_directory = 3;
  153. bool is_delete_data = 4;
  154. bool is_recursive = 5;
  155. bool ignore_recursive_error = 6;
  156. bool is_from_other_cluster = 7;
  157. repeated int32 signatures = 8;
  158. }
  159. message DeleteEntryResponse {
  160. string error = 1;
  161. }
  162. message AtomicRenameEntryRequest {
  163. string old_directory = 1;
  164. string old_name = 2;
  165. string new_directory = 3;
  166. string new_name = 4;
  167. }
  168. message AtomicRenameEntryResponse {
  169. }
  170. message AssignVolumeRequest {
  171. int32 count = 1;
  172. string collection = 2;
  173. string replication = 3;
  174. int32 ttl_sec = 4;
  175. string data_center = 5;
  176. string path = 6;
  177. string rack = 7;
  178. }
  179. message AssignVolumeResponse {
  180. string file_id = 1;
  181. string url = 2;
  182. string public_url = 3;
  183. int32 count = 4;
  184. string auth = 5;
  185. string collection = 6;
  186. string replication = 7;
  187. string error = 8;
  188. }
  189. message LookupVolumeRequest {
  190. repeated string volume_ids = 1;
  191. }
  192. message Locations {
  193. repeated Location locations = 1;
  194. }
  195. message Location {
  196. string url = 1;
  197. string public_url = 2;
  198. }
  199. message LookupVolumeResponse {
  200. map<string, Locations> locations_map = 1;
  201. }
  202. message Collection {
  203. string name = 1;
  204. }
  205. message CollectionListRequest {
  206. bool include_normal_volumes = 1;
  207. bool include_ec_volumes = 2;
  208. }
  209. message CollectionListResponse {
  210. repeated Collection collections = 1;
  211. }
  212. message DeleteCollectionRequest {
  213. string collection = 1;
  214. }
  215. message DeleteCollectionResponse {
  216. }
  217. message StatisticsRequest {
  218. string replication = 1;
  219. string collection = 2;
  220. string ttl = 3;
  221. }
  222. message StatisticsResponse {
  223. string replication = 1;
  224. string collection = 2;
  225. string ttl = 3;
  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. enum DiskType {
  303. NONE = 0;
  304. HDD = 1;
  305. SSD = 2;
  306. }
  307. DiskType disk_type = 5;
  308. bool fsync = 6;
  309. uint32 volume_growth_count = 7;
  310. }
  311. repeated PathConf locations = 2;
  312. }