node/ipfs_lite_store.hpp¶
Header file for storing block into ipfs-lite. More...
Namespaces¶
| Name |
|---|
| sgns |
| sgns::filesystem |
Classes¶
| Name | |
|---|---|
| struct | IPFS_val |
| class | sgns::ipfs_lite_store |
Types¶
| Name | |
|---|---|
| typedef struct IPFS_val | IPFS_val |
| typedef unsigned int | ipfs_dbi A handle for an individual database in the DB environment. |
| using db_val< IPFS_val > | ipfs_val |
Detailed Description¶
Header file for storing block into ipfs-lite.
Date: 07/06/2020
====================================================================================
ruymaster¶
Types Documentation¶
typedef IPFS_val¶
typedef ipfs_dbi¶
A handle for an individual database in the DB environment.
using ipfs_val¶
Source code¶
#ifndef SUPERGENIUS_IPFS_LITE_STORE_HPP
#define SUPERGENIUS_IPFS_LITE_STORE_HPP
#include <secure/blockstore_partial.hpp>
#include <boost/filesystem.hpp>
#include <ipfs_lite/ipfs/impl/datastore_leveldb.hpp>
typedef struct IPFS_val {
size_t mv_size;
void *mv_data;
} IPFS_val;
namespace sgns
{
namespace filesystem
{
class path;
}
}
namespace sgns
{
namespace filesystem
{
class path;
}
}
namespace sgns
{
typedef unsigned int ipfs_dbi;
using ipfs_val = db_val<IPFS_val>;
using sgns::ipfs_lite::ipfs::IpfsDatastore;
using sgns::ipfs_lite::ipfs::LeveldbDatastore;
class ipfs_lite_store : public block_store_partial<IPFS_val, ipfs_lite_store>
{
private:
std::shared_ptr<IpfsDatastore> datastore;
public:
ipfs_lite_store();
// ipfs_lite_store (sgns::logger_mt &, boost::filesystem::path const &, sgns::txn_tracking_config const & txn_tracking_config_a = sgns::txn_tracking_config{}, std::chrono::milliseconds block_processor_batch_max_time_a = std::chrono::milliseconds (5000), sgns::lmdb_config const & lmdb_config_a = sgns::lmdb_config{}, size_t batch_size = 512, bool backup_before_upgrade = false);
bool exists (sgns::transaction const & transaction_a, tables table_a, ipfs_val const & key_a) const;
int get (sgns::transaction const& transaction_a, tables table_a, ipfs_val const &key, ipfs_val const & value_a) const;
int put (sgns::write_transaction const & transaction_a, tables table_a, ipfs_val const & key_a, const ipfs_val & value_a) const;
int del (sgns::write_transaction const & transaction_a, tables table_a, ipfs_val const & key_a) const;
int drop (sgns::write_transaction const & transaction_a, tables table_a) override;
sgns::write_transaction tx_begin_write (std::vector<sgns::tables> const & tables_requiring_lock = {}, std::vector<sgns::tables> const & tables_no_lock = {}) override;
sgns::read_transaction tx_begin_read () override;
std::string vendor_get () const override;
bool block_info_get (sgns::transaction const &, sgns::block_hash const &, sgns::block_info &) const override;
void version_put (sgns::write_transaction const &, int) override;
void serialize_mdb_tracker (boost::property_tree::ptree &, std::chrono::milliseconds, std::chrono::milliseconds) override;
// These are only use in the upgrade process.
std::shared_ptr<sgns::block> block_get_v14 (sgns::transaction const & transaction_a, sgns::block_hash const & hash_a, sgns::block_sideband_v14 * sideband_a = nullptr, bool * is_state_v1 = nullptr) const override;
bool copy_db (boost::filesystem::path const & destination_file) override;
void rebuild_db (sgns::write_transaction const & transaction_a) override;
bool init_error () const override;
size_t count (sgns::transaction const & transaction_a, tables table_a) const override;
bool not_found (int status) const override;
bool success (int status) const override;
int status_code_not_found () const override;
ipfs_dbi frontiers{ 0 };
ipfs_dbi accounts_v0{ 0 };
ipfs_dbi accounts_v1{ 0 };
ipfs_dbi accounts{ 0 };
ipfs_dbi send_blocks{ 0 };
ipfs_dbi receive_blocks{ 0 };
ipfs_dbi open_blocks{ 0 };
ipfs_dbi change_blocks{ 0 };
ipfs_dbi state_blocks_v0{ 0 };
ipfs_dbi state_blocks_v1{ 0 };
ipfs_dbi state_blocks{ 0 };
ipfs_dbi pending_v0{ 0 };
ipfs_dbi pending_v1{ 0 };
ipfs_dbi pending{ 0 };
ipfs_dbi blocks_info{ 0 };
ipfs_dbi representation{ 0 };
ipfs_dbi unchecked{ 0 };
ipfs_dbi vote{ 0 };
ipfs_dbi online_weight{ 0 };
ipfs_dbi meta{ 0 };
/*
* Endpoints for peers
* sgns::endpoint_key -> no_value
*/
ipfs_dbi peers{ 0 };
/*
* Confirmation height of an account, and the hash for the block at that height
* sgns::account -> uint64_t, sgns::block_hash
*/
ipfs_dbi confirmation_height{ 0 };
};
#ifndef __DOXYGEN__
template <>
void * ipfs_val::data () const;
template <>
size_t ipfs_val::size () const;
template <>
ipfs_val::db_val (size_t size_a, void * data_a);
template <>
void ipfs_val::convert_buffer_to_value ();
extern template class block_store_partial<IPFS_val, ipfs_lite_store>;
#endif
}
#endif
Updated on 2026-03-04 at 13:10:44 -0800