#include <zypp-media/ng/worker/provideworker.h>
|
| ProvideWorker (std::string_view workerName) |
virtual | ~ProvideWorker () |
StompFrameStreamRef | messageStream () const |
expected< void > | run (int recv=STDIN_FILENO, int send=STDOUT_FILENO) |
std::deque< ProvideWorkerItemRef > & | requestQueue () |
virtual void | immediateShutdown () |
MediaChangeRes | requestMediaChange (const uint32_t id, const std::string &label, const int32_t mediaNr, const std::vector< std::string > &devices, const std::optional< std::string > &desc={}) |
expected< AuthInfo > | requireAuthorization (const uint32_t id, const zypp::Url &url, const std::string &lastTriedUsername="", const int64_t lastTimestamp=-1, const std::map< std::string, std::string > &extraFields={}) |
ProvideNotificatioMode | provNotificationMode () const |
void | setProvNotificationMode (const ProvideNotificatioMode &provNotificationMode) |
| Base () |
virtual | ~Base () |
WeakPtr | parent () const |
void | addChild (const Base::Ptr &child) |
void | removeChild (const Ptr &child) |
const std::unordered_set< Ptr > & | children () const |
std::thread::id | threadId () const |
template<typename T> |
std::vector< std::weak_ptr< T > > | findChildren () const |
template<typename T> |
std::shared_ptr< T > | shared_this () const |
template<typename T> |
std::shared_ptr< T > | shared_this () |
template<typename T> |
std::weak_ptr< T > | weak_this () const |
template<typename T> |
std::weak_ptr< T > | weak_this () |
template<typename SenderFunc, typename ReceiverFunc> |
auto | connect (SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
template<typename SenderFunc, typename ReceiverFunc, typename ... Tracker> |
std::enable_if_t< std::is_member_function_pointer_v< SenderFunc >, connection > | connectFunc (SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
|
virtual void | initLog () |
virtual expected< WorkerCaps > | initialize (const Configuration &conf)=0 |
virtual void | provide ()=0 |
virtual void | cancel (const std::deque< ProvideWorkerItemRef >::iterator &request)=0 |
virtual ProvideWorkerItemRef | makeItem (ProvideMessage &&spec) |
void | provideStart (const uint32_t id, const zypp::Url &url, const zypp::Pathname &localFile, const zypp::Pathname &stagingFile={}) |
void | provideSuccess (const uint32_t id, bool cacheHit, const zypp::Pathname &localFile, const HeaderValueMap extra={}) |
void | provideFailed (const uint32_t id, const ProvideMessage::Code code, const std::string &reason, const bool transient, const HeaderValueMap extra={}) |
void | provideFailed (const uint32_t id, const ProvideMessage::Code code, const bool transient, const zypp::Exception &e) |
void | attachSuccess (const uint32_t id, const std::optional< std::string > &localMountPoint={}) |
void | detachSuccess (const uint32_t id) |
void | redirect (const uint32_t id, const zypp::Url &url, const zypp::Pathname &newPath) |
AsyncDataSource & | controlIO () |
| Base (BasePrivate &dd) |
|
template<typename Obj, typename Functor> |
static decltype(auto) | make_base_slot (Obj *o, Functor &&f) |
template<typename SenderFunc, typename ReceiverFunc> |
static auto | connect (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
template<typename SenderFunc, typename ReceiverFunc, typename ... Tracker> |
static auto | connectFunc (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
std::unique_ptr< BasePrivate > | d_ptr |
Definition at line 65 of file provideworker.h.
◆ ProvideNotificatioMode
Enumerator |
---|
ONLY_NEW_PROVIDES | |
QUEUE_NOT_EMTPY | |
Definition at line 69 of file provideworker.h.
◆ MediaChangeRes
This will request a media change from the user and BLOCK until it was acknowledged.
Enumerator |
---|
SUCCESS | |
ABORT | |
SKIP | |
Definition at line 91 of file provideworker.h.
◆ ProvideWorker()
zyppng::worker::ProvideWorker::ProvideWorker |
( |
std::string_view | workerName | ) |
|
◆ ~ProvideWorker()
zyppng::worker::ProvideWorker::~ProvideWorker |
( |
| ) |
|
|
virtual |
◆ messageStream()
StompFrameStreamRef zyppng::worker::ProvideWorker::messageStream |
( |
| ) |
const |
◆ run()
expected< void > zyppng::worker::ProvideWorker::run |
( |
int | recv = STDIN_FILENO, |
|
|
int | send = STDOUT_FILENO ) |
◆ requestQueue()
std::deque< ProvideWorkerItemRef > & zyppng::worker::ProvideWorker::requestQueue |
( |
| ) |
|
◆ immediateShutdown()
virtual void zyppng::worker::ProvideWorker::immediateShutdown |
( |
| ) |
|
|
inlinevirtual |
◆ requestMediaChange()
ProvideWorker::MediaChangeRes zyppng::worker::ProvideWorker::requestMediaChange |
( |
const uint32_t | id, |
|
|
const std::string & | label, |
|
|
const int32_t | mediaNr, |
|
|
const std::vector< std::string > & | devices, |
|
|
const std::optional< std::string > & | desc = {} ) |
◆ requireAuthorization()
expected< AuthInfo > zyppng::worker::ProvideWorker::requireAuthorization |
( |
const uint32_t | id, |
|
|
const zypp::Url & | url, |
|
|
const std::string & | lastTriedUsername = "", |
|
|
const int64_t | lastTimestamp = -1, |
|
|
const std::map< std::string, std::string > & | extraFields = {} ) |
This will send a authorization request message to the controller, asking for credentials for a given url. The lastTimstamp should be initialized with the last AuthInfo timestamp that was received from the controller or -1 if none was received before.
- Note
- this blocks until a answer is received, all other received messages are delayed
Definition at line 256 of file provideworker.cc.
◆ provNotificationMode()
◆ setProvNotificationMode()
void zyppng::worker::ProvideWorker::setProvNotificationMode |
( |
const ProvideNotificatioMode & | provNotificationMode | ) |
|
◆ initLog()
void zyppng::worker::ProvideWorker::initLog |
( |
| ) |
|
|
protectedvirtual |
◆ initialize()
◆ provide()
virtual void zyppng::worker::ProvideWorker::provide |
( |
| ) |
|
|
protectedpure virtual |
◆ cancel()
virtual void zyppng::worker::ProvideWorker::cancel |
( |
const std::deque< ProvideWorkerItemRef >::iterator & | request | ) |
|
|
protectedpure virtual |
◆ makeItem()
ProvideWorkerItemRef zyppng::worker::ProvideWorker::makeItem |
( |
ProvideMessage && | spec | ) |
|
|
protectedvirtual |
Always called to create new items for the request queue, override this to populate the queue with instances of custom ProvideItem subclasses.
Cancel requests are directly handled by calling cancel(), however Attach and Detach requests are enqueued as well
Definition at line 120 of file provideworker.cc.
◆ provideStart()
Send a ProvideStart signal to the controller, this is to notify the controller that we have started providing the file the argument localFile has to refer to the file where the file will be provided into, it will be used to calculate statistics about download speed on the controller side. The stagingFile argument can be used for cases where the worker uses a staging area to download files into but later moves the file over to the result filename. In those cases the provider will check both locations for the file when calculating stats
- Note
- Always call ref before sending this message.
Definition at line 125 of file provideworker.cc.
◆ provideSuccess()
Send a ProvideSuccess message to the controller. This is to signal that we are finished with providing a file and release the file to be used by the controller side.
Definition at line 136 of file provideworker.cc.
◆ provideFailed() [1/2]
Send a ProvideFailed message to the controller. This is to signal that we are failed providing a resource
- Note
- If the request referenced a ident before make sure to manually release it after sending the message.
Definition at line 149 of file provideworker.cc.
◆ provideFailed() [2/2]
Overload of provideFailed that takes a zypp::Exception to fill in the error details
- Note
- If the request referenced a ident before make sure to manually release it after sending the message.
Definition at line 163 of file provideworker.cc.
◆ attachSuccess()
void zyppng::worker::ProvideWorker::attachSuccess |
( |
const uint32_t | id, |
|
|
const std::optional< std::string > & | localMountPoint = {} ) |
|
protected |
Send a AttachSuccess message to the controller. This is to signal that we are finished with mounting and verifying a medium
Definition at line 177 of file provideworker.cc.
◆ detachSuccess()
void zyppng::worker::ProvideWorker::detachSuccess |
( |
const uint32_t | id | ) |
|
|
protected |
Send a DetachSuccess message to the controller. This is to signal that we are finished unmounting a medium
Definition at line 187 of file provideworker.cc.
◆ redirect()
void zyppng::worker::ProvideWorker::redirect |
( |
const uint32_t | id, |
|
|
const zypp::Url & | url, |
|
|
const zypp::Pathname & | newPath ) |
|
protected |
Send a Redirect message to the controller for the given request ID. This is similar to sending a ProvideSuccess message and the request will be removed from the queue, which means the worker also has to remove it from its internal queue.
◆ controlIO()
Returns the control IO datasource, only valid after run was called
Definition at line 284 of file provideworker.cc.
◆ executeHandshake()
expected< void > zyppng::worker::ProvideWorker::executeHandshake |
( |
| ) |
|
|
private |
◆ maybeDelayedShutdown()
void zyppng::worker::ProvideWorker::maybeDelayedShutdown |
( |
| ) |
|
|
private |
◆ messageLoop()
void zyppng::worker::ProvideWorker::messageLoop |
( |
Timer & | | ) |
|
|
private |
◆ readFdClosed()
◆ writeFdClosed()
◆ messageReceived()
void zyppng::worker::ProvideWorker::messageReceived |
( |
| ) |
|
|
private |
◆ onInvalidMessageReceived()
void zyppng::worker::ProvideWorker::onInvalidMessageReceived |
( |
| ) |
|
|
private |
◆ invalidMessageReceived()
void zyppng::worker::ProvideWorker::invalidMessageReceived |
( |
std::exception_ptr | p | ) |
|
|
private |
◆ handleSingleMessage()
void zyppng::worker::ProvideWorker::handleSingleMessage |
( |
const ProvideMessage & | provide | ) |
|
|
private |
◆ pushSingleMessage()
void zyppng::worker::ProvideWorker::pushSingleMessage |
( |
const zypp::PluginFrame & | msg | ) |
|
|
private |
◆ sendAndWaitForResponse()
◆ parseReceivedMessage()
◆ _provNotificationMode
◆ _inControllerRequest
bool zyppng::worker::ProvideWorker::_inControllerRequest = false |
|
private |
◆ _isRunning
bool zyppng::worker::ProvideWorker::_isRunning = false |
|
private |
◆ _workerName
std::string_view zyppng::worker::ProvideWorker::_workerName |
|
private |
◆ _loop
◆ _msgAvail
◆ _delayedShutdown
◆ _controlIO
◆ _stream
StompFrameStreamRef zyppng::worker::ProvideWorker::_stream |
|
private |
◆ _workerConf
◆ _fatalError
std::exception_ptr zyppng::worker::ProvideWorker::_fatalError |
|
private |
◆ _pendingMessages
std::deque<ProvideMessage> zyppng::worker::ProvideWorker::_pendingMessages |
|
private |
◆ _pendingProvides
std::deque<ProvideWorkerItemRef> zyppng::worker::ProvideWorker::_pendingProvides |
|
private |
The documentation for this class was generated from the following files: