diff options
author | Alan Conway <aconway@apache.org> | 2009-11-24 22:41:10 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2009-11-24 22:41:10 +0000 |
commit | 8477c62f2a4f7d989f0e1ea1ac3f2a2505d9a9dd (patch) | |
tree | db2ad51f6cdf82d42a0c4025aa01caa5cf0802b7 /cpp/src/qpid/cluster/StoreStatus.cpp | |
parent | 51d4bf1a1a07e53164c6e771f6ecf10e3ffca4ec (diff) | |
download | qpid-python-8477c62f2a4f7d989f0e1ea1ac3f2a2505d9a9dd.tar.gz |
Verify stored cluster-id matches agreed cluster-id when joining a persistent cluster.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@883910 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/StoreStatus.cpp')
-rw-r--r-- | cpp/src/qpid/cluster/StoreStatus.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/cpp/src/qpid/cluster/StoreStatus.cpp b/cpp/src/qpid/cluster/StoreStatus.cpp index 1c5f581ea1..3602ec9188 100644 --- a/cpp/src/qpid/cluster/StoreStatus.cpp +++ b/cpp/src/qpid/cluster/StoreStatus.cpp @@ -39,8 +39,8 @@ StoreStatus::StoreStatus(const std::string& d) namespace { const char* SUBDIR="cluster"; -const char* START_FILE="start"; -const char* STOP_FILE="stop"; +const char* CLUSTER_ID_FILE="cluster.uuid"; +const char* SHUTDOWN_ID_FILE="shutdown.uuid"; Uuid loadUuid(const path& path) { Uuid ret; @@ -62,33 +62,33 @@ void saveUuid(const path& path, const Uuid& uuid) { void StoreStatus::load() { path dir = path(dataDir)/SUBDIR; create_directory(dir); - start = loadUuid(dir/START_FILE); - stop = loadUuid(dir/STOP_FILE); + clusterId = loadUuid(dir/CLUSTER_ID_FILE); + shutdownId = loadUuid(dir/SHUTDOWN_ID_FILE); - if (start && stop) state = STORE_STATE_CLEAN_STORE; - else if (start) state = STORE_STATE_DIRTY_STORE; + if (clusterId && shutdownId) state = STORE_STATE_CLEAN_STORE; + else if (clusterId) state = STORE_STATE_DIRTY_STORE; else state = STORE_STATE_EMPTY_STORE; } void StoreStatus::save() { path dir = path(dataDir)/SUBDIR; create_directory(dir); - saveUuid(dir/START_FILE, start); - saveUuid(dir/STOP_FILE, stop); + saveUuid(dir/CLUSTER_ID_FILE, clusterId); + saveUuid(dir/SHUTDOWN_ID_FILE, shutdownId); } -void StoreStatus::dirty(const Uuid& start_) { - start = start_; - stop = Uuid(); +void StoreStatus::dirty(const Uuid& clusterId_) { + clusterId = clusterId_; + shutdownId = Uuid(); state = STORE_STATE_DIRTY_STORE; save(); } -void StoreStatus::clean(const Uuid& stop_) { - assert(start); // FIXME aconway 2009-11-20: exception? - assert(stop_); +void StoreStatus::clean(const Uuid& shutdownId_) { + assert(clusterId); // FIXME aconway 2009-11-20: throw exception + assert(shutdownId_); state = STORE_STATE_CLEAN_STORE; - stop = stop_; + shutdownId = shutdownId_; save(); } |