Arachne 1.0
Arachne - the perpetual stitcher of Wikidata entities.
Loading...
Searching...
No Matches
main.cpp File Reference
#include "arachne/contracts.hpp"
#include "arachne/coordinator.hpp"
#include "arachne/crypto.hpp"
#include "ariadne/candidates.hpp"
#include "ariadne/viewer.hpp"
#include "penelope/inbox.hpp"
#include "penelope/store.hpp"
#include "pheidippides/hardened_transport.hpp"
#include "pheidippides/transport.hpp"
#include <nlohmann/json.hpp>
#include <sys/types.h>
#include <unistd.h>
#include <algorithm>
#include <array>
#include <atomic>
#include <cctype>
#include <charconv>
#include <chrono>
#include <cstdint>
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <optional>
#include <ranges>
#include <set>
#include <span>
#include <sstream>
#include <stdexcept>
#include <string>
#include <string_view>
#include <system_error>
#include <utility>
#include <vector>
Include dependency graph for main.cpp:

Go to the source code of this file.

Classes

class  anonymous_namespace{main.cpp}::cli_error
class  anonymous_namespace{main.cpp}::options
struct  anonymous_namespace{main.cpp}::configuration
struct  anonymous_namespace{main.cpp}::written_run_manifest
struct  anonymous_namespace{main.cpp}::resolved_snapshot_export

Namespaces

namespace  anonymous_namespace{main.cpp}

Typedefs

using anonymous_namespace{main.cpp}::json = nlohmann::json
using anonymous_namespace{main.cpp}::ordered_json = nlohmann::ordered_json

Enumerations

enum class  anonymous_namespace{main.cpp}::cocoon_status
enum class  anonymous_namespace{main.cpp}::cocoon_status

Functions

fs::path anonymous_namespace{main.cpp}::repository_root ()
fs::path anonymous_namespace{main.cpp}::resolved_path (const fs::path &path, const fs::path &relative_root)
std::optional< fs::path > anonymous_namespace{main.cpp}::conventional_legacy_inbox ()
std::string anonymous_namespace{main.cpp}::read_bytes (const fs::path &path, const std::uintmax_t maximum_bytes, const std::string_view description)
json anonymous_namespace{main.cpp}::read_json (const fs::path &path, const std::uintmax_t maximum_bytes, const std::string_view description)
std::string anonymous_namespace{main.cpp}::utc_now ()
void anonymous_namespace{main.cpp}::emit (const json &document)
std::string anonymous_namespace{main.cpp}::validation_details (const arachnespace::contracts::validation_result &result, const std::string_view description)
std::uint64_t anonymous_namespace{main.cpp}::unsigned_value (const json &object, const std::string_view key, const std::uint64_t default_value, const bool positive)
std::size_t anonymous_namespace{main.cpp}::size_value (const json &object, const std::string_view key, const std::size_t fallback)
const jsonanonymous_namespace{main.cpp}::required_object (const json &parent, const std::string_view key)
configuration anonymous_namespace{main.cpp}::load_configuration (const fs::path &input_path)
std::string anonymous_namespace{main.cpp}::policy_configuration_hash (const configuration &config, const std::string_view section)
fs::path anonymous_namespace{main.cpp}::command_path (const std::string &value)
bool anonymous_namespace{main.cpp}::path_is_in_protected_legacy (const fs::path &path, const configuration &config)
void anonymous_namespace{main.cpp}::atomic_write (const fs::path &destination, const std::string_view bytes, const bool replace)
void anonymous_namespace{main.cpp}::write_immutable_exact (const fs::path &destination, const std::string_view bytes, const std::string_view description)
ordered_json anonymous_namespace{main.cpp}::envelope_json (const arachne::coordination::envelope_record &envelope)
ordered_json anonymous_namespace{main.cpp}::snapshot_json (const arachne::penelope::snapshot_result &snapshot)
written_run_manifest anonymous_namespace{main.cpp}::write_graph_run_manifest (const configuration &config, const std::string_view domain_directory, const std::string_view graph_domain, const std::string_view run_id, ordered_json configuration_hashes, ordered_json inputs, const arachne::penelope::snapshot_result &snapshot)
ordered_json anonymous_namespace{main.cpp}::issue_json (std::string path, std::string message)
bool anonymous_namespace{main.cpp}::path_has_symlink (const fs::path &root, const fs::path &candidate)
fs::path anonymous_namespace{main.cpp}::resolve_plan_artifact (const configuration &config, const fs::path &control_path, const std::string_view storage_ref)
resolved_snapshot_export anonymous_namespace{main.cpp}::resolve_snapshot_export (const configuration &config, const fs::path &control_path, const arachnespace::contracts::contract_name expected_contract, const std::string_view expected_kind)
void anonymous_namespace{main.cpp}::verify_external_source_snapshot (const configuration &config, const json &external_graph)
void anonymous_namespace{main.cpp}::verify_product_coverage (const json &external_graph, const json &product_tables)
json anonymous_namespace{main.cpp}::parse_embedded_json (const json &row, const std::string_view key, json fallback)
json anonymous_namespace{main.cpp}::candidate_tables_for_viewer (const json &tables)
json anonymous_namespace{main.cpp}::materialize_jsonl_export (const fs::path &path, const bool candidate)
bool anonymous_namespace{main.cpp}::valid_logical_date (const std::string_view value)
arachne::ariadne::candidate_configuration anonymous_namespace{main.cpp}::candidate_configuration_from (const configuration &config)
int anonymous_namespace{main.cpp}::command_contract_validate (const options &arguments)
int anonymous_namespace{main.cpp}::command_intake (const options &arguments)
int anonymous_namespace{main.cpp}::command_cocoon_transition (const options &arguments)
ordered_json anonymous_namespace{main.cpp}::actor_inbox_issues (const arachne::coordination::operational_ledger &ledger, const fs::path &inbox)
int anonymous_namespace{main.cpp}::command_inbox_baseline (const options &arguments)
int anonymous_namespace{main.cpp}::command_inbox_verify (const options &arguments)
int anonymous_namespace{main.cpp}::command_product_inbox (const bool apply)
int anonymous_namespace{main.cpp}::command_product_rebuild_merge_hints ()
int anonymous_namespace{main.cpp}::command_candidate_rebuild (const options &arguments)
int anonymous_namespace{main.cpp}::command_fetch (const options &arguments)
std::string anonymous_namespace{main.cpp}::form_encode (const std::string_view value)
bool anonymous_namespace{main.cpp}::wikidata_entity_id (const std::string_view value)
std::string anonymous_namespace{main.cpp}::join_strings (const std::span< const std::string > values, const std::string_view separator)
ordered_json anonymous_namespace{main.cpp}::wikidata_point_fetch_request (const configuration &config, const json &plan, const json &planned, const std::span< const std::string > entities, const std::string &request_id)
ordered_json anonymous_namespace{main.cpp}::wikidata_bulk_fetch_request (const json &plan, const json &planned, std::string request_id, std::string locator)
int anonymous_namespace{main.cpp}::command_fetch_plan (const options &arguments)
int anonymous_namespace{main.cpp}::command_candidate_plan (const options &arguments)
int anonymous_namespace{main.cpp}::command_viewer_build (const options &arguments)
ordered_json anonymous_namespace{main.cpp}::capabilities ()
int anonymous_namespace{main.cpp}::dispatch (const std::vector< std::string > &arguments)
int main (const int argc, char **argv)

Variables

constexpr std::uintmax_t anonymous_namespace{main.cpp}::maximum_config_bytes = 4U * 1024U * 1024U
constexpr std::uintmax_t anonymous_namespace{main.cpp}::maximum_control_bytes = 64U * 1024U * 1024U
constexpr std::uintmax_t anonymous_namespace{main.cpp}::maximum_export_bytes = 1024ULL * 1024ULL * 1024ULL
std::atomic< std::uint64_t > anonymous_namespace{main.cpp}::temporary_sequence { 0 }

Function Documentation

◆ main()

int main ( const int argc,
char ** argv )

Definition at line 2205 of file main.cpp.

2205 {
2206 std::vector<std::string> arguments;
2207 arguments.reserve(static_cast<std::size_t>(argc));
2208 for (int index = 0; index < argc; ++index) {
2209 arguments.emplace_back(argv[index]);
2210 }
2211 try {
2212 return dispatch(arguments);
2213 } catch (const cli_error& error) {
2214 if (arguments.size() >= 2U && arguments[1] == "intake") {
2215 emit(ordered_json { { "status", "fail" } });
2216 }
2217 std::cerr << "arachne: " << error.what() << '\n';
2218 return error.exit_code();
2219 } catch (const std::exception& error) {
2220 if (arguments.size() >= 2U && arguments[1] == "intake") {
2221 emit(ordered_json { { "status", "fail" } });
2222 }
2223 std::cerr << "arachne: " << error.what() << '\n';
2224 return 2;
2225 }
2226}
cli_error(std::string message, const int exit_code=2)
Definition main.cpp:57
void emit(const json &document)
Definition main.cpp:167
nlohmann::ordered_json ordered_json
Definition main.cpp:46
int dispatch(const std::vector< std::string > &arguments)
Definition main.cpp:2116

References anonymous_namespace{main.cpp}::cli_error::exit_code().

Here is the call graph for this function: