10#ifndef ZYPP_MEDIA_PROVIDE_WORKER_H_INCLUDED
11#define ZYPP_MEDIA_PROVIDE_WORKER_H_INCLUDED
13#include <zypp-core/zyppng/base/Base>
14#include <zypp-core/zyppng/base/EventLoop>
15#include <zypp-core/zyppng/base/Timer>
16#include <zypp-core/zyppng/io/AsyncDataSource>
17#include <zypp-core/zyppng/pipelines/Expected>
20#include <zypp-media/ng/HeaderValueMap>
21#include <zypp-media/MediaException>
22#include <zypp-media/Mount>
96 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 = {} );
118 virtual void cancel (
const std::deque<ProvideWorkerItemRef>::iterator &request ) = 0;
162 void attachSuccess (
const uint32_t
id,
const std::optional<std::string> &localMountPoint = {} );
Base class for Exception.
Command frame for communication with PluginScript.
std::shared_ptr< AsyncDataSource > Ptr
The Timer class provides repetitive and single-shot timers.
static std::shared_ptr< Timer > create()
Creates a new Timer object, the timer is not started at this point.
std::shared_ptr< Timer > Ptr
ProvideWorkerItem(ProvideMessage &&spec)
std::string_view _workerName
void detachSuccess(const uint32_t id)
virtual void immediateShutdown()
std::deque< ProvideWorkerItemRef > _pendingProvides
void handleSingleMessage(const ProvideMessage &provide)
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={})
AsyncDataSource & controlIO()
void messageLoop(Timer &)
void attachSuccess(const uint32_t id, const std::optional< std::string > &localMountPoint={})
ProvideWorker(std::string_view workerName)
expected< void > executeHandshake()
AsyncDataSource::Ptr _controlIO
void onInvalidMessageReceived()
void provideStart(const uint32_t id, const zypp::Url &url, const zypp::Pathname &localFile, const zypp::Pathname &stagingFile={})
StompFrameStreamRef messageStream() const
virtual void cancel(const std::deque< ProvideWorkerItemRef >::iterator &request)=0
std::deque< ProvideMessage > _pendingMessages
void writeFdClosed(AsyncDataSource::ChannelCloseReason)
void pushSingleMessage(const zypp::PluginFrame &msg)
expected< ProvideMessage > parseReceivedMessage(const zypp::PluginFrame &m)
Timer::Ptr _delayedShutdown
void maybeDelayedShutdown()
void provideSuccess(const uint32_t id, bool cacheHit, const zypp::Pathname &localFile, const HeaderValueMap extra={})
ProvideNotificatioMode provNotificationMode() const
expected< void > run(int recv=STDIN_FILENO, int send=STDOUT_FILENO)
virtual ProvideWorkerItemRef makeItem(ProvideMessage &&spec)
void setProvNotificationMode(const ProvideNotificatioMode &provNotificationMode)
ProviderConfiguration _workerConf
void provideFailed(const uint32_t id, const ProvideMessage::Code code, const std::string &reason, const bool transient, const HeaderValueMap extra={})
virtual expected< WorkerCaps > initialize(const Configuration &conf)=0
void readFdClosed(uint, AsyncDataSource::ChannelCloseReason)
StompFrameStreamRef _stream
std::deque< ProvideWorkerItemRef > & requestQueue()
ProvideNotificatioMode _provNotificationMode
bool _inControllerRequest
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={})
void invalidMessageReceived(std::exception_ptr p)
void redirect(const uint32_t id, const zypp::Url &url, const zypp::Pathname &newPath)
expected< ProvideMessage > sendAndWaitForResponse(const ProvideMessage &request, const std::vector< uint > &responseCodes)
std::exception_ptr _fatalError
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
zyppng::ProviderConfiguration Configuration
zyppng::ProvideMessage Message
zyppng::WorkerCaps WorkerCaps
int64_t last_auth_timestamp
std::map< std::string, std::string > extraKeys
#define ZYPP_FWD_DECL_TYPE_WITH_REFS(T)