libzypp 17.37.17
zyppng::AttachMediaItem Class Reference

#include <zypp-media/ng/private/provideitem_p.h>

Inheritance diagram for zyppng::AttachMediaItem:

Public Member Functions

 ~AttachMediaItem ()
SignalProxy< void(const zyppng::expected< AttachedMediaInfo * > &) > sigReady ()
ProvidePromiseRef< Provide::MediaHandlepromise ()
Public Member Functions inherited from zyppng::ProvideItem
 ProvideItem (ProvidePrivate &parent)
 ~ProvideItem ()
virtual void released ()
State state () const
SignalProxy< void(ProvideItem &item, State oldState, State newState)> sigStateChanged ()
ProvidePrivateprovider ()
virtual bool canRedirectTo (ProvideRequestRef startedReq, const zypp::Url &url)
const std::optional< ItemStats > & currentStats () const
const std::optional< ItemStats > & previousStats () const
virtual std::chrono::steady_clock::time_point startTime () const
virtual std::chrono::steady_clock::time_point finishedTime () const
void pulse ()
virtual zypp::ByteCount bytesExpected () const
Public Member Functions inherited from zyppng::Base
 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 >, connectionconnectFunc (SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers)

Static Public Member Functions

static AttachMediaItemRef create (const zypp::MirroredOrigin &origin, const ProvideMediaSpec &request, ProvidePrivate &parent)
Static Public Member Functions inherited from zyppng::Base
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)

Protected Member Functions

 AttachMediaItem (const zypp::MirroredOrigin &origin, const ProvideMediaSpec &request, ProvidePrivate &parent)
void initialize () override
void finishReq (ProvideQueue &queue, ProvideRequestRef finishedReq, const ProvideMessage &msg) override
void cancelWithError (std::exception_ptr error) override
void finishWithSuccess (AttachedMediaInfo_Ptr medium)
expected< zypp::media::AuthDataauthenticationRequired (ProvideQueue &queue, ProvideRequestRef req, const zypp::Url &effectiveUrl, int64_t lastTimestamp, const std::map< std::string, std::string > &extraFields) override
void onMasterItemReady (const zyppng::expected< AttachedMediaInfo * > &result)
virtual void finishReq (ProvideQueue *queue, ProvideRequestRef finishedReq, const std::exception_ptr excpt)
Protected Member Functions inherited from zyppng::ProvideItem
virtual ItemStats makeStats ()
virtual void informalMessage (ProvideQueue &, ProvideRequestRef req, const ProvideMessage &msg)
virtual void cacheMiss (ProvideRequestRef req)
bool safeRedirectTo (ProvideRequestRef startedReq, const zypp::Url &url)
void redirectTo (ProvideRequestRef startedReq, const zypp::Url &url)
virtual bool enqueueRequest (ProvideRequestRef request)
bool dequeue ()
void updateState (const State newState)
void setFinished ()
Protected Member Functions inherited from zyppng::Base
 Base (BasePrivate &dd)

Private Attributes

Signal< void(const zyppng::expected< AttachedMediaInfo * > &)> _sigReady
bool _promiseCreated = false
connection _masterItemConn
zypp::MirroredOrigin _origin
ProvideMediaSpec _initialSpec
ProvideQueue::Config::WorkerType _workerType = ProvideQueue::Config::Invalid
ProvidePromiseWeakRef< Provide::MediaHandle_promise
MediaDataVerifierRef _verifier

Additional Inherited Members

Public Types inherited from zyppng::ProvideItem
enum  State {
  Uninitialized , Pending , Downloading , Processing ,
  Cancelling , Finalizing , Finished
}
Public Types inherited from zyppng::Base
using Ptr = std::shared_ptr<Base>
using WeakPtr = std::weak_ptr<Base>
Protected Attributes inherited from zyppng::ProvideItem
ProvideRequestRef _runningReq
Protected Attributes inherited from zyppng::Base
std::unique_ptr< BasePrivated_ptr

Detailed Description

Item attaching and verifying a medium

Definition at line 175 of file provideitem_p.h.

Constructor & Destructor Documentation

◆ ~AttachMediaItem()

zyppng::AttachMediaItem::~AttachMediaItem ( )

Definition at line 864 of file provideitem.cc.

◆ AttachMediaItem()

zyppng::AttachMediaItem::AttachMediaItem ( const zypp::MirroredOrigin & origin,
const ProvideMediaSpec & request,
ProvidePrivate & parent )
protected

Definition at line 858 of file provideitem.cc.

Member Function Documentation

◆ create()

AttachMediaItemRef zyppng::AttachMediaItem::create ( const zypp::MirroredOrigin & origin,
const ProvideMediaSpec & request,
ProvidePrivate & parent )
static

Definition at line 1113 of file provideitem.cc.

◆ sigReady()

SignalProxy< void(const zyppng::expected< AttachedMediaInfo * > &)> zyppng::AttachMediaItem::sigReady ( )

Definition at line 1118 of file provideitem.cc.

◆ promise()

ProvidePromiseRef< Provide::MediaHandle > zyppng::AttachMediaItem::promise ( )

Definition at line 869 of file provideitem.cc.

◆ initialize()

void zyppng::AttachMediaItem::initialize ( )
overrideprotectedvirtual

Called by the controller when the item is supposed to start fetching / processing

Implements zyppng::ProvideItem.

Definition at line 880 of file provideitem.cc.

◆ finishReq() [1/2]

void zyppng::AttachMediaItem::finishReq ( ProvideQueue & queue,
ProvideRequestRef finishedReq,
const ProvideMessage & msg )
overrideprotectedvirtual

Request was finished by the queue Base implementation handles redirect, metalink and error messages. If a different message is received, cancelWithError is called.

A subclass has to overload this function to handle success messages

Reimplemented from zyppng::ProvideItem.

Definition at line 1123 of file provideitem.cc.

◆ cancelWithError()

void zyppng::AttachMediaItem::cancelWithError ( std::exception_ptr error)
overrideprotectedvirtual

Cancels all running requests and immediately moves to error state

Implements zyppng::ProvideItem.

Definition at line 1058 of file provideitem.cc.

◆ finishWithSuccess()

void zyppng::AttachMediaItem::finishWithSuccess ( AttachedMediaInfo_Ptr medium)
protected

Definition at line 1028 of file provideitem.cc.

◆ authenticationRequired()

expected< zypp::media::AuthData > zyppng::AttachMediaItem::authenticationRequired ( ProvideQueue & queue,
ProvideRequestRef req,
const zypp::Url & effectiveUrl,
int64_t lastTimestamp,
const std::map< std::string, std::string > & extraFields )
overrideprotectedvirtual

Request needs authentication data, the function is supposed to return the AuthData to use for the response, or an error The default implementation simply uses the given URL to look for a Auth match in the zypp::media::CredentialManager.

Reimplemented from zyppng::ProvideItem.

Definition at line 1203 of file provideitem.cc.

◆ onMasterItemReady()

void zyppng::AttachMediaItem::onMasterItemReady ( const zyppng::expected< AttachedMediaInfo * > & result)
protected

Definition at line 1089 of file provideitem.cc.

◆ finishReq() [2/2]

void zyppng::ProvideItem::finishReq ( ProvideQueue * queue,
ProvideRequestRef finishedReq,
const std::exception_ptr excpt )
protectedvirtual

Request was finished with a error The base implementation simply calls cancelWithError

Note
queue is allowed to be a nullptr here

Reimplemented from zyppng::ProvideItem.

Definition at line 143 of file provideitem.cc.

Member Data Documentation

◆ _sigReady

Signal< void( const zyppng::expected<AttachedMediaInfo *> & )> zyppng::AttachMediaItem::_sigReady
private

Definition at line 199 of file provideitem_p.h.

◆ _promiseCreated

bool zyppng::AttachMediaItem::_promiseCreated = false
private

Definition at line 200 of file provideitem_p.h.

◆ _masterItemConn

connection zyppng::AttachMediaItem::_masterItemConn
private

Definition at line 201 of file provideitem_p.h.

◆ _origin

zypp::MirroredOrigin zyppng::AttachMediaItem::_origin
private

Definition at line 202 of file provideitem_p.h.

◆ _initialSpec

ProvideMediaSpec zyppng::AttachMediaItem::_initialSpec
private

Definition at line 203 of file provideitem_p.h.

◆ _workerType

ProvideQueue::Config::WorkerType zyppng::AttachMediaItem::_workerType = ProvideQueue::Config::Invalid
private

Definition at line 204 of file provideitem_p.h.

◆ _promise

ProvidePromiseWeakRef<Provide::MediaHandle> zyppng::AttachMediaItem::_promise
private

Definition at line 205 of file provideitem_p.h.

◆ _verifier

MediaDataVerifierRef zyppng::AttachMediaItem::_verifier
private

Definition at line 206 of file provideitem_p.h.


The documentation for this class was generated from the following files: