Classified ads
publishingengine.h
Go to the documentation of this file.
1 /* -*-C++-*- -*-coding: utf-8-unix;-*-
2  Classified Ads is Copyright (c) Antti Järvinen 2013.
3 
4  This file is part of Classified Ads.
5 
6  Classified Ads is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Classified Ads is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Classified Ads. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 
21 
22 #ifndef PUBLISHING_ENG_H
23 #define PUBLISHING_ENG_H
24 
25 #include <QHostAddress>
26 #include <QPair>
27 #include "connection.h" // for ConnectionObserver
28 #include "../controller.h"
29 #include "../datamodel/model.h"
30 
40 class PublishingEngine : public QTimer {
41  Q_OBJECT
42 public:
48  PublishingEngine(Controller* aController,
49  Model& aModel ) ;
54 signals:
55  void error(QTcpSocket::SocketError socketError);
56 public slots:
62  const Hash aHashOfAttemptedNode );
66  void run();
67 private:
68  void emptyNodeCandidateList() ;
73  } ;
75  void publishToNode(const Hash& aNode) ;
78 public:
80  bool iNeedsToRun ;
81 private: // data
86  QList<Node *> iNodeCandidatesToTryPush ;
90  bool iNowRunning ;
91 } ;
92 #endif
Class for keeping app state.
Definition: controller.h:42
Model & iModel
Definition: publishingengine.h:83
QList< Hash > iNodesFailurefullyConnected
Definition: publishingengine.h:88
bool iNeedsToRun
Definition: publishingengine.h:80
Hash is class that carries 160-bit digest.
Definition: hash.h:37
StageOfPublish iStageOfPublish
Definition: publishingengine.h:89
ConnectionState
Definition: connection.h:45
QList< Node * > iNodeCandidatesToTryPush
Definition: publishingengine.h:86
void nodeConnectionAttemptStatus(Connection::ConnectionState aStatus, const Hash aHashOfAttemptedNode)
bool iNowRunning
Definition: publishingengine.h:90
void error(QTcpSocket::SocketError socketError)
void sendPublishItemToAlreadyConnectedNodes()
StageOfPublish
Definition: publishingengine.h:70
void emptyNodeCandidateList()
M of the MVC pattern. Handles permanent storage.
Definition: model.h:47
PublishItem iWorkItem
Definition: publishingengine.h:84
void publishToNode(const Hash &aNode)
Definition: publishingengine.h:72
void askConnectionsForNodesOnPublishList()
QList< Hash > iNodesSuccessfullyConnected
Definition: publishingengine.h:87
Network-connection logic relating content publish demands.
Definition: publishingengine.h:40
void checkForSuccessfullyConnectedNodes()
Carrier for keeping state of item about to be published.
Definition: protocol.h:168
void checkForUnSuccessfullyConnectedNodes()
Controller * iController
Definition: publishingengine.h:82
Definition: publishingengine.h:71
PublishingEngine(Controller *aController, Model &aModel)