Skip to content

sgns::MigrationManager

Executes a sequence of migration steps to update a CRDT store.

#include <MigrationManager.hpp>

Inherits from std::enable_shared_from_this< MigrationManager >

Public Types

Name
enum class Error

Public Functions

Name
std::shared_ptr< MigrationManager > New(std::shared_ptr< boost::asio::io_context > ioContext, std::shared_ptr< ipfs_pubsub::GossipPubSub > pubSub, std::shared_ptr< ipfs_lite::ipfs::graphsync::Network > graphsync, std::shared_ptr< libp2p::protocol::Scheduler > scheduler, std::shared_ptr< ipfs_lite::ipfs::graphsync::RequestIdGenerator > generator, std::string writeBasePath, std::string base58key, std::shared_ptr< GeniusAccount > account)
Factory function to create a MigrationManager and register all known steps.
void RegisterStep(std::shared_ptr< IMigrationStep > step)
Register a migration step.
outcome::result< void > Migrate()
Perform all registered migration steps in sequence.

Public Attributes

Name
std::string_view VERSION_INFO_KEY

Public Types Documentation

enum Error

Enumerator Value Description
BLOCKCHAIN_INIT_FAILED 1

Public Functions Documentation

function New

static std::shared_ptr< MigrationManager > New(
    std::shared_ptr< boost::asio::io_context > ioContext,
    std::shared_ptr< ipfs_pubsub::GossipPubSub > pubSub,
    std::shared_ptr< ipfs_lite::ipfs::graphsync::Network > graphsync,
    std::shared_ptr< libp2p::protocol::Scheduler > scheduler,
    std::shared_ptr< ipfs_lite::ipfs::graphsync::RequestIdGenerator > generator,
    std::string writeBasePath,
    std::string base58key,
    std::shared_ptr< GeniusAccount > account
)

Factory function to create a MigrationManager and register all known steps.

Parameters:

  • ioContext Shared io_context for both legacy and new DB.
  • pubSub Shared GossipPubSub instance.
  • graphsync Shared GraphSync network object.
  • scheduler Shared libp2p scheduler.
  • generator Shared GraphSync request ID generator.
  • writeBasePath Base path for writing DB files.
  • base58key Key to build legacy paths.
  • account GeniusAccount used during migration (if required).

Return: std::shared_ptr to the created instance.

function RegisterStep

void RegisterStep(
    std::shared_ptr< IMigrationStep > step
)

Register a migration step.

Parameters:

function Migrate

outcome::result< void > Migrate()

Perform all registered migration steps in sequence.

Return: Outcome of the migration process.

Public Attributes Documentation

variable VERSION_INFO_KEY

static std::string_view VERSION_INFO_KEY = "kSGNSCRDTVersion";

Updated on 2026-03-04 at 13:10:43 -0800