Skip to content

app/integration/EpochStorageFactory.hpp

More...

Classes

Name
class EpochStorageFactory

Detailed Description

Date: 2024-02-29 Henrique A. Klein ([email protected])

Source code

#ifndef _EPOCH_STORAGE_HPP_
#define _EPOCH_STORAGE_HPP_
#include "verification/production/impl/epoch_storage_impl.hpp"
#include "singleton/CComponentFactory.hpp"
#include "storage/buffer_map_types.hpp"

class EpochStorageFactory
{
public:
    static std::shared_ptr<sgns::verification::EpochStorage> create()
    {
        auto component_factory = SINGLETONINSTANCE( CComponentFactory );

        auto result = component_factory->GetComponent( "BufferStorage", boost::make_optional(std::string("rocksdb")));

        if ( !result )
        {
            throw std::runtime_error( "Initialize BufferStorage first" );
        }
        auto buffer_storage = std::dynamic_pointer_cast<sgns::storage::BufferStorage>( result.value() );

        return std::make_shared<sgns::verification::EpochStorageImpl>( buffer_storage );
    }
};

#endif

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