1 /*
2  * RecoveryState.h
3  *
4  * This source file is part of the FoundationDB open source project
5  *
6  * Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef FDBSERVER_RECOVERYSTATE_H
22 #define FDBSERVER_RECOVERYSTATE_H
23 #pragma once
24 
25 #include "flow/serialize.h"
26 
27 // RecoveryState and RecoveryStatus should probably be merged.  The former is passed through ServerDBInfo and used for "real" decisions in the system; the latter
28 // is slightly more detailed and is used by the status infrastructure.  But I'm scared to make changes to the former so close to 1.0 release, so I'm making the latter.
29 
30 enum class RecoveryState { UNINITIALIZED = 0, READING_CSTATE = 1, LOCKING_CSTATE = 2, RECRUITING = 3, RECOVERY_TRANSACTION = 4, WRITING_CSTATE = 5, ACCEPTING_COMMITS = 6, ALL_LOGS_RECRUITED = 7, STORAGE_RECOVERED = 8, FULLY_RECOVERED = 9 };
31 BINARY_SERIALIZABLE( RecoveryState );
32 
33 namespace RecoveryStatus {
34 	enum RecoveryStatus {
35 		reading_coordinated_state,
36 		locking_coordinated_state,
37 		locking_old_transaction_servers,
38 		reading_transaction_system_state,
39 		configuration_missing,
40 		configuration_never_created,
41 		configuration_invalid,
42 		recruiting_transaction_servers,
43 		initializing_transaction_servers,
44 		recovery_transaction,
45 		writing_coordinated_state,
46 		accepting_commits,
47 		all_logs_recruited,
48 		storage_recovered,
49 		fully_recovered,
50 		END
51 	};
52 
53 	// in Status.actor.cpp
54 	extern const char* names[];
55 	extern const char* descriptions[];
56 };
57 
58 #endif
59