libzypp: zyppng::ProvideFileItem Class Reference

libzypp 17.36.6

Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
zyppng::ProvideFileItem Class Reference

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

Inheritance diagram for zyppng::ProvideFileItem:

## Public Member Functions
void | initialize () override
ProvidePromiseRef< ProvideRes > | promise ()
void | setMediaRef (Provide::MediaHandle &&hdl)
Provide::MediaHandle & | mediaRef ()
ItemStats | makeStats () override
zypp::ByteCount | bytesExpected () const override
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 ()
ProvidePrivate & | provider ()
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 ()
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 >, connection > | connectFunc (SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers)

## Static Public Member Functions
static ProvideFileItemRef | create (const std::vector< zypp::Url > &urls, const ProvideFileSpec &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
| ProvideFileItem (const std::vector< zypp::Url > &urls, const ProvideFileSpec &request, ProvidePrivate &parent)
void | informalMessage (ProvideQueue &, ProvideRequestRef req, const ProvideMessage &msg) override
void | finishReq (ProvideQueue &queue, ProvideRequestRef finishedReq, const ProvideMessage &msg) override
void | cancelWithError (std::exception_ptr error) override
expected< zypp::media::AuthData > | authenticationRequired (ProvideQueue &queue, ProvideRequestRef req, const zypp::Url &effectiveUrl, int64_t lastTimestamp, const std::map< std::string, std::string > &extraFields) override
virtual void | finishReq (ProvideQueue *queue, ProvideRequestRef finishedReq, const std::exception_ptr excpt)
Protected Member Functions inherited from zyppng::ProvideItem
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
Provide::MediaHandle | _handleRef
bool | _promiseCreated = false
std::vector< zypp::Url > | _mirrorList
ProvideFileSpec | _initialSpec
zypp::Pathname | _targetFile
zypp::Pathname | _stagingFile
zypp::ByteCount | _expectedBytes
ProvidePromiseWeakRef< ProvideRes > | _promise

## 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< BasePrivate > | d_ptr

## Detailed Description

Item downloading and providing a file

Definition at line 130 of file provideitem_p.h.

## Constructor & Destructor Documentation

## ◆ ProvideFileItem()

zyppng::ProvideFileItem::ProvideFileItem | ( | const std::vector< zypp::Url > & | urls,
|  | const ProvideFileSpec & | request,
|  | ProvidePrivate & | parent )
| protected

Definition at line 559 of file provideitem.cc.

## Member Function Documentation

## ◆ create()

ProvideFileItemRef zyppng::ProvideFileItem::create | ( | const std::vector< zypp::Url > & | urls,
|  | const ProvideFileSpec & | request,
|  | ProvidePrivate & | parent )
| static

Definition at line 565 of file provideitem.cc.

## ◆ initialize()

void zyppng::ProvideFileItem::initialize | ( |  | ) |
| overridevirtual

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

Implements zyppng::ProvideItem.

Definition at line 570 of file provideitem.cc.

## ◆ promise()

ProvidePromiseRef< ProvideRes > zyppng::ProvideFileItem::promise | ( |  | ) |

Definition at line 592 of file provideitem.cc.

## ◆ setMediaRef()

void zyppng::ProvideFileItem::setMediaRef | ( | Provide::MediaHandle && | hdl | ) |

Definition at line 603 of file provideitem.cc.

## ◆ mediaRef()

Provide::MediaHandle & zyppng::ProvideFileItem::mediaRef | ( |  | ) |

Definition at line 608 of file provideitem.cc.

## ◆ makeStats()

ProvideFileItem::ItemStats zyppng::ProvideFileItem::makeStats | ( |  | ) |
| overridevirtual

Reimplemented from zyppng::ProvideItem.

Definition at line 794 of file provideitem.cc.

## ◆ bytesExpected()

zypp::ByteCount zyppng::ProvideFileItem::bytesExpected | ( |  | ) | const
| overridevirtual

Returns the bytes the item expects to provide, the default impl returns 0

Reimplemented from zyppng::ProvideItem.

Definition at line 819 of file provideitem.cc.

## ◆ informalMessage()

void zyppng::ProvideFileItem::informalMessage | ( | ProvideQueue & | ,
|  | ProvideRequestRef | req,
|  | const ProvideMessage & | msg )
| overrideprotectedvirtual

Request received a informal message, e.g. ProvideStarted

Reimplemented from zyppng::ProvideItem.

Definition at line 613 of file provideitem.cc.

## ◆ finishReq() [1/2]

void zyppng::ProvideFileItem::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.

## ◆ cancelWithError()

void zyppng::ProvideFileItem::cancelWithError | ( | std::exception_ptr | error | ) |
| overrideprotectedvirtual

Cancels all running requests and immediately moves to error state

Implements zyppng::ProvideItem.

Definition at line 758 of file provideitem.cc.

## ◆ authenticationRequired()

expected< zypp::media::AuthData > zyppng::ProvideFileItem::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 780 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

## ◆ _handleRef

Provide::MediaHandle zyppng::ProvideFileItem::_handleRef
| private

Definition at line 157 of file provideitem_p.h.

## ◆ _promiseCreated

bool zyppng::ProvideFileItem::_promiseCreated = false
| private

Definition at line 158 of file provideitem_p.h.

## ◆ _mirrorList

std::vector<zypp::Url> zyppng::ProvideFileItem::_mirrorList
| private

Definition at line 159 of file provideitem_p.h.

## ◆ _initialSpec

ProvideFileSpec zyppng::ProvideFileItem::_initialSpec
| private

Definition at line 160 of file provideitem_p.h.

## ◆ _targetFile

zypp::Pathname zyppng::ProvideFileItem::_targetFile
| private

Definition at line 161 of file provideitem_p.h.

## ◆ _stagingFile

zypp::Pathname zyppng::ProvideFileItem::_stagingFile
| private

Definition at line 162 of file provideitem_p.h.

## ◆ _expectedBytes

zypp::ByteCount zyppng::ProvideFileItem::_expectedBytes
| private

Definition at line 163 of file provideitem_p.h.

## ◆ _promise

ProvidePromiseWeakRef<ProvideRes> zyppng::ProvideFileItem::_promise
| private

Definition at line 164 of file provideitem_p.h.

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

- zypp-media/ng/private/provideitem_p.h
- zypp-media/ng/provideitem.cc