Loading src/backend.cpp +46 −0 Original line number Diff line number Diff line Loading @@ -3218,6 +3218,52 @@ void ClusterMediaBackend::repair_index() { replicate_index(); } void ClusterMediaBackend::purge_all_data() { std::cerr << "[CLUSTER-PURGE] starting full purge\n"; std::unique_lock<std::shared_mutex> cguard(cluster_op_mutex_); // 1. Collect all group IDs from all nodes std::unordered_set<uint64_t> all_gids; for (const auto& pg : cluster_.list_peer_groups()) { for (auto gid : pg.groups) all_gids.insert(gid); } std::cerr << "[CLUSTER-PURGE] found " << all_gids.size() << " unique groups across cluster\n"; // 2. Remove every group from the cluster auto& cli = cluster_.getClient(); if (cli) { for (uint64_t gid : all_gids) { try { cli->remove(gid); } catch (...) {} } } std::cerr << "[CLUSTER-PURGE] removed " << all_gids.size() << " groups from cluster\n"; // 3. Clear local state: delete all stores (cascades albums + media) auto sids = local_.store_ids(); for (const auto& sid : sids) { local_.delete_store(sid); } // 4. Clear tombstones tombstones_.clear(); // 5. Vacuum all nodes to reclaim disk space cluster_.vacuum_all_nodes(); // 6. Reset sync state initial_sync_ok_.store(false); importing_.store(false); std::cerr << "[CLUSTER-PURGE] complete: removed " << sids.size() << " local stores, " << all_gids.size() << " cluster groups\n"; } void ClusterMediaBackend::replicate_index(bool force) { if (!cluster_.isRunning()) return; auto buf = local_.save_index_to_buffer(); Loading src/backend.h +1 −0 Original line number Diff line number Diff line Loading @@ -325,6 +325,7 @@ public: void start_sync(); void sync_from_cluster(); void repair_index(); void purge_all_data(); BinDb& local(); private: Loading Loading
src/backend.cpp +46 −0 Original line number Diff line number Diff line Loading @@ -3218,6 +3218,52 @@ void ClusterMediaBackend::repair_index() { replicate_index(); } void ClusterMediaBackend::purge_all_data() { std::cerr << "[CLUSTER-PURGE] starting full purge\n"; std::unique_lock<std::shared_mutex> cguard(cluster_op_mutex_); // 1. Collect all group IDs from all nodes std::unordered_set<uint64_t> all_gids; for (const auto& pg : cluster_.list_peer_groups()) { for (auto gid : pg.groups) all_gids.insert(gid); } std::cerr << "[CLUSTER-PURGE] found " << all_gids.size() << " unique groups across cluster\n"; // 2. Remove every group from the cluster auto& cli = cluster_.getClient(); if (cli) { for (uint64_t gid : all_gids) { try { cli->remove(gid); } catch (...) {} } } std::cerr << "[CLUSTER-PURGE] removed " << all_gids.size() << " groups from cluster\n"; // 3. Clear local state: delete all stores (cascades albums + media) auto sids = local_.store_ids(); for (const auto& sid : sids) { local_.delete_store(sid); } // 4. Clear tombstones tombstones_.clear(); // 5. Vacuum all nodes to reclaim disk space cluster_.vacuum_all_nodes(); // 6. Reset sync state initial_sync_ok_.store(false); importing_.store(false); std::cerr << "[CLUSTER-PURGE] complete: removed " << sids.size() << " local stores, " << all_gids.size() << " cluster groups\n"; } void ClusterMediaBackend::replicate_index(bool force) { if (!cluster_.isRunning()) return; auto buf = local_.save_index_to_buffer(); Loading
src/backend.h +1 −0 Original line number Diff line number Diff line Loading @@ -325,6 +325,7 @@ public: void start_sync(); void sync_from_cluster(); void repair_index(); void purge_all_data(); BinDb& local(); private: Loading