StorageContainerLocationProtocol.proto 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 = "StorageContainerLocationProtocolProtos";
  25. option java_generic_services = true;
  26. option java_generate_equals_and_hash = true;
  27. package hadoop.hdfs;
  28. import "hdfs.proto";
  29. import "DatanodeContainerProtocol.proto";
  30. /**
  31. * keys - batch of object keys to find
  32. */
  33. message GetStorageContainerLocationsRequestProto {
  34. repeated string keys = 1;
  35. }
  36. /**
  37. * locatedContainers - for each requested hash, nodes that currently host the
  38. * container for that object key hash
  39. */
  40. message GetStorageContainerLocationsResponseProto {
  41. repeated LocatedContainerProto locatedContainers = 1;
  42. }
  43. /**
  44. * Holds the nodes that currently host the container for an object key.
  45. */
  46. message LocatedContainerProto {
  47. required string key = 1;
  48. required string matchedKeyPrefix = 2;
  49. required string containerName = 3;
  50. repeated DatanodeInfoProto locations = 4;
  51. required DatanodeInfoProto leader = 5;
  52. }
  53. /**
  54. * Request send to SCM asking where the container should be created.
  55. */
  56. message ContainerRequestProto {
  57. required string containerName = 1;
  58. // Ozone only support replciation of either 1 or 3.
  59. enum ReplicationFactor {
  60. ONE = 1;
  61. THREE = 3;
  62. }
  63. required ReplicationFactor replicationFactor = 2;
  64. }
  65. /**
  66. * Reply from SCM indicating that the container.
  67. */
  68. message ContainerResponseProto {
  69. enum Error {
  70. success = 1;
  71. errorContainerAlreadyExists = 2;
  72. errorContainerMissing = 3;
  73. }
  74. required Error errorCode = 1;
  75. required hadoop.hdfs.ozone.Pipeline pipeline = 2;
  76. optional string errorMessage = 3;
  77. }
  78. message GetContainerRequestProto {
  79. required string containerName = 1;
  80. }
  81. message GetContainerResponseProto {
  82. required hadoop.hdfs.ozone.Pipeline pipeline = 1;
  83. }
  84. message DeleteContainerRequestProto {
  85. required string containerName = 1;
  86. }
  87. message DeleteContainerResponseProto {
  88. // Empty response
  89. }
  90. // SCM Block protocol
  91. /**
  92. * keys - batch of block keys to find
  93. */
  94. message GetScmBlockLocationsRequestProto {
  95. repeated string keys = 1;
  96. }
  97. /**
  98. * locatedBlocks - for each requested hash, nodes that currently host the
  99. * container for that object key hash
  100. */
  101. message GetScmBlockLocationsResponseProto {
  102. repeated ScmLocatedBlockProto locatedBlocks = 1;
  103. }
  104. /**
  105. * Holds the nodes that currently host the blocks for a key.
  106. */
  107. message ScmLocatedBlockProto {
  108. required string key = 1;
  109. required hadoop.hdfs.ozone.Pipeline pipeline = 2;
  110. }
  111. /**
  112. * Request send to SCM asking allocate block of specified size.
  113. */
  114. message AllocateScmBlockRequestProto {
  115. required uint64 size = 1;
  116. }
  117. /**
  118. * Reply from SCM indicating that the container.
  119. */
  120. message AllocateScmBlockResponseProto {
  121. enum Error {
  122. success = 1;
  123. errorNotEnoughSpace = 2;
  124. errorSizeTooBig = 3;
  125. unknownFailure = 4;
  126. }
  127. required Error errorCode = 1;
  128. required string key = 2;
  129. required hadoop.hdfs.ozone.Pipeline pipeline = 3;
  130. required bool createContainer = 4;
  131. optional string errorMessage = 5;
  132. }
  133. /**
  134. * Protocol used from an HDFS node to StorageContainerManager. See the request
  135. * and response messages for details of the RPC calls.
  136. */
  137. service StorageContainerLocationProtocolService {
  138. /**
  139. * Find the set of nodes that currently host the container of an object, as
  140. * identified by the object key hash. This method supports batch lookup by
  141. * passing multiple key hashes.
  142. */
  143. rpc getStorageContainerLocations(GetStorageContainerLocationsRequestProto)
  144. returns(GetStorageContainerLocationsResponseProto);
  145. /**
  146. * Creates a container entry in SCM.
  147. */
  148. rpc allocateContainer(ContainerRequestProto) returns (ContainerResponseProto);
  149. /**
  150. * Returns the pipeline for a given container.
  151. */
  152. rpc getContainer(GetContainerRequestProto) returns (GetContainerResponseProto);
  153. /**
  154. * Deletes a container in SCM.
  155. */
  156. rpc deleteContainer(DeleteContainerRequestProto) returns (DeleteContainerResponseProto);
  157. /**
  158. * Find the set of nodes that currently host the block, as
  159. * identified by the key. This method supports batch lookup by
  160. * passing multiple keys.
  161. */
  162. rpc getScmBlockLocations(GetScmBlockLocationsRequestProto)
  163. returns(GetScmBlockLocationsResponseProto);
  164. /**
  165. Creates a block entry in SCM.
  166. */
  167. rpc allocateScmBlock(AllocateScmBlockRequestProto)
  168. returns (AllocateScmBlockResponseProto);
  169. }