Decentralised Art Server
High-performance C++ backend that exposes HTML interface and a secure REST API for managing Performative Transactions entities
 
Loading...
Searching...
No Matches
loader.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <fstream>
5
6#include "native.h"
7#include <asio.hpp>
8#include <spdlog/spdlog.h>
9
10#include "pt.hpp"
11#include "storage.hpp"
12#include "parser.hpp"
13#include "evm.hpp"
14#include "chain.hpp"
15
16namespace dcn::loader
17{
19 {
20 std::size_t connectors = 1000;
21 std::size_t transformations = 5000;
22 std::size_t conditions = 5000;
23 };
24
25 bool ensurePTBuildVersion(const std::filesystem::path & storage_path);
26
27 asio::awaitable<std::expected<chain::Address, pt::PTDeployError>> deployConnector(
28 evm::EVM & evm,
29 storage::Registry & registry,
30 ConnectorRecord connector,
31 const std::filesystem::path & storage_path,
32 bool register_in_registry = true,
33 bool persist_json = true);
34 asio::awaitable<std::expected<chain::Address, pt::PTDeployError>> deployTransformation(
35 evm::EVM & evm,
36 storage::Registry & registry,
37 TransformationRecord transformation,
38 const std::filesystem::path & storage_path,
39 bool register_in_registry = true,
40 bool persist_json = true);
41 asio::awaitable<std::expected<chain::Address, pt::PTDeployError>> deployCondition(
42 evm::EVM & evm,
43 storage::Registry & registry,
44 ConditionRecord condition,
45 const std::filesystem::path & storage_path,
46 bool register_in_registry = true,
47 bool persist_json = true);
48
49 asio::awaitable<bool> importJsonStorageToDatabase(
50 evm::EVM & evm,
51 storage::Registry & registry,
52 const std::filesystem::path & storage_path,
54
55 asio::awaitable<bool> ensureTransformationDeployed(
56 evm::EVM & evm,
57 storage::Registry & registry,
58 const std::string & name,
59 const std::filesystem::path & storage_path);
60 asio::awaitable<bool> ensureConditionDeployed(
61 evm::EVM & evm,
62 storage::Registry & registry,
63 const std::string & name,
64 const std::filesystem::path & storage_path);
65 asio::awaitable<bool> ensureConnectorDeployed(
66 evm::EVM & evm,
67 storage::Registry & registry,
68 const std::string & name,
69 const std::filesystem::path & storage_path);
70
71
72 asio::awaitable<bool> loadStoredConnectors(
73 evm::EVM & evm,
74 storage::Registry & registry,
75 const std::filesystem::path & storage_path,
76 std::size_t registry_batch_size = 1000);
77 asio::awaitable<bool> loadStoredConditions(
78 evm::EVM & evm,
79 storage::Registry & registry,
80 const std::filesystem::path & storage_path,
81 std::size_t registry_batch_size = 5000);
82 asio::awaitable<bool> loadStoredTransformations(
83 evm::EVM & evm,
84 storage::Registry & registry,
85 const std::filesystem::path & storage_path,
86 std::size_t registry_batch_size = 5000);
87}
Definition evm.hpp:43
Definition registry.hpp:40
std::string name
Definition ingestion.cpp:29
LoaderBatchConfig batch_config
Definition loader.cpp:40
Definition loader.hpp:17
asio::awaitable< bool > ensureTransformationDeployed(evm::EVM &evm, storage::Registry &registry, const std::string &name, const std::filesystem::path &storage_path)
Definition loader.cpp:1188
asio::awaitable< bool > ensureConnectorDeployed(evm::EVM &evm, storage::Registry &registry, const std::string &name, const std::filesystem::path &storage_path)
Definition loader.cpp:1285
bool ensurePTBuildVersion(const std::filesystem::path &storage_path)
Definition loader.cpp:404
asio::awaitable< bool > ensureConditionDeployed(evm::EVM &evm, storage::Registry &registry, const std::string &name, const std::filesystem::path &storage_path)
Definition loader.cpp:1237
asio::awaitable< std::expected< chain::Address, pt::PTDeployError > > deployTransformation(evm::EVM &evm, storage::Registry &registry, TransformationRecord transformation, const std::filesystem::path &storage_path, bool register_in_registry=true, bool persist_json=true)
Definition loader.cpp:898
asio::awaitable< bool > loadStoredConditions(evm::EVM &evm, storage::Registry &registry, const std::filesystem::path &storage_path, std::size_t registry_batch_size=5000)
Definition loader.cpp:1118
asio::awaitable< std::expected< chain::Address, pt::PTDeployError > > deployConnector(evm::EVM &evm, storage::Registry &registry, ConnectorRecord connector, const std::filesystem::path &storage_path, bool register_in_registry=true, bool persist_json=true)
Definition loader.cpp:877
asio::awaitable< bool > loadStoredTransformations(evm::EVM &evm, storage::Registry &registry, const std::filesystem::path &storage_path, std::size_t registry_batch_size=5000)
Definition loader.cpp:1048
asio::awaitable< bool > loadStoredConnectors(evm::EVM &evm, storage::Registry &registry, const std::filesystem::path &storage_path, std::size_t registry_batch_size=1000)
Definition loader.cpp:938
asio::awaitable< std::expected< chain::Address, pt::PTDeployError > > deployCondition(evm::EVM &evm, storage::Registry &registry, ConditionRecord condition, const std::filesystem::path &storage_path, bool register_in_registry=true, bool persist_json=true)
Definition loader.cpp:918
asio::awaitable< bool > importJsonStorageToDatabase(evm::EVM &evm, storage::Registry &registry, const std::filesystem::path &storage_path, LoaderBatchConfig batch_config={})
Definition loader.cpp:1297
Definition loader.hpp:19
std::size_t transformations
Definition loader.hpp:21
std::size_t conditions
Definition loader.hpp:22
std::size_t connectors
Definition loader.hpp:20