app/integration/BufferStorageFactory.hpp¶
Classes¶
| Name | |
|---|---|
| class | BufferStorageFactory |
Detailed Description¶
Date: 2024-02-22 Henrique A. Klein ([email protected])
Source code¶
#ifndef _BUFFER_STORAGE_HPP_
#define _BUFFER_STORAGE_HPP_
#include "storage/rocksdb/rocksdb.hpp"
class BufferStorageFactory
{
public:
static std::shared_ptr<sgns::storage::BufferStorage> create( const std::string &type, const std::string &path )
{
if ( type == "rocksdb" )
{
auto options = sgns::storage::rocksdb::Options{};
options.create_if_missing = true;
auto result = sgns::storage::rocksdb::create( path, options );
if ( result )
{
return result.value();
}
else
{
throw std::runtime_error( "rocksdb not created" );
}
}
else
{
//TrieStorageBackend
}
throw std::runtime_error( "Invalid BufferStorage type" );
}
};
#endif
Updated on 2026-03-04 at 13:10:44 -0800