title: storage/gcs_global_db.hpp summary: NEO-SWARM-owned sgns::crdt::GlobalDB component (Phase 3, D-01..D-04). Owns the GCS CRDT lifecycle: pulls the shared GossipPubSub from the in-process GeniusSDK (D-15/D-16a), constructs io_context/scheduler/graphsync network/request-id generator locally (D-17), wires the gcs-reputation topic (D-07), and exposes an init-style lifecycle (D-13).
storage/gcs_global_db.hpp¶
NEO-SWARM-owned sgns::crdt::GlobalDB component (Phase 3, D-01..D-04). Owns the GCS CRDT lifecycle: pulls the shared GossipPubSub from the in-process GeniusSDK (D-15/D-16a), constructs io_context/scheduler/graphsync network/request-id generator locally (D-17), wires the gcs-reputation topic (D-07), and exposes an init-style lifecycle (D-13). More...
Namespaces¶
| Name |
|---|
| sgns |
| sgns::crdt |
| sgns::ipfs_pubsub |
| sgns::ipfs_lite |
| sgns::ipfs_lite::ipfs |
| sgns::ipfs_lite::ipfs::graphsync |
| libp2p |
| libp2p::basic |
| sgns::neoswarm |
| sgns::neoswarm::storage |
Classes¶
| Name | |
|---|---|
| class | sgns::neoswarm::storage::GcsGlobalDb GCS GlobalDB component — single owner of the NEO-SWARM CRDT store. |
| struct | sgns::neoswarm::storage::GcsGlobalDb::Config Component configuration. |
Detailed Description¶
NEO-SWARM-owned sgns::crdt::GlobalDB component (Phase 3, D-01..D-04). Owns the GCS CRDT lifecycle: pulls the shared GossipPubSub from the in-process GeniusSDK (D-15/D-16a), constructs io_context/scheduler/graphsync network/request-id generator locally (D-17), wires the gcs-reputation topic (D-07), and exposes an init-style lifecycle (D-13).
Date: 2026-08-10
Source code¶
#ifndef NEOSWARM_STORAGE_GCS_GLOBAL_DB_HPP
#define NEOSWARM_STORAGE_GCS_GLOBAL_DB_HPP
#include <atomic>
#include <memory>
#include <string>
#include <thread>
#include <boost/asio/io_context.hpp>
#include "common/error.hpp"
#include "common/logging.hpp"
// ---------------------------------------------------------------------------
// Forward declarations — heavy SuperGenius/libp2p headers stay in the .cpp.
// ---------------------------------------------------------------------------
namespace sgns::crdt
{
class GlobalDB;
}
namespace sgns::ipfs_pubsub
{
class GossipPubSub;
}
namespace sgns::ipfs_lite::ipfs::graphsync
{
class Network;
class RequestIdGenerator;
}
namespace libp2p::basic
{
class Scheduler;
}
namespace sgns::neoswarm::storage
{
class GcsGlobalDb
{
public:
struct Config
{
static constexpr const char *kDefaultDbPath = "./gcs.db";
static constexpr const char *kReputationTopic = "gcs-reputation";
std::string m_dbPath = kDefaultDbPath;
};
explicit GcsGlobalDb( Config cfg ) noexcept;
~GcsGlobalDb();
GcsGlobalDb( const GcsGlobalDb & ) = delete;
GcsGlobalDb &operator=( const GcsGlobalDb & ) = delete;
GcsGlobalDb( GcsGlobalDb && ) = delete;
GcsGlobalDb &operator=( GcsGlobalDb && ) = delete;
outcome::result<void> Initialize();
outcome::result<void> Initialize( std::shared_ptr<sgns::ipfs_pubsub::GossipPubSub> pubsub );
void Shutdown() noexcept;
bool IsRunning() const noexcept;
private:
Config m_cfg;
std::shared_ptr<boost::asio::io_context> m_io;
std::shared_ptr<libp2p::basic::Scheduler> m_scheduler;
std::shared_ptr<sgns::ipfs_lite::ipfs::graphsync::Network> m_graphsyncNetwork;
std::shared_ptr<sgns::ipfs_lite::ipfs::graphsync::RequestIdGenerator> m_generator;
std::shared_ptr<sgns::crdt::GlobalDB> m_db;
std::thread m_ioThread;
std::atomic<bool> m_running{ false };
Logger m_logger;
};
} // namespace sgns::neoswarm::storage
#endif // NEOSWARM_STORAGE_GCS_GLOBAL_DB_HPP
Updated on 2026-10-09 at 03:59:42 +0000