C++17/20 interface

Daggy Core C++ interface

The Core object interface

Description

The Core class is a QObject. It aggregates all streams from providers into once Core Streams Session.

The Core class is a main class of Daggy Core library and can be included by:

#include <DaggyCore/Core.hpp>

Constructor

Core(Sources sources,
     QObject* parent = nullptr);
Core(QString session,
     Sources sources,
     QObject* parent = nullptr);

Session is id for Core Streams Session. If no session was passed to constructor - new session id will generate (in uuid format).

Sources is required parameter. It contains provider commands for streaming:

namespace daggy {
namespace sources {
namespace commands {
namespace streams {
struct Meta {
    QString session;
    std::chrono::time_point<std::chrono::system_clock> start_time;
    QString extension;
    DaggyStreamTypes type;

    std::uint64_t seq_num;
    std::chrono::time_point<std::chrono::system_clock> time;
};
}

struct Stream {
    streams::Meta meta;
    QByteArray part;
};

struct DAGGYCORE_EXPORT Properties {
    QString extension;
    QString exec;
    QVariantMap parameters = {};
    bool restart = false;

    bool operator==(const Properties& other) const;
};
}

using Commands = QMap<QString, commands::Properties>;
using Command = QPair<QString, commands::Properties>;

struct DAGGYCORE_EXPORT Properties {
    QString type;
    QString host;
    Commands commands;
    bool reconnect = false;
    QVariantMap parameters = {};

    bool operator==(const Properties& other) const;
};
}

using Sources = QMap<QString, sources::Properties>;
using Source = QPair<QString, sources::Properties>;
}

Properties of sources is described here

Prepare and extend supported providers

Before Daggy Core start, need to prepare providers. If you need to extend provider types, that not out of box from Daggy Core lib (local and ssh2), you can create own providers fabric:

Own fabric instances need to pass in prepare method.

Connect aggregators

Before Daggy Core start, you can add aggregators.

Out of box Daggy Core Aggregators

There are three types of aggregators, that already described:

User defined aggregator

User can create own aggregator by implementation of IAggregator interface:

Start and stop Core

After start is called, Core changed state by the next state machine logic:

Daggy Core states

Finished state reached by calling stop method, or after all providers are finished.

Streams viewing

Usage Example

Last updated

Was this helpful?