Heart 1.4.984.b4712811
Heart is base back end library for your c++ Qt projects.
Loading...
Searching...
No Matches
bigdataparser.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021-2027 QuasarApp.
3 * Distributed under the lgplv3 software license, see the accompanying
4 * Everyone is permitted to copy and distribute verbatim copies
5 * of this license document, but changing it is not allowed.
6*/
7
8
9#ifndef BIGDATAPARSER_H
10#define BIGDATAPARSER_H
11
12#include <iparser.h>
13
14
15namespace QH {
16
17namespace PKG {
18class BigDataHeader;
19class BigDataPart;
20class BigDataRequest;
21class BigDataWrapper;
22}
23
24class AbstractNode;
26
27struct PoolData {
28 QSharedPointer<PKG::BigDataHeader> header;
29 QVector<QSharedPointer<PKG::BigDataPart>> chaindata;
30 int lastUpdate = time(0);
31};
32
37{
38public:
39 BigDataParser(AbstractNode* parentNode);
40
41 ParserResult parsePackage(const QSharedPointer<PKG::AbstractData> &pkg,
42 const Header &pkgHeader,
43 AbstractNodeInfo *sender) override;
44 int version() const override;
45 QString parserId() const override;
46
47protected:
48
56 bool newPackage(const QSharedPointer<PKG::BigDataHeader> &header,
57 AbstractNodeInfo * sender,
58 const Header & pkgHeader);
59
67 bool processPart(const QSharedPointer<PKG::BigDataPart>& part,
68 AbstractNodeInfo *sender,
69 const QH::Header &pkgHeader);
70
78 bool processRequest(const QSharedPointer<PKG::BigDataRequest>& request,
80 const QH::Header &pkgHeader);
81
89 bool processBigDataWrapper(const QSharedPointer<PKG::BigDataWrapper> &request,
90 AbstractNodeInfo *sender,
91 const Header &pkgHeader);
92
93
94private:
95
103 bool sendBigDataPackage(const PKG::AbstractData *data,
104 const QH::AbstractNodeInfo *sender,
105 const Header *pkgHeader);
106
107 void insertNewBigData(const QSharedPointer<PKG::BigDataHeader> &header);
108 void checkOutDatedPackages(unsigned int currentProcessedId);
109
110 QHash<int, PoolData> _pool;
111
112};
113}
114#endif // BIGDATAPARSER_H
The AbstractNodeInfo class contains information about client or server connection and tcp socket of n...
The AbstractNode class - Abstract implementation of node. this implementation have a methods for send...
bool processBigDataWrapper(const QSharedPointer< PKG::BigDataWrapper > &request, AbstractNodeInfo *sender, const Header &pkgHeader)
sendBigDataPackage This method separate big package and sent only header to server.
QString parserId() const override
parserId This is id of the parsers. All parser will be synced betwin nodes by ids.
ParserResult parsePackage(const QSharedPointer< PKG::AbstractData > &pkg, const Header &pkgHeader, AbstractNodeInfo *sender) override
parsePackage This is main method of all children classes of an AbstractNode class....
bool processPart(const QSharedPointer< PKG::BigDataPart > &part, AbstractNodeInfo *sender, const QH::Header &pkgHeader)
processPart This method process part of package
bool processRequest(const QSharedPointer< PKG::BigDataRequest > &request, QH::AbstractNodeInfo *sender, const QH::Header &pkgHeader)
finishPart This metho process last package of big data transaction.
BigDataParser(AbstractNode *parentNode)
int version() const override
version This method return version of parser object
bool newPackage(const QSharedPointer< PKG::BigDataHeader > &header, AbstractNodeInfo *sender, const Header &pkgHeader)
newPackage This method process first header package of the big data.
The AbstractData class is provide base functions for transport data by network For create you own pac...
The BigDataHeader class is first empty package with information of big data package.
The BigDataPart class This data class used for transporting big data files greater than 64kb.
Definition bigdatapart.h:22
The BigDataRequest class contains missing package parts for redownload. If missing parts count is 0 t...
The BigDataWrapper class is wrapper of any big data commands.
iParser(AbstractNode *parentNode)
Definition iparser.cpp:17
friend class AbstractNode
Definition iparser.h:266
The PKG namespace - this namespace contains all default packages of the Heart library....
Definition heart.h:211
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13
ParserResult
The ParserResult enum. Error - parser detect a errorob package. NotProcessed - the parser does not kn...
Definition iparser.h:35
The Header struct 32 bytes.
Definition header.h:19
QSharedPointer< PKG::BigDataHeader > header
QVector< QSharedPointer< PKG::BigDataPart > > chaindata