libzypp 17.31.23
zyppng::ProvideQueue Class Reference

#include </home/abuild/rpmbuild/BUILD/libzypp-17.31.23/zypp-media/ng/private/providequeue_p.h>

Inheritance diagram for zyppng::ProvideQueue:

Classes

struct  Item
 

Public Types

using Config = zypp::proto::Capabilities
 
using TimePoint = std::chrono::time_point< std::chrono::steady_clock >
 

Public Member Functions

 ProvideQueue (ProvidePrivate &parent)
 
 ~ProvideQueue ()
 
bool startup (const std::string &workerScheme, const zypp::Pathname &workDir, const std::string &hostname="")
 
void enqueue (ProvideRequestRef request)
 
void cancel (ProvideRequest *item, std::exception_ptr error)
 
void detach (const std::string &id)
 
void scheduleNext ()
 
bool canScheduleMore () const
 
bool empty () const
 
bool isIdle () const
 
std::optional< TimePointidleSince () const
 
uint requestCount () const
 
uint activeRequests () const
 
zypp::ByteCount expectedProvideSize () const
 
const std::string & hostname () const
 
const ConfigworkerConfig () const
 
SignalProxy< void()> sigIdle ()
 

Static Public Attributes

static constexpr uint32_t InvalidId = (uint32_t) -1
 

Private Member Functions

bool doStartup ()
 
void processMessage ()
 
void readAllStderr ()
 
void forwardToLog (std::string &&logLine)
 
void processReadyRead (int channel)
 
void procFinished (int exitCode)
 
uint32_t nextRequestId ()
 
std::list< ProvideQueue::Item >::iterator dequeueActive (std::list< Item >::iterator it)
 
void fatalWorkerError (const std::exception_ptr &reason=nullptr)
 
void immediateShutdown (const std::exception_ptr &reason)
 
std::list< ProvideQueue::Item >::iterator cancelActiveItem (std::list< Item >::iterator i, const std::exception_ptr &error)
 

Private Attributes

bool _queueShuttingDown = false
 
uint8_t _crashCounter = 0
 
Config _capabilities
 
zypp::Pathname _currentExe
 
std::string _myHostname
 
ProvidePrivate_parent
 
std::deque< Item_waitQueue
 
std::list< Item_activeItems
 
Process::Ptr _workerProc
 
RpcMessageStreamPtr _messageStream
 
Signal< void()> _sigIdle
 
std::optional< TimePoint_idleSince
 

Friends

struct ProvideResourceData
 

Detailed Description

Definition at line 32 of file providequeue_p.h.

Member Typedef Documentation

◆ Config

using zyppng::ProvideQueue::Config = zypp::proto::Capabilities

Definition at line 38 of file providequeue_p.h.

◆ TimePoint

using zyppng::ProvideQueue::TimePoint = std::chrono::time_point<std::chrono::steady_clock>

Definition at line 40 of file providequeue_p.h.

Constructor & Destructor Documentation

◆ ProvideQueue()

zyppng::ProvideQueue::ProvideQueue ( ProvidePrivate parent)

Definition at line 44 of file providequeue.cc.

◆ ~ProvideQueue()

zyppng::ProvideQueue::~ProvideQueue ( )

Definition at line 47 of file providequeue.cc.

Member Function Documentation

◆ startup()

bool zyppng::ProvideQueue::startup ( const std::string &  workerScheme,
const zypp::Pathname workDir,
const std::string &  hostname = "" 
)

Definition at line 57 of file providequeue.cc.

◆ enqueue()

void zyppng::ProvideQueue::enqueue ( ProvideRequestRef  request)

Definition at line 92 of file providequeue.cc.

◆ cancel()

void zyppng::ProvideQueue::cancel ( ProvideRequest item,
std::exception_ptr  error 
)

Definition at line 103 of file providequeue.cc.

◆ detach()

void zyppng::ProvideQueue::detach ( const std::string &  id)

◆ scheduleNext()

void zyppng::ProvideQueue::scheduleNext ( )

Definition at line 209 of file providequeue.cc.

◆ canScheduleMore()

bool zyppng::ProvideQueue::canScheduleMore ( ) const

Definition at line 245 of file providequeue.cc.

◆ empty()

bool zyppng::ProvideQueue::empty ( ) const

Definition at line 260 of file providequeue.cc.

◆ isIdle()

bool zyppng::ProvideQueue::isIdle ( ) const

Check if the queue is currently idle

Definition at line 250 of file providequeue.cc.

◆ idleSince()

std::optional< ProvideQueue::TimePoint > zyppng::ProvideQueue::idleSince ( ) const

Time point since the queue started to be idle

Definition at line 255 of file providequeue.cc.

◆ requestCount()

uint zyppng::ProvideQueue::requestCount ( ) const

How many items does this queue currently have

Definition at line 265 of file providequeue.cc.

◆ activeRequests()

uint zyppng::ProvideQueue::activeRequests ( ) const

How many active items does this queue currently have

Definition at line 270 of file providequeue.cc.

◆ expectedProvideSize()

zypp::ByteCount zyppng::ProvideQueue::expectedProvideSize ( ) const

How much bytes does this queue has to download / process, for pending requests this is only set if the ProvideSpec has a expected download size set.

Definition at line 275 of file providequeue.cc.

◆ hostname()

const std::string & zyppng::ProvideQueue::hostname ( ) const

Returns the hostname this worker belongs to. If the worker was not associated with a hostname this will return a empty string.

Definition at line 298 of file providequeue.cc.

◆ workerConfig()

const ProvideQueue::Config & zyppng::ProvideQueue::workerConfig ( ) const

Definition at line 303 of file providequeue.cc.

◆ sigIdle()

SignalProxy< void()> zyppng::ProvideQueue::sigIdle ( )

Definition at line 308 of file providequeue.cc.

◆ doStartup()

bool zyppng::ProvideQueue::doStartup ( )
private

Definition at line 313 of file providequeue.cc.

◆ processMessage()

void zyppng::ProvideQueue::processMessage ( )
private

Definition at line 383 of file providequeue.cc.

◆ readAllStderr()

void zyppng::ProvideQueue::readAllStderr ( )
private

Reads all of the log lines from stderr, call only when shutting down the queue because this will also read partial lines and forwards them

Definition at line 706 of file providequeue.cc.

◆ forwardToLog()

void zyppng::ProvideQueue::forwardToLog ( std::string &&  logLine)
private

Definition at line 716 of file providequeue.cc.

◆ processReadyRead()

void zyppng::ProvideQueue::processReadyRead ( int  channel)
private

Definition at line 724 of file providequeue.cc.

◆ procFinished()

void zyppng::ProvideQueue::procFinished ( int  exitCode)
private

Definition at line 740 of file providequeue.cc.

◆ nextRequestId()

uint32_t zyppng::ProvideQueue::nextRequestId ( )
private

Definition at line 772 of file providequeue.cc.

◆ dequeueActive()

std::list< ProvideQueue::Item >::iterator zyppng::ProvideQueue::dequeueActive ( std::list< Item >::iterator  it)
private

Dequeues the request referenced by it. Returns a iterator to the next element in the active list

Definition at line 132 of file providequeue.cc.

◆ fatalWorkerError()

void zyppng::ProvideQueue::fatalWorkerError ( const std::exception_ptr &  reason = nullptr)
private

Definition at line 146 of file providequeue.cc.

◆ immediateShutdown()

void zyppng::ProvideQueue::immediateShutdown ( const std::exception_ptr &  reason)
private

Definition at line 151 of file providequeue.cc.

◆ cancelActiveItem()

std::list< ProvideQueue::Item >::iterator zyppng::ProvideQueue::cancelActiveItem ( std::list< Item >::iterator  i,
const std::exception_ptr &  error 
)
private

Cancels the item the iterator i is pointing to, advancing the iterator to the next element in the list

Definition at line 180 of file providequeue.cc.

Friends And Related Function Documentation

◆ ProvideResourceData

friend struct ProvideResourceData
friend

Definition at line 35 of file providequeue_p.h.

Member Data Documentation

◆ InvalidId

constexpr uint32_t zyppng::ProvideQueue::InvalidId = (uint32_t) -1
staticconstexpr

Definition at line 37 of file providequeue_p.h.

◆ _queueShuttingDown

bool zyppng::ProvideQueue::_queueShuttingDown = false
private

Definition at line 129 of file providequeue_p.h.

◆ _crashCounter

uint8_t zyppng::ProvideQueue::_crashCounter = 0
private

Definition at line 130 of file providequeue_p.h.

◆ _capabilities

Config zyppng::ProvideQueue::_capabilities
private

Definition at line 131 of file providequeue_p.h.

◆ _currentExe

zypp::Pathname zyppng::ProvideQueue::_currentExe
private

Definition at line 132 of file providequeue_p.h.

◆ _myHostname

std::string zyppng::ProvideQueue::_myHostname
private

Definition at line 133 of file providequeue_p.h.

◆ _parent

ProvidePrivate& zyppng::ProvideQueue::_parent
private

Definition at line 134 of file providequeue_p.h.

◆ _waitQueue

std::deque< Item > zyppng::ProvideQueue::_waitQueue
private

Definition at line 135 of file providequeue_p.h.

◆ _activeItems

std::list< Item > zyppng::ProvideQueue::_activeItems
private

Definition at line 136 of file providequeue_p.h.

◆ _workerProc

Process::Ptr zyppng::ProvideQueue::_workerProc
private

Definition at line 137 of file providequeue_p.h.

◆ _messageStream

RpcMessageStreamPtr zyppng::ProvideQueue::_messageStream
private

Definition at line 138 of file providequeue_p.h.

◆ _sigIdle

Signal<void()> zyppng::ProvideQueue::_sigIdle
private

Definition at line 139 of file providequeue_p.h.

◆ _idleSince

std::optional<TimePoint> zyppng::ProvideQueue::_idleSince
private

Definition at line 140 of file providequeue_p.h.


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