Skip to content

sgns::Migration0_2_0To1_0_0

Migration step for version 0.2.0 to 1.0.0. More...

#include <Migration0_2_0To1_0_0.hpp>

Inherits from sgns::IMigrationStep

Public Functions

Name
Migration0_2_0To1_0_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::protocol::Scheduler > scheduler, std::shared_ptr< ipfs_lite::ipfs::graphsync::RequestIdGenerator > generator, std::string writeBasePath, std::string base58key)
Construct the step with all resources needed to open legacy DBs.
virtual std::string FromVersion() const override
Get the source version for this step.
virtual std::string ToVersion() const override
Get the target version for this step.
virtual outcome::result< void > Init() override
Initializes internal variables after constructor.
virtual outcome::result< bool > IsRequired() const override
Check if this migration should run.
virtual outcome::result< void > Apply() override
Apply the migration: initialize legacy DBs and migrate data.
virtual outcome::result< void > ShutDown() override
Shuts down internal variables.

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

Detailed Description

class sgns::Migration0_2_0To1_0_0;

Migration step for version 0.2.0 to 1.0.0.

Copies transactions and proofs from legacy DB (“out” and “in”) into the new CRDT store.

Public Functions Documentation

function Migration0_2_0To1_0_0

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

Construct the step with all resources needed to open legacy DBs.

Parameters:

  • ioContext Shared io_context for legacy DB access.
  • pubSub Shared GossipPubSub instance.
  • graphsync Shared GraphSync network object.
  • scheduler Shared libp2p scheduler.
  • generator Shared RequestIdGenerator for GraphSync.
  • writeBasePath Base path for writing legacy DB files.
  • base58key Base58-encoded peer key to form legacy paths.

function FromVersion

virtual std::string FromVersion() const override

Get the source version for this step.

Return: std::string "0.2.0"

Reimplements: sgns::IMigrationStep::FromVersion

function ToVersion

virtual std::string ToVersion() const override

Get the target version for this step.

Return: std::string "1.0.0"

Reimplements: sgns::IMigrationStep::ToVersion

function Init

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

Initializes internal variables after constructor.

Return: Outcome of the operation

Reimplements: sgns::IMigrationStep::Init

function IsRequired

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

Check if this migration should run.

Return: outcome::result true if migration should run; false to skip. On error, returns failure.

Reimplements: sgns::IMigrationStep::IsRequired

function Apply

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

Apply the migration: initialize legacy DBs and migrate data.

Return: outcome::result success on completion; failure on error.

Reimplements: sgns::IMigrationStep::Apply

function ShutDown

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

Shuts down internal variables.

Return: Outcome of the operation

Reimplements: sgns::IMigrationStep::ShutDown


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