Skip to content

sgns::Migration3_5_0To3_6_0

Executes the storage migration from database version 3.5.1 to 3.6.0.

#include <Migration3_5_0To3_6_0.hpp>

Inherits from sgns::IMigrationStep, std::enable_shared_from_this< Migration3_5_0To3_6_0 >

Public Functions

Name
Migration3_5_0To3_6_0(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::basic::Scheduler > scheduler, std::shared_ptr< ipfs_lite::ipfs::graphsync::RequestIdGenerator > generator, std::string writeBasePath, std::string base58key)
Constructs the migration step with the services required to read and write both database versions.
virtual std::string FromVersion() const override
Returns the source schema version handled by this step.
virtual std::string ToVersion() const override
Returns the target schema version produced by this step.
virtual outcome::result< void > Init() override
Initializes migration resources before the step is applied.
virtual outcome::result< void > Apply() override
Applies the migration logic and persists the upgraded data.
virtual outcome::result< void > ShutDown() override
Releases any temporary migration resources.
virtual outcome::result< bool > IsRequired() const override
Determines whether the migration needs to run for the current node state.

Additional inherited members

Public Functions inherited from sgns::IMigrationStep

Name
virtual ~IMigrationStep() =default
std::tuple< int, int, int > ParseVersion(const std::string & version) const
bool IsVersionLessThan(const std::string & lhs, const std::string & rhs) const

Public Functions Documentation

function Migration3_5_0To3_6_0

Migration3_5_0To3_6_0(
    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::basic::Scheduler > scheduler,
    std::shared_ptr< ipfs_lite::ipfs::graphsync::RequestIdGenerator > generator,
    std::string writeBasePath,
    std::string base58key
)

Constructs the migration step with the services required to read and write both database versions.

Parameters:

  • ioContext Shared IO context used by GlobalDB services.
  • pubSub PubSub service used by the legacy and target GlobalDB instances.
  • graphsync GraphSync network used for CRDT data exchange.
  • scheduler libp2p scheduler used by GraphSync.
  • generator Request ID generator used by GraphSync.
  • writeBasePath Base path containing versioned node database directories.
  • base58key Base58 node key suffix used to locate the legacy and target databases.

function FromVersion

virtual std::string FromVersion() const override

Returns the source schema version handled by this step.

Return: Source version string, "3.5.1".

Reimplements: sgns::IMigrationStep::FromVersion

function ToVersion

virtual std::string ToVersion() const override

Returns the target schema version produced by this step.

Return: Target version string, "3.6.0".

Reimplements: sgns::IMigrationStep::ToVersion

function Init

virtual outcome::result< void > Init() override

Initializes migration resources before the step is applied.

Return: Success after opening the legacy database and, when present, the target database.

Reimplements: sgns::IMigrationStep::Init

function Apply

virtual outcome::result< void > Apply() override

Applies the migration logic and persists the upgraded data.

Return: Success when the migration is complete or no legacy database exists; failure on database, transaction fetch, serialization, or commit errors.

Reimplements: sgns::IMigrationStep::Apply

Migrates validator registry CIDs, blockchain CIDs, transaction records for all monitored networks, transaction sync topics, and the target database version marker.

function ShutDown

virtual outcome::result< void > ShutDown() override

Releases any temporary migration resources.

Return: Success after releasing legacy and target database references.

Reimplements: sgns::IMigrationStep::ShutDown

function IsRequired

virtual outcome::result< bool > IsRequired() const override

Determines whether the migration needs to run for the current node state.

Return: True when the target database is older than 3.6.0 or has no version marker; false otherwise.

Reimplements: sgns::IMigrationStep::IsRequired


Updated on 2026-06-05 at 17:22:18 -0700