4 #include <QCoreApplication>
55 VFS::LOG( QString(
" -Creating thread pool '%1:%2'").arg(nodeConfig.tagName()).arg(nodeConfig.attribute(
"name")), 9 );
57 QString nameTemplate = QString(
"%1:%2").arg(nodeConfig.attribute(
"name"));
62 for (uint i=0;i<
_count;i++)
64 name = nameTemplate.arg(i);
65 nodeConfig.setAttribute(
"name",name);
105 QMutexLocker l(&
_lock);
144 VFS::ERROR(
"threadpool::subtreeRequest should never be called. You have a bug in your code.");
160 VFS::ERROR(
"threadpool::executeRequest should never be called. You have a bug in your code.");
VFS_node is the base class from which all other VFS_node classes derive.
virtual VFS_node * append(QString name, VFS_node *node, bool containerCheck=true, QString user="server")
Append a VFS_node as a child of this node.
VFS_children _children
This node's children.
VFS_node * find(QString path)
Find a node by string path.
QMutex _lock
A recursive mutex that is local to this node.
The base class for all requests between nodes.
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.
static void LOG(QString message, int level=0, QString user="server")
Send a message to the VFS::_messages VFS_stream.
static void ERROR(QString message, int level=0, QString user="server")
Send a message to the VFS::_errors VFS_stream.