Remoto - VFS: VFS_threadpool.h Source File
Remoto - VFS
VFS_threadpool.h
Go to the documentation of this file.
1 #ifndef VFS_THREADPOOL_H
2 #define VFS_THREADPOOL_H
3 
4 #include <QDomDocument>
5 
6 #include "VFS.h"
7 #include "VFS_node.h"
8 
9 class VFS_threadpool : public VFS_node
10 {
11  Q_OBJECT
12 
13  public:
16  enum mode
17  {
18  roundrobin = 0,
19  available
20  };
21 
22  static const QStringList modeStrings;
23 
24  Q_INVOKABLE explicit VFS_threadpool(uint count, VFS_threadpool::mode mode, QDomElement nodeConfig, QVariantMap env, bool printConfig=false);
25  virtual ~VFS_threadpool() override;
26 
27  //static VFS_threadpool *fromConfig(QString configString, QVariantMap env=QVariantMap(), bool printConfig=false);
28 
29  virtual VFS_node *find(VFS_request *r) override;
30 
31  virtual bool isContainer() override;
32 
33  protected:
34  uint _count;
35  uint _index;
37 
38  private:
39 
40  signals:
41 
42  public slots:
43  virtual void subtreeRequest(VFS_request *t) override;
44  virtual void executeRequest(VFS_request *t) override;
45 };
46 
47 #endif // VFS_THREADPOOL_H
VFS_node is the base class from which all other VFS_node classes derive.
Definition: VFS_node.h:143
The base class for all requests between nodes.
Definition: VFS_node.h:54
A wrapper for replicating nodes in different threads to produce more responsive workers in multithrea...
virtual void subtreeRequest(VFS_request *t) override
A dummy entry to override VFS_node::subtreeRequest()
Q_INVOKABLE VFS_threadpool(uint count, VFS_threadpool::mode mode, QDomElement nodeConfig, QVariantMap env, bool printConfig=false)
VFS_threadpool constructor.
VFS_threadpool::mode _mode
The distribution mode.
static const QStringList modeStrings
string names of each mode for the config file
mode
A pool will distribute requests based on a mode.
@ available
available mode will use the child with the fewest outstanding requests
@ roundrobin
roundrobin mode will cycle through children
uint _index
The current index for roundrobin requests.
virtual VFS_node * find(VFS_request *r) override
Distribute requests to children based on _mode.
virtual void executeRequest(VFS_request *t) override
A dummy entry to override VFS_node::executeRequest()
virtual bool isContainer() override
A threadpool is always a container.
virtual ~VFS_threadpool() override
VFS_threadpool destructor.
uint _count
The replication count.