MoleQueue 0.9.0
Loading...
Searching...
No Matches
Server Class Reference

#include <server.h>

Inheritance diagram for Server:

Public Slots

void start ()
void forceStart ()
void stop (bool force)
void stop ()
void dispatchJobStateChange (const MoleQueue::Job &job, MoleQueue::JobState oldState, MoleQueue::JobState newState)

Signals

void connectionError (MoleQueue::ConnectionListener::Error error, const QString &message)

Public Member Functions

 Server (QObject *parentObject=0, QString serverName_="MoleQueue")
 ~Server ()
JobManagerjobManager ()
const JobManagerjobManager () const
QueueManagerqueueManager ()
const QueueManagerqueueManager () const
void readSettings (QSettings &settings)
void writeSettings (QSettings &settings) const
QString workingDirectoryBase () const
QString serverName () const

Protected Slots

void jobAboutToBeAdded (MoleQueue::Job job)
void newConnectionAvailable (MoleQueue::Connection *connection)
void clientDisconnected ()
void handleMessage (const MoleQueue::Message &message)

Protected Member Functions

void timerEvent (QTimerEvent *)

Protected Attributes

QList< Connection * > m_connections
JobManagerm_jobManager
QueueManagerm_queueManager
JsonRpcm_jsonrpc
QString m_workingDirectoryBase
IdType m_moleQueueIdCounter
QMap< IdType, Connection * > m_connectionLUT
QMap< IdType, EndpointIdType > m_endpointLUT

Detailed Description

The Server class handles incoming JSON-RPC messages.

Author
David C. Lonie

The Server class is the root of the server-side heirarchy. It owns the JobManager, QueueManager, and JsonRpc listener.

Constructor & Destructor Documentation

◆ Server()

Server ( QObject * parentObject = 0,
QString serverName_ = "MoleQueue" )
explicit

Constructor.

Parameters
parentObjectThe parent.

◆ ~Server()

~Server ( )

Destructor.

Member Function Documentation

◆ jobManager() [1/2]

JobManager * jobManager ( )
Returns
A pointer to the Server JobManager.

◆ jobManager() [2/2]

const JobManager * jobManager ( ) const
Returns
A pointer to the Server JobManager.

◆ queueManager() [1/2]

QueueManager * queueManager ( )
Returns
A pointer to the Server QueueManager.

◆ queueManager() [2/2]

const QueueManager * queueManager ( ) const
Returns
A pointer to the Server QueueManager.

◆ readSettings()

void readSettings ( QSettings & settings)
Parameters
settingsQSettings object to write state to.

◆ writeSettings()

void writeSettings ( QSettings & settings) const
Parameters
settingsQSettings object to read state from.

◆ workingDirectoryBase()

QString workingDirectoryBase ( ) const

The working directory where running job file are kept.

◆ serverName()

QString serverName ( ) const

The string the server uses to listen for connections.

◆ connectionError

void connectionError ( MoleQueue::ConnectionListener::Error error,
const QString & message )
signal

Emitted when a connection listener fails to start.

◆ start

void start ( )
slot

Start listening for incoming connections.

If an error occurs, connectionError will be emitted. If an AddressInUseError occurs on Unix due to a crashed Server that failed to clean up, call forceStart to remove any existing sockets.

◆ forceStart

void forceStart ( )
slot

Start listening for incoming connections, removing any existing socket handles first.

◆ stop [1/2]

void stop ( bool force)
slot

Terminate the socket server.

Parameters
Serverwill pass the value of force when stop it connections.

◆ stop [2/2]

void stop ( )
slot

Terminate the socket server.

Same as stop(false)

◆ dispatchJobStateChange

void dispatchJobStateChange ( const MoleQueue::Job & job,
MoleQueue::JobState oldState,
MoleQueue::JobState newState )
slot

Find the client that owns job and send a notification to the client that the JobState has changed.

Parameters
jobJob of interest.
oldStatePrevious state of job.
newStateNew state of job.

◆ jobAboutToBeAdded

void jobAboutToBeAdded ( MoleQueue::Job job)
protectedslot

Set the MoleQueue Id of a job before it is added to the manager.

Parameters
jobThe new Job.

◆ newConnectionAvailable

void newConnectionAvailable ( MoleQueue::Connection * connection)
protectedslot

Called when the internal socket server has a new connection ready.

◆ clientDisconnected

void clientDisconnected ( )
protectedslot

Called when a client disconnects from the server. This function expects sender() to return a ServerConnection.

◆ handleMessage

void handleMessage ( const MoleQueue::Message & message)
protectedslot

handleMessage Called when the JsonRpc listener receives a message.

◆ timerEvent()

void timerEvent ( QTimerEvent * )
protected

timerEvent Reimplemented from QObject.

Member Data Documentation

◆ m_connections

QList<Connection*> m_connections
protected

List of active connections.

◆ m_jobManager

JobManager* m_jobManager
protected

The JobManager for this Server.

◆ m_queueManager

QueueManager* m_queueManager
protected

The QueueManager for this Server.

◆ m_jsonrpc

JsonRpc* m_jsonrpc
protected

The JsonRpc listener for this Server.

◆ m_workingDirectoryBase

QString m_workingDirectoryBase
protected

Local directory for running jobs.

◆ m_moleQueueIdCounter

IdType m_moleQueueIdCounter
protected

Counter for MoleQueue job ids.


The documentation for this class was generated from the following file: