ScmBlockLocationProtocol.proto 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.hdds.protocol.proto";
  24. option java_outer_classname = "ScmBlockLocationProtocolProtos";
  25. option java_generic_services = true;
  26. option java_generate_equals_and_hash = true;
  27. package hadoop.hdds;
  28. import "hdfs.proto";
  29. import "hdds.proto";
  30. // SCM Block protocol
  31. /**
  32. * Request send to SCM asking allocate block of specified size.
  33. */
  34. message AllocateScmBlockRequestProto {
  35. required uint64 size = 1;
  36. required ReplicationType type = 2;
  37. required hadoop.hdds.ReplicationFactor factor = 3;
  38. required string owner = 4;
  39. }
  40. /**
  41. * A delete key request sent by OM to SCM, it contains
  42. * multiple number of keys (and their blocks).
  43. */
  44. message DeleteScmKeyBlocksRequestProto {
  45. repeated KeyBlocks keyBlocks = 1;
  46. }
  47. /**
  48. * A object key and all its associated blocks.
  49. * We need to encapsulate object key name plus the blocks in this potocol
  50. * because SCM needs to response OM with the keys it has deleted.
  51. * If the response only contains blocks, it will be very expensive for
  52. * OM to figure out what keys have been deleted.
  53. */
  54. message KeyBlocks {
  55. required string key = 1;
  56. repeated BlockID blocks = 2;
  57. }
  58. /**
  59. * A delete key response from SCM to OM, it contains multiple child-results.
  60. * Each child-result represents a key deletion result, only if all blocks of
  61. * a key are successfully deleted, this key result is considered as succeed.
  62. */
  63. message DeleteScmKeyBlocksResponseProto {
  64. repeated DeleteKeyBlocksResultProto results = 1;
  65. }
  66. /**
  67. * A key deletion result. It contains all the block deletion results.
  68. */
  69. message DeleteKeyBlocksResultProto {
  70. required string objectKey = 1;
  71. repeated DeleteScmBlockResult blockResults = 2;
  72. }
  73. message DeleteScmBlockResult {
  74. enum Result {
  75. success = 1;
  76. chillMode = 2;
  77. errorNotFound = 3;
  78. unknownFailure = 4;
  79. }
  80. required Result result = 1;
  81. required BlockID blockID = 2;
  82. }
  83. /**
  84. * Reply from SCM indicating that the container.
  85. */
  86. message AllocateScmBlockResponseProto {
  87. enum Error {
  88. success = 1;
  89. errorNotEnoughSpace = 2;
  90. errorSizeTooBig = 3;
  91. unknownFailure = 4;
  92. }
  93. required Error errorCode = 1;
  94. optional BlockID blockID = 2;
  95. optional hadoop.hdds.Pipeline pipeline = 3;
  96. optional bool createContainer = 4;
  97. optional string errorMessage = 5;
  98. }
  99. /**
  100. * Protocol used from OzoneManager to StorageContainerManager.
  101. * See request and response messages for details of the RPC calls.
  102. */
  103. service ScmBlockLocationProtocolService {
  104. /**
  105. * Creates a block entry in SCM.
  106. */
  107. rpc allocateScmBlock(AllocateScmBlockRequestProto)
  108. returns (AllocateScmBlockResponseProto);
  109. /**
  110. * Deletes blocks for a set of object keys from SCM.
  111. */
  112. rpc deleteScmKeyBlocks(DeleteScmKeyBlocksRequestProto)
  113. returns (DeleteScmKeyBlocksResponseProto);
  114. /**
  115. * Gets the scmInfo from SCM.
  116. */
  117. rpc getScmInfo(hadoop.hdds.GetScmInfoRequestProto)
  118. returns (hadoop.hdds.GetScmInfoRespsonseProto);
  119. }