libzypp 17.37.17
asyncdatasource.h
Go to the documentation of this file.
1#ifndef ASYNCDATASOURCE_H
2#define ASYNCDATASOURCE_H
3
4#include <zypp-core/zyppng/base/Base>
5#include <zypp-core/zyppng/io/IODevice>
6
7namespace zyppng {
8
10
12 {
14 public:
15
17 RemoteClose, // the other side of the fd was closed
18 AccessError, // we got an EACCESS when polling the fd
19 InternalError, // we got a unexpected errno when polling the fd
20 UserRequest // channel were closed because close() was called
21 };
22
23 using Ptr = std::shared_ptr<AsyncDataSource>;
24 using WeakPtr = std::weak_ptr<AsyncDataSource>;
25
26 static Ptr create ();
27
33 bool openFds ( const std::vector<int>& readFds, int writeFd = -1 );
34
39 void close () override;
40
42
43 virtual void closeWriteChannel ();
44
51 bool waitForReadyRead(uint channel, int timeout) override;
52
59 void flush ();
60
67
74
78 bool readFdOpen () const;
79
83 bool readFdOpen ( uint channel ) const;
84
88 int64_t bytesPending() const override;
89
90 protected:
93 int64_t writeData(const char *data, int64_t count) override;
94
95 private:
96 using IODevice::open;
97
98 int64_t readData( uint channel, char *buffer, int64_t bufsize ) override;
99 int64_t rawBytesAvailable( uint channel ) const override;
100 void readChannelChanged ( uint channel ) override;
101 };
102}
103
104
105#endif // ASYNCDATASOURCE_H
int64_t writeData(const char *data, int64_t count) override
SignalProxy< void(uint, AsyncDataSource::ChannelCloseReason)> sigReadFdClosed()
int64_t bytesPending() const override
void readChannelChanged(uint channel) override
bool waitForReadyRead(uint channel, int timeout) override
std::weak_ptr< AsyncDataSource > WeakPtr
bool openFds(const std::vector< int > &readFds, int writeFd=-1)
int64_t readData(uint channel, char *buffer, int64_t bufsize) override
std::shared_ptr< AsyncDataSource > Ptr
SignalProxy< void(AsyncDataSource::ChannelCloseReason)> sigWriteFdClosed()
int64_t rawBytesAvailable(uint channel) const override
bool waitForReadyRead(int timeout)
Definition iodevice.cc:359
virtual bool open(const OpenMode mode)
Definition iodevice.cc:16
#define ZYPP_DECLARE_PRIVATE(Class)
Definition zyppglobal.h:87