|
DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
TransferSession class contained in a client, is a wrapper for a transfer. extend notification interface because the session can communicate with bookkeeper via client initialized connection. More...
#include <transfer_session.hpp>
Public Member Functions | |
| bool | update_metadatas_to_bookkeeper () |
| bool | update_metadata_to_bookkeeper (TransferMetadata &f_meta) |
| bool | is_downloader () |
| Usefull to check if the session is a downloader. | |
| bool | is_uploader () |
| Usefull to check if the session is a uploader. | |
| bool | operator== (TransferSession const &other) const |
| equal operator, used to compare sessions in a set (client) | |
| bool | operator< (TransferSession const &other) const |
| Operator <, used to compare sessions in a set (client) | |
| TransferSession (TransferSession &&)=default | |
| TransferSession & | operator= (TransferSession &&)=default |
| TransferSession (GroupMetadata transfer_options, e_session_type type, std::string id, const IPFormat &ip, std::filesystem::path work_dir, std::vector< std::string > bk_conn=std::vector< std::string >(), std::set< std::string > client_conn=std::set< std::string >()) | |
| Constructor. | |
| virtual | ~TransferSession () |
| Destructor Kill all threads created by the session (TODO : useless ?) | |
| const GroupMetadata & | get_transfer_options () const |
| GroupMetadata & | get_transfer_options () |
| std::filesystem::path | get_work_dir () const |
| const std::set< std::string > & | get_target_clients () const |
| IPFormat | get_ip () const |
| std::string | get_session_id () const |
| std::string | to_string () const |
| void | set_target_clients (std::set< std::string > clients) |
| void | add_file (std::shared_ptr< TransferMetadata > fmeta) |
| bool | pause_file (TransferMetadata &f_meta, bool is_multiple=false) |
| bool | resume_file (TransferMetadata &f_meta, bool is_multiple=false) |
| bool | hash_file (TransferMetadata &f_meta, bool is_multiple=false) |
| bool | cancel_file (TransferMetadata &f_meta, bool is_multiple=false) |
| bool | pause_all () |
| bool | resume_all () |
| bool | cancel_all () |
| bool | start_file (TransferMetadata &f_meta) |
| Start the session by downloading or uploading files depending on the type of session TODO : separate thread ? | |
| bool | start_all () |
| bool | download_all (const std::filesystem::path &dest) |
| bool | download_file (TransferMetadata &f_meta, std::filesystem::path dest, bool is_multiple=false) |
| bool | upload_all () |
| bool | upload_file (TransferMetadata &f_meta, bool is_multiple=false) |
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 |
Static Public Member Functions | |
| static std::string | session_type_to_string (e_session_type e) |
Private Member Functions | |
| bool | action_on_receive_notification (NotificationData notif) override |
| handle actions to be taken when a notification is received. The notification is passed as a parameter by the client because only 1 connection is opened (not possible to open connection after configuration) | |
| bool | send_notification_to_targets (notification_type::e_notification_type type, const std::string &data="") |
| Send a notification to every targets of the session, generally for the uploader. | |
Private Attributes | |
| e_session_type | m_type |
| Type of session, uploader or downloader. Used to block access to some functions. | |
| std::string | m_session_id |
| Unique identifier of the session, used to identify the session in the client and to target notification. | |
| IPFormat | m_ip |
| Ip of the client TODO : useless ? the session cannot have a unique connection. | |
| std::unique_ptr< TransferInterfaceAbstract > | m_transfer_interface |
| Abstract interface can reference to any protocol used to transfer data. | |
| GroupMetadata | m_transfer_options |
| A session must contain a transfer matadata. The session is basically a transfer wrapper. | |
| std::filesystem::path | m_work_dir |
| List of threads created by the session TODO : useless ? should be handle in client. | |
| std::set< std::string > | m_target_clients |
| clients that dowload the files, only used by uploader | |
TransferSession class contained in a client, is a wrapper for a transfer. extend notification interface because the session can communicate with bookkeeper via client initialized connection.
Definition at line 45 of file transfer_session.hpp.
|
default |
| dunedaq::snbmodules::TransferSession::TransferSession | ( | GroupMetadata | transfer_options, |
| e_session_type | type, | ||
| std::string | id, | ||
| const IPFormat & | ip, | ||
| std::filesystem::path | work_dir, | ||
| std::vector< std::string > | bk_conn = std::vector<std::string>(), | ||
| std::set< std::string > | client_conn = std::set<std::string>() ) |
Constructor.
| transfer_options | group metadata |
| type | type of session |
| id | unique identifier of the session |
| ip | ip of the client (TODO : useless ?) |
Definition at line 21 of file transfer_session.cpp.
|
virtual |
Destructor Kill all threads created by the session (TODO : useless ?)
Definition at line 98 of file transfer_session.cpp.
|
overrideprivatevirtual |
handle actions to be taken when a notification is received. The notification is passed as a parameter by the client because only 1 connection is opened (not possible to open connection after configuration)
| notif | contain everything we need to know about the notification |
Implements dunedaq::snbmodules::NotificationInterface.
Definition at line 121 of file transfer_session.cpp.
|
inline |
Definition at line 114 of file transfer_session.hpp.
| bool dunedaq::snbmodules::TransferSession::cancel_all | ( | ) |
Definition at line 422 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::cancel_file | ( | TransferMetadata & | f_meta, |
| bool | is_multiple = false ) |
Definition at line 287 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::download_all | ( | const std::filesystem::path & | dest | ) |
Definition at line 436 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::download_file | ( | TransferMetadata & | f_meta, |
| std::filesystem::path | dest, | ||
| bool | is_multiple = false ) |
Definition at line 344 of file transfer_session.cpp.
|
inline |
Definition at line 100 of file transfer_session.hpp.
|
inline |
Definition at line 101 of file transfer_session.hpp.
|
inline |
Definition at line 99 of file transfer_session.hpp.
|
inline |
Definition at line 97 of file transfer_session.hpp.
|
inline |
Definition at line 96 of file transfer_session.hpp.
|
inline |
Definition at line 98 of file transfer_session.hpp.
| bool dunedaq::snbmodules::TransferSession::hash_file | ( | TransferMetadata & | f_meta, |
| bool | is_multiple = false ) |
Definition at line 261 of file transfer_session.cpp.
|
inline |
Usefull to check if the session is a downloader.
Definition at line 59 of file transfer_session.hpp.
|
inline |
Usefull to check if the session is a uploader.
Definition at line 63 of file transfer_session.hpp.
|
inline |
Operator <, used to compare sessions in a set (client)
| other | other session |
Definition at line 73 of file transfer_session.hpp.
|
default |
|
inline |
equal operator, used to compare sessions in a set (client)
| other | other session |
Definition at line 68 of file transfer_session.hpp.
| bool dunedaq::snbmodules::TransferSession::pause_all | ( | ) |
Definition at line 388 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::pause_file | ( | TransferMetadata & | f_meta, |
| bool | is_multiple = false ) |
Definition at line 202 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::resume_all | ( | ) |
Definition at line 406 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::resume_file | ( | TransferMetadata & | f_meta, |
| bool | is_multiple = false ) |
Definition at line 230 of file transfer_session.cpp.
|
private |
Send a notification to every targets of the session, generally for the uploader.
| type | type of notification to send |
| data | data to send, default empty |
Definition at line 175 of file transfer_session.cpp.
|
inlinestatic |
Definition at line 103 of file transfer_session.hpp.
|
inline |
Definition at line 111 of file transfer_session.hpp.
| bool dunedaq::snbmodules::TransferSession::start_all | ( | ) |
Definition at line 375 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::start_file | ( | TransferMetadata & | f_meta | ) |
Start the session by downloading or uploading files depending on the type of session TODO : separate thread ?
Definition at line 187 of file transfer_session.cpp.
| std::string dunedaq::snbmodules::TransferSession::to_string | ( | ) | const |
Definition at line 129 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::update_metadata_to_bookkeeper | ( | TransferMetadata & | f_meta | ) |
Update the metadata of the given transfer metadata to the bookkeeper
Definition at line 161 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::update_metadatas_to_bookkeeper | ( | ) |
Update the metadata of the session to the bookkeeper
Definition at line 142 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::upload_all | ( | ) |
Definition at line 452 of file transfer_session.cpp.
| bool dunedaq::snbmodules::TransferSession::upload_file | ( | TransferMetadata & | f_meta, |
| bool | is_multiple = false ) |
Definition at line 314 of file transfer_session.cpp.
|
private |
Ip of the client TODO : useless ? the session cannot have a unique connection.
Definition at line 153 of file transfer_session.hpp.
|
private |
Unique identifier of the session, used to identify the session in the client and to target notification.
Definition at line 149 of file transfer_session.hpp.
|
private |
clients that dowload the files, only used by uploader
Definition at line 170 of file transfer_session.hpp.
|
private |
Abstract interface can reference to any protocol used to transfer data.
Definition at line 156 of file transfer_session.hpp.
|
private |
A session must contain a transfer matadata. The session is basically a transfer wrapper.
Definition at line 160 of file transfer_session.hpp.
|
private |
Type of session, uploader or downloader. Used to block access to some functions.
Definition at line 145 of file transfer_session.hpp.
|
private |
List of threads created by the session TODO : useless ? should be handle in client.
Dir where the session write files
Definition at line 167 of file transfer_session.hpp.