HAServiceProtocol.proto 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 stable.
  20. * Please see http://wiki.apache.org/hadoop/Compatibility
  21. * for what changes are allowed for a *stable* .proto interface.
  22. */
  23. option java_package = "org.apache.hadoop.ha.proto";
  24. option java_outer_classname = "HAServiceProtocolProtos";
  25. option java_generic_services = true;
  26. option java_generate_equals_and_hash = true;
  27. package hadoop.common;
  28. enum HAServiceStateProto {
  29. INITIALIZING = 0;
  30. ACTIVE = 1;
  31. STANDBY = 2;
  32. OBSERVER = 3;
  33. }
  34. enum HARequestSource {
  35. REQUEST_BY_USER = 0;
  36. REQUEST_BY_USER_FORCED = 1;
  37. REQUEST_BY_ZKFC = 2;
  38. }
  39. message HAStateChangeRequestInfoProto {
  40. required HARequestSource reqSource = 1;
  41. }
  42. /**
  43. * void request
  44. */
  45. message MonitorHealthRequestProto {
  46. }
  47. /**
  48. * void response
  49. */
  50. message MonitorHealthResponseProto {
  51. }
  52. /**
  53. * void request
  54. */
  55. message TransitionToActiveRequestProto {
  56. required HAStateChangeRequestInfoProto reqInfo = 1;
  57. }
  58. /**
  59. * void response
  60. */
  61. message TransitionToActiveResponseProto {
  62. }
  63. /**
  64. * void request
  65. */
  66. message TransitionToStandbyRequestProto {
  67. required HAStateChangeRequestInfoProto reqInfo = 1;
  68. }
  69. /**
  70. * void response
  71. */
  72. message TransitionToStandbyResponseProto {
  73. }
  74. /**
  75. * void request
  76. */
  77. message TransitionToObserverRequestProto {
  78. required HAStateChangeRequestInfoProto reqInfo = 1;
  79. }
  80. /**
  81. * void response
  82. */
  83. message TransitionToObserverResponseProto {
  84. }
  85. /**
  86. * void request
  87. */
  88. message GetServiceStatusRequestProto {
  89. }
  90. /**
  91. * Returns the state of the service
  92. */
  93. message GetServiceStatusResponseProto {
  94. required HAServiceStateProto state = 1;
  95. // If state is STANDBY, indicate whether it is
  96. // ready to become active.
  97. optional bool readyToBecomeActive = 2;
  98. // If not ready to become active, a textual explanation of why not
  99. optional string notReadyReason = 3;
  100. }
  101. /**
  102. * Protocol interface provides High availability related
  103. * primitives to monitor and failover a service.
  104. *
  105. * For details see o.a.h.ha.HAServiceProtocol.
  106. */
  107. service HAServiceProtocolService {
  108. /**
  109. * Monitor the health of a service.
  110. */
  111. rpc monitorHealth(MonitorHealthRequestProto)
  112. returns(MonitorHealthResponseProto);
  113. /**
  114. * Request service to tranisition to active state.
  115. */
  116. rpc transitionToActive(TransitionToActiveRequestProto)
  117. returns(TransitionToActiveResponseProto);
  118. /**
  119. * Request service to transition to standby state.
  120. */
  121. rpc transitionToStandby(TransitionToStandbyRequestProto)
  122. returns(TransitionToStandbyResponseProto);
  123. /**
  124. * Request service to transition to observer state.
  125. */
  126. rpc transitionToObserver(TransitionToObserverRequestProto)
  127. returns(TransitionToObserverResponseProto);
  128. /**
  129. * Get the current status of the service.
  130. */
  131. rpc getServiceStatus(GetServiceStatusRequestProto)
  132. returns(GetServiceStatusResponseProto);
  133. }