HAServiceProtocol.proto 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. option java_package = "org.apache.hadoop.ha.proto";
  19. option java_outer_classname = "HAServiceProtocolProtos";
  20. option java_generic_services = true;
  21. option java_generate_equals_and_hash = true;
  22. enum HAServiceStateProto {
  23. INITIALIZING = 0;
  24. ACTIVE = 1;
  25. STANDBY = 2;
  26. }
  27. /**
  28. * void request
  29. */
  30. message MonitorHealthRequestProto {
  31. }
  32. /**
  33. * void response
  34. */
  35. message MonitorHealthResponseProto {
  36. }
  37. /**
  38. * void request
  39. */
  40. message TransitionToActiveRequestProto {
  41. }
  42. /**
  43. * void response
  44. */
  45. message TransitionToActiveResponseProto {
  46. }
  47. /**
  48. * void request
  49. */
  50. message TransitionToStandbyRequestProto {
  51. }
  52. /**
  53. * void response
  54. */
  55. message TransitionToStandbyResponseProto {
  56. }
  57. /**
  58. * void request
  59. */
  60. message GetServiceStatusRequestProto {
  61. }
  62. /**
  63. * Returns the state of the service
  64. */
  65. message GetServiceStatusResponseProto {
  66. required HAServiceStateProto state = 1;
  67. // If state is STANDBY, indicate whether it is
  68. // ready to become active.
  69. optional bool readyToBecomeActive = 2;
  70. // If not ready to become active, a textual explanation of why not
  71. optional string notReadyReason = 3;
  72. }
  73. /**
  74. * Protocol interface provides High availability related
  75. * primitives to monitor and failover a service.
  76. *
  77. * For details see o.a.h.ha.HAServiceProtocol.
  78. */
  79. service HAServiceProtocolService {
  80. /**
  81. * Monitor the health of a service.
  82. */
  83. rpc monitorHealth(MonitorHealthRequestProto)
  84. returns(MonitorHealthResponseProto);
  85. /**
  86. * Request service to tranisition to active state.
  87. */
  88. rpc transitionToActive(TransitionToActiveRequestProto)
  89. returns(TransitionToActiveResponseProto);
  90. /**
  91. * Request service to transition to standby state.
  92. */
  93. rpc transitionToStandby(TransitionToStandbyRequestProto)
  94. returns(TransitionToStandbyResponseProto);
  95. /**
  96. * Get the current status of the service.
  97. */
  98. rpc getServiceStatus(GetServiceStatusRequestProto)
  99. returns(GetServiceStatusResponseProto);
  100. }