|
DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
#include <bookkeeper.hpp>
Public Member Functions | |
| Bookkeeper (const IPFormat &listening_ip, std::string bookkeeper_id, std::string file_log_path="", int refresh_rate=5, std::string connection_prefix="snbmodules", int timeout_send=10, int timeout_receive=100) | |
| Constructor with params. | |
| ~Bookkeeper () | |
| Destructor. | |
| bool | start () |
| Start the bookkeeper, Only used for stand alone application. | |
| void | do_work (std::atomic< bool > &running_flag) |
| Start the bookkeeper thread to receive notifications. | |
| bool | action_on_receive_notification (NotificationData notif) override |
| Action to do when receiving a notification. | |
| void | input_action (char input) |
| Do action depending on the input, Used for stand alone application TODO: remake. | |
| void | create_new_transfer (const std::string &protocol, const std::string &src, const std::set< std::string > &dests, const std::set< std::filesystem::path > &files, const nlohmann::json &protocol_options=nlohmann::json()) |
| void | display_information () |
| Display the information of the bookkeeper either on the normal log or on a specific file depending on the value of m_file_log_path. | |
| void | request_update_metadata (bool force=false) |
| Request the update of the metadata from every known clients to the bookkeeper. Only get from group transfers that are in a dynamic state (downloading, checking, uploading...) | |
| void | set_bookkeeper_id (std::string bookkeeper_id) |
| void | set_ip (const IPFormat &ip) |
| void | add_update_transfer (const std::string &client_id, const std::string &data) |
| void | add_update_grp_transfer (GroupMetadata grp_transfers) |
| std::string | get_bookkeeper_id () const |
| IPFormat | get_ip () const |
| std::map< std::string, GroupMetadata > & | get_grp_transfers () |
| const std::map< std::string, GroupMetadata > & | get_grp_transfers () const |
| std::map< std::string, std::vector< std::shared_ptr< TransferMetadata > > > & | get_transfers () |
| const std::map< std::string, std::vector< std::shared_ptr< TransferMetadata > > > & | get_transfers () const |
Public Member Functions inherited from dunedaq::snbmodules::NotificationInterface | |
| NotificationInterface (std::string connection_prefix="snbmodules", int timeout_send=10, int timeout_receive=100) | |
| NotificationInterface (std::vector< std::string > bk_conn, std::set< std::string > client_conn, const std::string &connection_prefix="snbmodules", int timeout_send=10, int timeout_receive=100) | |
| virtual | ~NotificationInterface ()=default |
| std::optional< NotificationData > | listen_for_notification (const std::string &id, const std::string &expected_from="", int timeout=-1, int tries=-1) |
| Listen for a notification. | |
| bool | send_notification (const notification_type::e_notification_type ¬if, const std::string &src, const std::string &dst, const std::string &id_conn, const std::string &data="", int tries=-1) |
| Send a notification during m_timeout_send ms. | |
| void | lookups_connections () |
| Get the list of every connections, must have the prefix first in the name of the connection and the name of the connection must be in the format: prefix.*bookkeeper.* or prefix.*client.*. | |
| const std::vector< std::string > & | get_bookkeepers_conn () const |
| Init the connection interface, Only used for standalone application. | |
| const std::set< std::string > & | get_clients_conn () const |
Private Member Functions | |
| void | request_connection_and_available_files (const std::string &client) |
| Send a notification to a clients id or connection to get available files. | |
| void | start_transfers (const std::string &transfer_id) |
| Start a new transfer. | |
| std::string | get_client_name_from_session_name (const std::string &session_name) const |
| Usefull convertion from session id to client id. | |
Private Attributes | |
| std::string | m_bookkeeper_id |
| Unique identifier for the bookkeeper. | |
| IPFormat | m_ip |
| IP address of the bookkeeper. | |
| std::map< std::string, GroupMetadata > | m_grp_transfers |
| map of group_id -> group_transfers | |
| std::map< std::string, std::set< std::string > > | m_clients_per_grp_transfer |
| map of grp_transfer_id -> clients_id | |
| std::map< std::string, std::vector< std::shared_ptr< TransferMetadata > > > | m_transfers |
| Map of files/current transfers, client_id -> set of transfers. | |
| std::string | m_file_log_path = "" |
| should the information pannel of transfers be displayed on the normal log or a specific file | |
| int | m_refresh_rate = 5 |
| Refresh rate of the information pannel of transfers in seconds. | |
Definition at line 31 of file bookkeeper.hpp.
|
inline |
Constructor with params.
Definition at line 36 of file bookkeeper.hpp.
|
inline |
|
overridevirtual |
Action to do when receiving a notification.
| notif | Notification received |
Implements dunedaq::snbmodules::NotificationInterface.
Definition at line 359 of file bookkeeper.cpp.
| void dunedaq::snbmodules::Bookkeeper::add_update_grp_transfer | ( | GroupMetadata | grp_transfers | ) |
Definition at line 551 of file bookkeeper.cpp.
| void dunedaq::snbmodules::Bookkeeper::add_update_transfer | ( | const std::string & | client_id, |
| const std::string & | data ) |
Definition at line 523 of file bookkeeper.cpp.
| void dunedaq::snbmodules::Bookkeeper::create_new_transfer | ( | const std::string & | protocol, |
| const std::string & | src, | ||
| const std::set< std::string > & | dests, | ||
| const std::set< std::filesystem::path > & | files, | ||
| const nlohmann::json & | protocol_options = nlohmann::json() ) |
Definition at line 19 of file bookkeeper.cpp.
| void dunedaq::snbmodules::Bookkeeper::display_information | ( | ) |
Display the information of the bookkeeper either on the normal log or on a specific file depending on the value of m_file_log_path.
Definition at line 408 of file bookkeeper.cpp.
| void dunedaq::snbmodules::Bookkeeper::do_work | ( | std::atomic< bool > & | running_flag | ) |
Start the bookkeeper thread to receive notifications.
| running_flag | stop Flag to stop the thread |
Definition at line 235 of file bookkeeper.cpp.
|
inline |
Definition at line 92 of file bookkeeper.hpp.
|
inlineprivate |
Usefull convertion from session id to client id.
| session_name | session id |
Definition at line 134 of file bookkeeper.hpp.
|
inline |
Definition at line 94 of file bookkeeper.hpp.
|
inline |
Definition at line 95 of file bookkeeper.hpp.
|
inline |
Definition at line 93 of file bookkeeper.hpp.
|
inline |
Definition at line 96 of file bookkeeper.hpp.
|
inline |
Definition at line 97 of file bookkeeper.hpp.
| void dunedaq::snbmodules::Bookkeeper::input_action | ( | char | input | ) |
Do action depending on the input, Used for stand alone application TODO: remake.
| input | Input from the user |
Definition at line 90 of file bookkeeper.cpp.
|
private |
Send a notification to a clients id or connection to get available files.
| client | client id or connection name |
Definition at line 317 of file bookkeeper.cpp.
| void dunedaq::snbmodules::Bookkeeper::request_update_metadata | ( | bool | force = false | ) |
Request the update of the metadata from every known clients to the bookkeeper. Only get from group transfers that are in a dynamic state (downloading, checking, uploading...)
| force | Force the update of the metadata even if the transfer is not in a dynamic state |
Definition at line 339 of file bookkeeper.cpp.
|
inline |
Definition at line 86 of file bookkeeper.hpp.
|
inline |
Definition at line 87 of file bookkeeper.hpp.
| bool dunedaq::snbmodules::Bookkeeper::start | ( | ) |
Start the bookkeeper, Only used for stand alone application.
Definition at line 273 of file bookkeeper.cpp.
|
private |
Start a new transfer.
Definition at line 217 of file bookkeeper.cpp.
|
private |
Unique identifier for the bookkeeper.
Definition at line 104 of file bookkeeper.hpp.
|
private |
map of grp_transfer_id -> clients_id
Definition at line 113 of file bookkeeper.hpp.
|
private |
should the information pannel of transfers be displayed on the normal log or a specific file
Definition at line 119 of file bookkeeper.hpp.
|
private |
map of group_id -> group_transfers
Definition at line 110 of file bookkeeper.hpp.
|
private |
IP address of the bookkeeper.
Definition at line 107 of file bookkeeper.hpp.
|
private |
Refresh rate of the information pannel of transfers in seconds.
Definition at line 122 of file bookkeeper.hpp.
|
private |
Map of files/current transfers, client_id -> set of transfers.
Definition at line 116 of file bookkeeper.hpp.