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> 24 #include <string_view> 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;
126 virtual ProvideWorkerItemRef
makeItem (ProvideMessage &&spec );
162 void attachSuccess (
const uint32_t
id,
const std::optional<std::string> &localMountPoint = {} );
192 expected<ProvideMessage>
sendAndWaitForResponse (
const ProvideMessage &request,
const std::vector<uint> &responseCodes );
void pushSingleMessage(const zypp::PluginFrame &msg)
ProvideNotificatioMode provNotificationMode() const
ProvideNotificatioMode _provNotificationMode
std::exception_ptr _fatalError
virtual void cancel(const std::deque< ProvideWorkerItemRef >::iterator &request)=0
Command frame for communication with PluginScript.
StompFrameStreamRef messageStream() const
Timer::Ptr _delayedShutdown
void maybeDelayedShutdown()
expected< void > run(int recv=STDIN_FILENO, int send=STDOUT_FILENO)
void readFdClosed(uint, AsyncDataSource::ChannelCloseReason)
std::string_view _workerName
void provideStart(const uint32_t id, const zypp::Url &url, const zypp::Pathname &localFile, const zypp::Pathname &stagingFile={})
bool _inControllerRequest
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={})
void invalidMessageReceived(std::exception_ptr p)
expected< ProvideMessage > parseReceivedMessage(const zypp::PluginFrame &m)
ProviderConfiguration _workerConf
expected< ProvideMessage > sendAndWaitForResponse(const ProvideMessage &request, const std::vector< uint > &responseCodes)
void setProvNotificationMode(const ProvideNotificatioMode &provNotificationMode)
virtual void immediateShutdown()
zyppng::WorkerCaps WorkerCaps
ProvideWorker(std::string_view workerName)
void messageLoop(Timer &)
virtual ProvideWorkerItemRef makeItem(ProvideMessage &&spec)
AsyncDataSource & controlIO()
void redirect(const uint32_t id, const zypp::Url &url, const zypp::Pathname &newPath)
expected< void > executeHandshake()
ProvideWorkerItem(ProvideMessage &&spec)
int64_t last_auth_timestamp
std::deque< ProvideWorkerItemRef > & requestQueue()
std::shared_ptr< Timer > Ptr
static std::shared_ptr< Timer > create()
Creates a new Timer object, the timer is not started at this point.
std::map< std::string, std::string > extraKeys
void attachSuccess(const uint32_t id, const std::optional< std::string > &localMountPoint={})
Base class for Exception.
void handleSingleMessage(const ProvideMessage &provide)
ZYPP_FWD_DECL_TYPE_WITH_REFS(DeviceDriver)
zyppng::ProviderConfiguration Configuration
AsyncDataSource::Ptr _controlIO
void detachSuccess(const uint32_t id)
void onInvalidMessageReceived()
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 writeFdClosed(AsyncDataSource::ChannelCloseReason)
std::deque< ProvideWorkerItemRef > _pendingProvides
void provideFailed(const uint32_t id, const ProvideMessage::Code code, const std::string &reason, const bool transient, const HeaderValueMap extra={})
void provideSuccess(const uint32_t id, bool cacheHit, const zypp::Pathname &localFile, const HeaderValueMap extra={})
std::deque< ProvideMessage > _pendingMessages
virtual expected< WorkerCaps > initialize(const Configuration &conf)=0
std::shared_ptr< AsyncDataSource > Ptr
StompFrameStreamRef _stream