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
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (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 GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with Classified Ads; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 
22 
23 #ifndef PUBLISHING_ENG_H
24 #define PUBLISHING_ENG_H
25 
26 #include <QHostAddress>
27 #include <QPair>
28 #include "connection.h" // for ConnectionObserver
29 #include "../controller.h"
30 #include "../datamodel/model.h"
31 
41 class PublishingEngine : public QTimer {
42  Q_OBJECT
43 public:
49  PublishingEngine(Controller* aController,
50  Model& aModel ) ;
55 signals:
56  void error(QTcpSocket::SocketError socketError);
57 public slots:
63  const Hash aHashOfAttemptedNode );
67  void run();
68 private:
69  void emptyNodeCandidateList() ;
74  } ;
76  void publishToNode(const Hash& aNode) ;
79 public:
81  bool iNeedsToRun ;
82 private: // data
87  QList<Node *> iNodeCandidatesToTryPush ;
91  bool iNowRunning ;
92 } ;
93 #endif
Class for keeping app state.
Definition: controller.h:83
Model & iModel
Definition: publishingengine.h:84
QList< Hash > iNodesFailurefullyConnected
Definition: publishingengine.h:89
bool iNeedsToRun
Definition: publishingengine.h:81
Hash is class that carries 160-bit digest.
Definition: hash.h:38
StageOfPublish iStageOfPublish
Definition: publishingengine.h:90
ConnectionState
Definition: connection.h:47
QList< Node * > iNodeCandidatesToTryPush
Definition: publishingengine.h:87
void nodeConnectionAttemptStatus(Connection::ConnectionState aStatus, const Hash aHashOfAttemptedNode)
bool iNowRunning
Definition: publishingengine.h:91
void error(QTcpSocket::SocketError socketError)
void sendPublishItemToAlreadyConnectedNodes()
StageOfPublish
Definition: publishingengine.h:71
void emptyNodeCandidateList()
M of the MVC pattern. Handles permanent storage.
Definition: model.h:50
PublishItem iWorkItem
Definition: publishingengine.h:85
void publishToNode(const Hash &aNode)
Definition: publishingengine.h:73
void askConnectionsForNodesOnPublishList()
QList< Hash > iNodesSuccessfullyConnected
Definition: publishingengine.h:88
Network-connection logic relating content publish demands.
Definition: publishingengine.h:41
void checkForSuccessfullyConnectedNodes()
Carrier for keeping state of item about to be published.
Definition: protocol.h:206
void checkForUnSuccessfullyConnectedNodes()
Controller * iController
Definition: publishingengine.h:83
Definition: publishingengine.h:72
PublishingEngine(Controller *aController, Model &aModel)