OzoneManagerProtocol.proto 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. /**
  19. * These .proto interfaces are private and unstable.
  20. * Please see http://wiki.apache.org/hadoop/Compatibility
  21. * for what changes are allowed for a *unstable* .proto interface.
  22. */
  23. option java_package = "org.apache.hadoop.ozone.protocol.proto";
  24. option java_outer_classname = "OzoneManagerProtocolProtos";
  25. option java_generic_services = true;
  26. option java_generate_equals_and_hash = true;
  27. package hadoop.ozone;
  28. /**
  29. This is file contains the protocol to communicate with
  30. Ozone Manager. Ozone Manager manages the namespace for ozone.
  31. This is similar to Namenode for Ozone.
  32. */
  33. import "hdfs.proto";
  34. import "hdds.proto";
  35. enum Status {
  36. OK = 1;
  37. VOLUME_NOT_UNIQUE = 2;
  38. VOLUME_NOT_FOUND = 3;
  39. VOLUME_NOT_EMPTY = 4;
  40. VOLUME_ALREADY_EXISTS = 5;
  41. USER_NOT_FOUND = 6;
  42. USER_TOO_MANY_VOLUMES = 7;
  43. BUCKET_NOT_FOUND = 8;
  44. BUCKET_NOT_EMPTY = 9;
  45. BUCKET_ALREADY_EXISTS = 10;
  46. KEY_ALREADY_EXISTS = 11;
  47. KEY_NOT_FOUND = 12;
  48. INVALID_KEY_NAME = 13;
  49. ACCESS_DENIED = 14;
  50. INTERNAL_ERROR = 15;
  51. KEY_ALLOCATION_ERROR = 16;
  52. KEY_DELETION_ERROR = 17;
  53. KEY_RENAME_ERROR = 18;
  54. METADATA_ERROR = 19;
  55. OM_NOT_INITIALIZED = 20;
  56. SCM_VERSION_MISMATCH_ERROR = 21;
  57. }
  58. message VolumeInfo {
  59. required string adminName = 1;
  60. required string ownerName = 2;
  61. required string volume = 3;
  62. optional uint64 quotaInBytes = 4;
  63. repeated hadoop.hdds.KeyValue metadata = 5;
  64. repeated OzoneAclInfo volumeAcls = 6;
  65. required uint64 creationTime = 7;
  66. }
  67. /**
  68. Creates a volume
  69. */
  70. message CreateVolumeRequest {
  71. required VolumeInfo volumeInfo = 1;
  72. }
  73. message CreateVolumeResponse {
  74. required Status status = 1;
  75. }
  76. message VolumeList {
  77. repeated string volumeNames = 1;
  78. }
  79. /**
  80. Changes the Volume Properties -- like ownership and quota for a volume.
  81. */
  82. message SetVolumePropertyRequest {
  83. required string volumeName = 1;
  84. optional string ownerName = 2;
  85. optional uint64 quotaInBytes = 3;
  86. }
  87. message SetVolumePropertyResponse {
  88. required Status status = 1;
  89. }
  90. /**
  91. * Checks if the user has specified permissions for the volume
  92. */
  93. message CheckVolumeAccessRequest {
  94. required string volumeName = 1;
  95. required OzoneAclInfo userAcl = 2;
  96. }
  97. message CheckVolumeAccessResponse {
  98. required Status status = 1;
  99. }
  100. /**
  101. Returns information about a volume.
  102. */
  103. message InfoVolumeRequest {
  104. required string volumeName = 1;
  105. }
  106. message InfoVolumeResponse {
  107. required Status status = 1;
  108. optional VolumeInfo volumeInfo = 2;
  109. }
  110. /**
  111. Deletes an existing volume.
  112. */
  113. message DeleteVolumeRequest {
  114. required string volumeName = 1;
  115. }
  116. message DeleteVolumeResponse {
  117. required Status status = 1;
  118. }
  119. /**
  120. List Volumes -- List all volumes in the cluster or by user.
  121. */
  122. message ListVolumeRequest {
  123. enum Scope {
  124. USER_VOLUMES = 1; // User volumes -- called by user
  125. VOLUMES_BY_USER = 2; // User volumes - called by Admin
  126. VOLUMES_BY_CLUSTER = 3; // All volumes in the cluster
  127. }
  128. required Scope scope = 1;
  129. optional string userName = 2;
  130. optional string prefix = 3;
  131. optional string prevKey = 4;
  132. optional uint32 maxKeys = 5;
  133. }
  134. message ListVolumeResponse {
  135. required Status status = 1;
  136. repeated VolumeInfo volumeInfo = 2;
  137. }
  138. message BucketInfo {
  139. required string volumeName = 1;
  140. required string bucketName = 2;
  141. repeated OzoneAclInfo acls = 3;
  142. required bool isVersionEnabled = 4 [default = false];
  143. required hadoop.hdfs.StorageTypeProto storageType = 5 [default = DISK];
  144. required uint64 creationTime = 6;
  145. }
  146. message BucketArgs {
  147. required string volumeName = 1;
  148. required string bucketName = 2;
  149. repeated OzoneAclInfo addAcls = 3;
  150. repeated OzoneAclInfo removeAcls = 4;
  151. optional bool isVersionEnabled = 5;
  152. optional hadoop.hdfs.StorageTypeProto storageType = 6;
  153. }
  154. message OzoneAclInfo {
  155. enum OzoneAclType {
  156. USER = 1;
  157. GROUP = 2;
  158. WORLD = 3;
  159. }
  160. enum OzoneAclRights {
  161. READ = 1;
  162. WRITE = 2;
  163. READ_WRITE = 3;
  164. }
  165. required OzoneAclType type = 1;
  166. required string name = 2;
  167. required OzoneAclRights rights = 3;
  168. }
  169. message CreateBucketRequest {
  170. required BucketInfo bucketInfo = 1;
  171. }
  172. message CreateBucketResponse {
  173. required Status status = 1;
  174. }
  175. message InfoBucketRequest {
  176. required string volumeName = 1;
  177. required string bucketName = 2;
  178. }
  179. message InfoBucketResponse {
  180. required Status status = 1;
  181. optional BucketInfo bucketInfo = 2;
  182. }
  183. message ListBucketsRequest {
  184. required string volumeName = 1;
  185. optional string startKey = 2;
  186. optional string prefix = 3;
  187. optional int32 count = 4;
  188. }
  189. message ListBucketsResponse {
  190. required Status status = 1;
  191. repeated BucketInfo bucketInfo = 2;
  192. }
  193. message KeyArgs {
  194. required string volumeName = 1;
  195. required string bucketName = 2;
  196. required string keyName = 3;
  197. optional uint64 dataSize = 4;
  198. optional hadoop.hdds.ReplicationType type = 5;
  199. optional hadoop.hdds.ReplicationFactor factor = 6;
  200. }
  201. message KeyLocation {
  202. required hadoop.hdds.BlockID blockID = 1;
  203. required bool shouldCreateContainer = 2;
  204. required uint64 offset = 3;
  205. required uint64 length = 4;
  206. // indicated at which version this block gets created.
  207. optional uint64 createVersion = 5;
  208. }
  209. message KeyLocationList {
  210. optional uint64 version = 1;
  211. repeated KeyLocation keyLocations = 2;
  212. }
  213. message KeyInfo {
  214. required string volumeName = 1;
  215. required string bucketName = 2;
  216. required string keyName = 3;
  217. required uint64 dataSize = 4;
  218. required hadoop.hdds.ReplicationType type = 5;
  219. required hadoop.hdds.ReplicationFactor factor = 6;
  220. repeated KeyLocationList keyLocationList = 7;
  221. required uint64 creationTime = 8;
  222. required uint64 modificationTime = 9;
  223. optional uint64 latestVersion = 10;
  224. }
  225. message LocateKeyRequest {
  226. required KeyArgs keyArgs = 1;
  227. }
  228. message LocateKeyResponse {
  229. required Status status = 1;
  230. optional KeyInfo keyInfo = 2;
  231. // clients' followup request may carry this ID for stateful operations (similar
  232. // to a cookie).
  233. optional uint32 ID = 3;
  234. // TODO : allow specifiying a particular version to read.
  235. optional uint64 openVersion = 4;
  236. }
  237. message SetBucketPropertyRequest {
  238. required BucketArgs bucketArgs = 1;
  239. }
  240. message SetBucketPropertyResponse {
  241. required Status status = 1;
  242. }
  243. message RenameKeyRequest{
  244. required KeyArgs keyArgs = 1;
  245. required string toKeyName = 2;
  246. }
  247. message RenameKeyResponse{
  248. required Status status = 1;
  249. }
  250. message DeleteBucketRequest {
  251. required string volumeName = 1;
  252. required string bucketName = 2;
  253. }
  254. message DeleteBucketResponse {
  255. required Status status = 1;
  256. }
  257. message ListKeysRequest {
  258. required string volumeName = 1;
  259. required string bucketName = 2;
  260. optional string startKey = 3;
  261. optional string prefix = 4;
  262. optional int32 count = 5;
  263. }
  264. message ListKeysResponse {
  265. required Status status = 1;
  266. repeated KeyInfo keyInfo = 2;
  267. }
  268. message AllocateBlockRequest {
  269. required KeyArgs keyArgs = 1;
  270. required uint32 clientID = 2;
  271. }
  272. message AllocateBlockResponse {
  273. required Status status = 1;
  274. required KeyLocation keyLocation = 2;
  275. }
  276. message CommitKeyRequest {
  277. required KeyArgs keyArgs = 1;
  278. required uint32 clientID = 2;
  279. }
  280. message CommitKeyResponse {
  281. required Status status = 1;
  282. }
  283. message ServiceListRequest {
  284. }
  285. message ServiceListResponse {
  286. required Status status = 1;
  287. repeated ServiceInfo serviceInfo = 2;
  288. }
  289. message ServicePort {
  290. enum Type {
  291. RPC = 1;
  292. HTTP = 2;
  293. HTTPS = 3;
  294. RATIS = 4;
  295. };
  296. required Type type = 1;
  297. required uint32 value = 2;
  298. }
  299. message ServiceInfo {
  300. required hadoop.hdds.NodeType nodeType = 1;
  301. required string hostname = 2;
  302. repeated ServicePort servicePorts = 3;
  303. }
  304. /**
  305. The OM service that takes care of Ozone namespace.
  306. */
  307. service OzoneManagerService {
  308. /**
  309. Creates a Volume.
  310. */
  311. rpc createVolume(CreateVolumeRequest)
  312. returns(CreateVolumeResponse);
  313. /**
  314. Allows modificiation of volume properties.
  315. */
  316. rpc setVolumeProperty(SetVolumePropertyRequest)
  317. returns (SetVolumePropertyResponse);
  318. /**
  319. Checks if the specified volume is accesible by the specified user.
  320. */
  321. rpc checkVolumeAccess(CheckVolumeAccessRequest)
  322. returns (CheckVolumeAccessResponse);
  323. /**
  324. Gets Volume information.
  325. */
  326. rpc infoVolume(InfoVolumeRequest)
  327. returns(InfoVolumeResponse);
  328. /**
  329. Deletes a volume if it is empty.
  330. */
  331. rpc deleteVolume(DeleteVolumeRequest)
  332. returns (DeleteVolumeResponse);
  333. /**
  334. Lists Volumes
  335. */
  336. rpc listVolumes(ListVolumeRequest)
  337. returns (ListVolumeResponse);
  338. /**
  339. Creates a Bucket.
  340. */
  341. rpc createBucket(CreateBucketRequest)
  342. returns(CreateBucketResponse);
  343. /**
  344. Get Bucket information.
  345. */
  346. rpc infoBucket(InfoBucketRequest)
  347. returns(InfoBucketResponse);
  348. /**
  349. Sets bucket properties.
  350. */
  351. rpc setBucketProperty(SetBucketPropertyRequest)
  352. returns(SetBucketPropertyResponse);
  353. /**
  354. Get key.
  355. */
  356. rpc createKey(LocateKeyRequest)
  357. returns(LocateKeyResponse);
  358. /**
  359. Look up for an existing key.
  360. */
  361. rpc lookupKey(LocateKeyRequest)
  362. returns(LocateKeyResponse);
  363. /**
  364. Rename an existing key within a bucket.
  365. */
  366. rpc renameKey(RenameKeyRequest)
  367. returns(RenameKeyResponse);
  368. /**
  369. Delete an existing key.
  370. */
  371. rpc deleteKey(LocateKeyRequest)
  372. returns(LocateKeyResponse);
  373. /**
  374. Deletes a bucket from volume if it is empty.
  375. */
  376. rpc deleteBucket(DeleteBucketRequest)
  377. returns (DeleteBucketResponse);
  378. /**
  379. List Buckets.
  380. */
  381. rpc listBuckets(ListBucketsRequest)
  382. returns(ListBucketsResponse);
  383. /**
  384. List Keys.
  385. */
  386. rpc listKeys(ListKeysRequest)
  387. returns(ListKeysResponse);
  388. /**
  389. Commit a key.
  390. */
  391. rpc commitKey(CommitKeyRequest)
  392. returns(CommitKeyResponse);
  393. /**
  394. Allocate a new block for a key.
  395. */
  396. rpc allocateBlock(AllocateBlockRequest)
  397. returns(AllocateBlockResponse);
  398. /**
  399. Returns list of Ozone services with its configuration details.
  400. */
  401. rpc getServiceList(ServiceListRequest)
  402. returns(ServiceListResponse);
  403. }