LCOV - code coverage report
Current view: top level - src/interfaces - init.h (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 0 6 0.0 %
Date: 2023-10-05 12:38:51 Functions: 0 8 0.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // Copyright (c) 2021-2022 The Bitcoin Core developers
       2                 :            : // Distributed under the MIT software license, see the accompanying
       3                 :            : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4                 :            : 
       5                 :            : #ifndef BITCOIN_INTERFACES_INIT_H
       6                 :            : #define BITCOIN_INTERFACES_INIT_H
       7                 :            : 
       8                 :            : #include <interfaces/chain.h>
       9                 :            : #include <interfaces/echo.h>
      10                 :            : #include <interfaces/node.h>
      11                 :            : #include <interfaces/wallet.h>
      12                 :            : 
      13                 :            : #include <memory>
      14                 :            : 
      15                 :            : namespace node {
      16                 :            : struct NodeContext;
      17                 :            : } // namespace node
      18                 :            : 
      19                 :            : namespace interfaces {
      20                 :            : class Ipc;
      21                 :            : 
      22                 :            : //! Initial interface created when a process is first started, and used to give
      23                 :            : //! and get access to other interfaces (Node, Chain, Wallet, etc).
      24                 :            : //!
      25                 :            : //! There is a different Init interface implementation for each process
      26                 :            : //! (bitcoin-gui, bitcoin-node, bitcoin-wallet, bitcoind, bitcoin-qt) and each
      27                 :            : //! implementation can implement the make methods for interfaces it supports.
      28                 :            : //! The default make methods all return null.
      29                 :            : class Init
      30                 :            : {
      31                 :            : public:
      32                 :          0 :     virtual ~Init() = default;
      33                 :          0 :     virtual std::unique_ptr<Node> makeNode() { return nullptr; }
      34                 :          0 :     virtual std::unique_ptr<Chain> makeChain() { return nullptr; }
      35                 :          0 :     virtual std::unique_ptr<WalletLoader> makeWalletLoader(Chain& chain) { return nullptr; }
      36                 :          0 :     virtual std::unique_ptr<Echo> makeEcho() { return nullptr; }
      37                 :          0 :     virtual Ipc* ipc() { return nullptr; }
      38                 :            : };
      39                 :            : 
      40                 :            : //! Return implementation of Init interface for the node process. If the argv
      41                 :            : //! indicates that this is a child process spawned to handle requests from a
      42                 :            : //! parent process, this blocks and handles requests, then returns null and a
      43                 :            : //! status code to exit with. If this returns non-null, the caller can start up
      44                 :            : //! normally and use the Init object to spawn and connect to other processes
      45                 :            : //! while it is running.
      46                 :            : std::unique_ptr<Init> MakeNodeInit(node::NodeContext& node, int argc, char* argv[], int& exit_status);
      47                 :            : 
      48                 :            : //! Return implementation of Init interface for the wallet process.
      49                 :            : std::unique_ptr<Init> MakeWalletInit(int argc, char* argv[], int& exit_status);
      50                 :            : 
      51                 :            : //! Return implementation of Init interface for the gui process.
      52                 :            : std::unique_ptr<Init> MakeGuiInit(int argc, char* argv[]);
      53                 :            : } // namespace interfaces
      54                 :            : 
      55                 :            : #endif // BITCOIN_INTERFACES_INIT_H

Generated by: LCOV version 1.14