Procedure.proto 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. package pb;
  19. option java_package = "org.apache.hadoop.hbase.protobuf.generated";
  20. option java_outer_classname = "ProcedureProtos";
  21. option java_generic_services = true;
  22. option java_generate_equals_and_hash = true;
  23. option optimize_for = SPEED;
  24. import "ErrorHandling.proto";
  25. enum ProcedureState {
  26. INITIALIZING = 1; // Procedure in construction, not yet added to the executor
  27. RUNNABLE = 2; // Procedure added to the executor, and ready to be executed
  28. WAITING = 3; // The procedure is waiting on children to be completed
  29. WAITING_TIMEOUT = 4; // The procedure is waiting a timout or an external event
  30. ROLLEDBACK = 5; // The procedure failed and was rolledback
  31. FINISHED = 6; // The procedure execution is completed. may need a rollback if failed.
  32. }
  33. /**
  34. * Procedure metadata, serialized by the ProcedureStore to be able to recover the old state.
  35. */
  36. message Procedure {
  37. // internal "static" state
  38. required string class_name = 1; // full classname to be able to instantiate the procedure
  39. optional uint64 parent_id = 2; // parent if not a root-procedure otherwise not set
  40. required uint64 proc_id = 3;
  41. required uint64 start_time = 4;
  42. optional string owner = 5;
  43. // internal "runtime" state
  44. required ProcedureState state = 6;
  45. repeated uint32 stack_id = 7; // stack indices in case the procedure was running
  46. required uint64 last_update = 8;
  47. optional uint32 timeout = 9;
  48. // user state/results
  49. optional ForeignExceptionMessage exception = 10;
  50. optional bytes result = 11; // opaque (user) result structure
  51. optional bytes state_data = 12; // opaque (user) procedure internal-state
  52. // Nonce to prevent same procedure submit by multiple times
  53. optional uint64 nonce_group = 13 [default = 0];
  54. optional uint64 nonce = 14 [default = 0];
  55. }
  56. /**
  57. * SequentialProcedure data
  58. */
  59. message SequentialProcedureData {
  60. required bool executed = 1;
  61. }
  62. /**
  63. * StateMachineProcedure data
  64. */
  65. message StateMachineProcedureData {
  66. repeated uint32 state = 1;
  67. }
  68. /**
  69. * Procedure WAL header
  70. */
  71. message ProcedureWALHeader {
  72. required uint32 version = 1;
  73. required uint32 type = 2;
  74. required uint64 log_id = 3;
  75. required uint64 min_proc_id = 4;
  76. }
  77. /**
  78. * Procedure WAL trailer
  79. */
  80. message ProcedureWALTrailer {
  81. required uint32 version = 1;
  82. required uint64 tracker_pos = 2;
  83. }
  84. message ProcedureStoreTracker {
  85. message TrackerNode {
  86. required uint64 start_id = 1;
  87. repeated uint64 updated = 2;
  88. repeated uint64 deleted = 3;
  89. }
  90. repeated TrackerNode node = 1;
  91. }
  92. message ProcedureWALEntry {
  93. enum Type {
  94. PROCEDURE_WAL_EOF = 1;
  95. PROCEDURE_WAL_INIT = 2;
  96. PROCEDURE_WAL_INSERT = 3;
  97. PROCEDURE_WAL_UPDATE = 4;
  98. PROCEDURE_WAL_DELETE = 5;
  99. PROCEDURE_WAL_COMPACT = 6;
  100. }
  101. required Type type = 1;
  102. repeated Procedure procedure = 2;
  103. optional uint64 proc_id = 3;
  104. }