summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/StoreStatus.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-11-24 20:07:24 +0000
committerAlan Conway <aconway@apache.org>2009-11-24 20:07:24 +0000
commit0fb7ff9cfbfd01e9093c2c6021a5915696d2a089 (patch)
tree1d2db335592be80a9aa9f8f404d2c1682afeb485 /cpp/src/qpid/cluster/StoreStatus.h
parent1ee447563d208b39e962537a47f14aea741777b0 (diff)
downloadqpid-python-0fb7ff9cfbfd01e9093c2c6021a5915696d2a089.tar.gz
Support for restarting a persistent cluster.
Option --cluster-size=N: members wait for N members before recovering store. Stores marked as clean/dirty. Automatically recover from clean store on restart. Stores marked with UUID to detect errors. Not yet implemented: consistency checks, manual recovery from all dirty stores. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@883842 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/StoreStatus.h')
-rw-r--r--cpp/src/qpid/cluster/StoreStatus.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/cpp/src/qpid/cluster/StoreStatus.h b/cpp/src/qpid/cluster/StoreStatus.h
new file mode 100644
index 0000000000..b4c6bda480
--- /dev/null
+++ b/cpp/src/qpid/cluster/StoreStatus.h
@@ -0,0 +1,61 @@
+#ifndef QPID_CLUSTER_STORESTATE_H
+#define QPID_CLUSTER_STORESTATE_H
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "qpid/framing/Uuid.h"
+#include "qpid/framing/enum.h"
+
+namespace qpid {
+namespace cluster {
+
+/**
+ * State of the store for cluster purposes.
+ */
+class StoreStatus
+{
+ public:
+ typedef framing::Uuid Uuid;
+ typedef framing::cluster::StoreState StoreState;
+
+ StoreStatus(const std::string& dir);
+
+ framing::cluster::StoreState getState() const { return state; }
+ Uuid getStart() const { return start; }
+ Uuid getStop() const { return stop; }
+
+ void dirty(const Uuid& start); // Start using the store.
+ void clean(const Uuid& stop); // Stop using the store.
+
+ void load();
+ void save();
+
+ bool hasStore() { return state != framing::cluster::STORE_STATE_NO_STORE; }
+ bool isEmpty() { return state != framing::cluster::STORE_STATE_EMPTY_STORE; }
+ private:
+ framing::cluster::StoreState state;
+ Uuid start, stop;
+ std::string dataDir;
+};
+}} // namespace qpid::cluster
+
+#endif /*!QPID_CLUSTER_STORESTATE_H*/