#include </home/abuild/rpmbuild/BUILD/libzypp-17.31.23/zypp-media/ng/worker/provideworker.h>
|
| ProvideWorker (std::string_view workerName) |
|
virtual | ~ProvideWorker () |
|
RpcMessageStream::Ptr | 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) |
|
|
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 uint code, const std::string &reason, const bool transient, const HeaderValueMap extra={}) |
|
void | provideFailed (const uint32_t id, const uint code, const bool transient, const zypp::Exception &e) |
|
void | attachSuccess (const uint32_t id) |
|
void | detachSuccess (const uint32_t id) |
|
void | redirect (const uint32_t id, const zypp::Url &url, const zypp::Pathname &newPath) |
|
AsyncDataSource & | controlIO () |
|
Definition at line 67 of file provideworker.h.
◆ ProvideNotificatioMode
Enumerator |
---|
ONLY_NEW_PROVIDES | |
QUEUE_NOT_EMTPY | |
Definition at line 71 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 93 of file provideworker.h.
◆ ProvideWorker()
zyppng::worker::ProvideWorker::ProvideWorker |
( |
std::string_view |
workerName | ) |
|
◆ ~ProvideWorker()
zyppng::worker::ProvideWorker::~ProvideWorker |
( |
| ) |
|
|
virtual |
◆ messageStream()
RpcMessageStream::Ptr 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 257 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 121 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 126 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 137 of file provideworker.cc.
◆ provideFailed() [1/2]
void zyppng::worker::ProvideWorker::provideFailed |
( |
const uint32_t |
id, |
|
|
const uint |
code, |
|
|
const std::string & |
reason, |
|
|
const bool |
transient, |
|
|
const HeaderValueMap |
extra = {} |
|
) |
| |
|
protected |
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 150 of file provideworker.cc.
◆ provideFailed() [2/2]
void zyppng::worker::ProvideWorker::provideFailed |
( |
const uint32_t |
id, |
|
|
const uint |
code, |
|
|
const bool |
transient, |
|
|
const zypp::Exception & |
e |
|
) |
| |
|
protected |
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 164 of file provideworker.cc.
◆ attachSuccess()
void zyppng::worker::ProvideWorker::attachSuccess |
( |
const uint32_t |
id | ) |
|
|
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 178 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 188 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()
AsyncDataSource & zyppng::worker::ProvideWorker::controlIO |
( |
| ) |
|
|
protected |
Returns the control IO datasource, only valid after run was called
Definition at line 286 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()
void zyppng::worker::ProvideWorker::readFdClosed |
( |
uint |
, |
|
|
AsyncDataSource::ChannelCloseReason |
|
|
) |
| |
|
private |
◆ writeFdClosed()
void zyppng::worker::ProvideWorker::writeFdClosed |
( |
AsyncDataSource::ChannelCloseReason |
| ) |
|
|
private |
◆ 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 RpcMessage & |
msg | ) |
|
|
private |
◆ sendAndWaitForResponse()
expected< ProvideMessage > zyppng::worker::ProvideWorker::sendAndWaitForResponse |
( |
const ProvideMessage & |
request, |
|
|
const std::vector< uint > & |
responseCodes |
|
) |
| |
|
private |
◆ parseReceivedMessage()
expected< ProvideMessage > zyppng::worker::ProvideWorker::parseReceivedMessage |
( |
const RpcMessage & |
m | ) |
|
|
private |
◆ _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
EventLoop::Ptr zyppng::worker::ProvideWorker::_loop = EventLoop::create() |
|
private |
◆ _msgAvail
Timer::Ptr zyppng::worker::ProvideWorker::_msgAvail = Timer::create() |
|
private |
◆ _delayedShutdown
Timer::Ptr zyppng::worker::ProvideWorker::_delayedShutdown = Timer::create() |
|
private |
◆ _controlIO
AsyncDataSource::Ptr zyppng::worker::ProvideWorker::_controlIO |
|
private |
◆ _stream
RpcMessageStream::Ptr 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: