libzypp: zyppng::ZckLoader Class Reference

libzypp 17.38.6

zyppng::ZckLoader Class Reference

`#include <zypp-curl/ng/network/zckhelper.h>`

Inheritance diagram for zyppng::ZckLoader:

## Classes
struct | PrepareResult

## Public Types
enum | State { Initial , DownloadLead , DownloadHeader , DownloadChunks , Finished }
using | Block = RangeDesc
Public Types inherited from zyppng::Base
using | Ptr = std::shared_ptr<Base>
using | WeakPtr = std::weak_ptr<Base>

## Public Member Functions
expected< void > | buildZchunkFile (const zypp::Pathname &target, const zypp::Pathname &delta, const std::optional< zypp::ByteCount > &expectedFileSize, const std::optional< zypp::ByteCount > &zcKHeaderSize)
expected< void > | cont ()
void | setFailed (const std::string &msg)
SignalProxy< void(const std::vector< Block > &)> | sigBlocksRequired ()
| Signal to notify the caller about required blocks, once the blocks are downloaded call cont to continue with the process.
SignalProxy< void(PrepareResult)> | sigFinished ()
| Called once the zchunk build process is finished, either with error or success.
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)
void | setData (uint32_t quark, zypp::AutoDispose< void * > data)
void * | data (uint32_t quark)
void | clearData (uint32_t quark)

## Static Public Member Functions
static zypp::ByteCount | minZchunkDownloadSize ()
| The minimum size to download to have enough data to know the full header size.
static bool | isZchunkFile (const zypp::Pathname &file)
static PrepareResult | prepareZck (const zypp::Pathname &delta, const zypp::Pathname &target, const zypp::ByteCount &expectedFileSize)
static bool | validateZckFile (const zypp::Pathname &file, std::string &error)
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)

## Private Attributes
State | _state = Initial
zypp::AutoDispose< zckCtx * > | _zchunkContext
zypp::AutoFD | _targetFd
zypp::ByteCount | _bytesReused = 0
zypp::Pathname | _target
zypp::Pathname | _delta
std::optional< zypp::ByteCount > | _expectedFileSize
std::optional< zypp::ByteCount > | _zcKHeaderSize
Signal< void(const std::vector< Block > &)> | _sigBlocksRequired
Signal< void(PrepareResult)> | _sigFinished

## Additional Inherited Members
Protected Member Functions inherited from zyppng::Base
| Base (BasePrivate &dd)
Protected Attributes inherited from zyppng::Base
std::unique_ptr< BasePrivate > | d_ptr

## Detailed Description

Definition at line 38 of file zckhelper.h.

## Member Typedef Documentation

## ◆ Block

using zyppng::ZckLoader::Block = RangeDesc

Definition at line 49 of file zckhelper.h.

## Member Enumeration Documentation

## ◆ State

enum zyppng::ZckLoader::State

Enumerator
Initial |
DownloadLead |
DownloadHeader |
DownloadChunks |
Finished |

Definition at line 41 of file zckhelper.h.

## Member Function Documentation

## ◆ buildZchunkFile()

expected< void > zyppng::ZckLoader::buildZchunkFile | ( | const zypp::Pathname & | target,
|  | const zypp::Pathname & | delta,
|  | const std::optional< zypp::ByteCount > & | expectedFileSize,
|  | const std::optional< zypp::ByteCount > & | zcKHeaderSize )

This function kickstarts the build process. The sigBlocksRequired and sigFinished signals need to be connected in order to download required blocks or get the finished event.

Definition at line 27 of file zckhelper.cc.

## ◆ cont()

expected< void > zyppng::ZckLoader::cont | ( |  | ) |

Advances the statemachine after sigBlocksRequired was triggered and blocks have been downloaded into the targetFile

Definition at line 69 of file zckhelper.cc.

## ◆ setFailed()

void zyppng::ZckLoader::setFailed | ( | const std::string & | msg | ) |

Advances the statemanchine into the failed state and emits sigFinished

Definition at line 279 of file zckhelper.cc.

## ◆ sigBlocksRequired()

SignalProxy< void(const std::vector< ZckLoader::Block > &)> zyppng::ZckLoader::sigBlocksRequired | ( |  | ) |

Signal to notify the caller about required blocks, once the blocks are downloaded call cont to continue with the process.

Definition at line 294 of file zckhelper.cc.

## ◆ sigFinished()

SignalProxy< void(ZckLoader::PrepareResult)> zyppng::ZckLoader::sigFinished | ( |  | ) |

Called once the zchunk build process is finished, either with error or success.

Definition at line 299 of file zckhelper.cc.

## ◆ minZchunkDownloadSize()

zypp::ByteCount zyppng::ZckLoader::minZchunkDownloadSize | ( |  | ) |
| static

The minimum size to download to have enough data to know the full header size.

Definition at line 304 of file zckhelper.cc.

## ◆ isZchunkFile()

bool zyppng::ZckLoader::isZchunkFile | ( | const zypp::Pathname & | file | ) |
| static

Checks if a given file is a zck file

Definition at line 309 of file zckhelper.cc.

## ◆ prepareZck()

ZckLoader::PrepareResult zyppng::ZckLoader::prepareZck | ( | const zypp::Pathname & | delta,
|  | const zypp::Pathname & | target,
|  | const zypp::ByteCount & | expectedFileSize )
| static

Prepares the file in target with already existing chunks in delta. The target file must already contain the zck header data of the to be downloaded file.

Definition at line 322 of file zckhelper.cc.

## ◆ validateZckFile()

bool zyppng::ZckLoader::validateZckFile | ( | const zypp::Pathname & | file,
|  | std::string & | error )
| static

Checks if a given zck file is internally valid

Definition at line 457 of file zckhelper.cc.

## Member Data Documentation

## ◆ _state

State zyppng::ZckLoader::_state = Initial
| private

Definition at line 118 of file zckhelper.h.

## ◆ _zchunkContext

zypp::AutoDispose<zckCtx *> zyppng::ZckLoader::_zchunkContext
| private

Definition at line 119 of file zckhelper.h.

## ◆ _targetFd

zypp::AutoFD zyppng::ZckLoader::_targetFd
| private

Definition at line 120 of file zckhelper.h.

## ◆ _bytesReused

zypp::ByteCount zyppng::ZckLoader::_bytesReused = 0
| private

Definition at line 121 of file zckhelper.h.

## ◆ _target

zypp::Pathname zyppng::ZckLoader::_target
| private

Definition at line 123 of file zckhelper.h.

## ◆ _delta

zypp::Pathname zyppng::ZckLoader::_delta
| private

Definition at line 124 of file zckhelper.h.

## ◆ _expectedFileSize

std::optional<zypp::ByteCount> zyppng::ZckLoader::_expectedFileSize
| private

Definition at line 125 of file zckhelper.h.

## ◆ _zcKHeaderSize

std::optional<zypp::ByteCount> zyppng::ZckLoader::_zcKHeaderSize
| private

Definition at line 126 of file zckhelper.h.

## ◆ _sigBlocksRequired

Signal<void(const std::vector<Block> &)> zyppng::ZckLoader::_sigBlocksRequired
| private

Definition at line 128 of file zckhelper.h.

## ◆ _sigFinished

Signal<void( PrepareResult )> zyppng::ZckLoader::_sigFinished
| private

Definition at line 129 of file zckhelper.h.

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

- zypp-curl/ng/network/zckhelper.h
- zypp-curl/ng/network/zckhelper.cc