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.

412 lines
9.2 KiB

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