Jobs

In order to talk to a remote server, the library implements a job based system. All jobs ultimately derive from the SynqClient::AbstractJob class. There are several classes which directly derive from this class. These classes model the available functions the library provides to talk with a server, like up- and downloading files, listing a remote directory and so on.

Abstract Job Interface

These jobs are all abstract in the sense that they only describe a generic interface.

AbstractJob

class AbstractJob : public QObject

Base class for all jobs.

This class is the base class for all of the jobs provided by the library. On its own, it provides only minimal functionality. Its main purpose is to provide a suitable interface for all concrete jobs and defining the behaviour of jobs.

Job Life Cycle

Jobs have a well defined sequence of states they run through during their usage. The current state is returned by calling the state() method. After creating an instance of a job class, it is in the JobState::Ready state. In this state, the job should be set up, i.e. essential properties need to be set (e.g. for an upload job, we need to supply the data to be uploaded as well as the target path where to upload data to).

After the job has been set up, the start() method is called to proceed. This will bring the job into the JobState::Running state. Note that the start() method returns immediately. Also note that even if errors are already detected when calling start(), the job still first transitions to the JobState::Running state and only transitions further as soon as control goes back to the event loop.

Eventually, the finished() signal will be emitted and the job transitions to the JobState::Finished state.

Note that a job object must not be reused. Once it ran through this sequence, it has to be deleted.

A running job can be terminated by calling the stop() method: This will abort running transfers and also eventually cause the finished() signal to be emitted.

Error Handling

Jobs use the error() method to provide information about their condition. If during execution of a job everything works well, this will be set to JobError::NoError. However, if something unusual happens, the error is set accordingly. After a job finished, always check the error() to see if everything worked.

Depending on the concrete job, errors might not be fatal. For example, a job which creates a remote folder might terminate with the JobError::FolderExists code, which indicates that the remote folder already exists.

In particular, if a job is stopped by calling the stop() method, it will have an error of JobError::Stopped.

Subclassed by SynqClient::CompositeJob, SynqClient::CreateDirectoryJob, SynqClient::DeleteJob, SynqClient::DownloadFileJob, SynqClient::GetFileInfoJob, SynqClient::ListFilesJob, SynqClient::UploadFileJob

Public Functions

explicit AbstractJob(QObject *parent = nullptr)

Constructor.

~AbstractJob() override

Destructor.

virtual void start() = 0

Start the job.

This method is used to start the job after it has been set up. This must only be called when the job is in the JobState::Ready state. Calling this method will cause the job to transition to JobState::Running. Eventually, finished() will be emitted to indicate the job finished. Check the error() to learn if the job succeeded or not.

Calling this method while the job is in any other state is undefined behavior.

virtual void stop() = 0

Stop a running job.

If this is called while the job is in the JobState::Running state, the job will eventually be stopped and the finished() signal be emitted. A job which has been terminated like that will have an error() of JobError::Stopped.

Calling this method while the job is in any other state has no effect.

JobError error() const

Get the error code of the job.

This returns a value indicating if the job had an error during execution.

QString errorString() const

A textual representation of the error the job encountered.

This returns a textual description of the error reason. Depending on the concrete error that occurred, this might hold additional information to understand why the job failed.

JobState state() const

The current state of the job.

int transferTimeout() const

The amount of time after which a job shall be aborted.

This defines a timeout (in milliseconds) after which a job - if no transfer took place - should be aborted. The default is to use QNetworkRequest::DefaultTransferTimeoutConstant.

Note that not all concrete jobs might implement such transfer timeouts. However, implementations that use Qt’s networking code are encouraged to call QNetworkRequest::setTransferTimeout() with this value.

A value of zero for the timeout indicates that the request shall never time out.

To change the timeout, call setTransferTimeout().

void setTransferTimeout(int transferTimeout)

Set the transfer timeout of the job to transferTimeout.

Signals

void finished()

The job has finished.

This signal is emitted once the job transitions to the JobState::Finished state. After this signal is emitted, check the error() to learn if the job succeeded. Afterwards, the job can be deleted.

Note

Do not reuse jobs. For each transaction you want to run, a new job object must be created.

Protected Functions

explicit AbstractJob(AbstractJobPrivate *d, QObject *parent = nullptr)

Constructor.

void setError(JobError error, const QString &errorString)

Mark the job as failed.

This sets the error and errorString of the job. Concrete subclasses shall use this to mark the job as failed if they encounter an error during execution.

void setState(JobState state)

Set the job state.

This sets the state of the job to the specified value. This method shall be used by concrete subclasses to progress the job through the usual lifecycle.

void finishLater()

Emit the finished signal once control returns to the event loop.

This method can be used to emit the finished signal once control returns to the event loop. Sub-classes shall use this method to emit the finished() signal later. Usually, this can be called in the start() implementation when doing error checking:

void MyJob::start()
{
    if (checkForJobParameters()) {
        startProcessThread();
    } else {
        setError(JobError::MissingParameter, "The job is missing some parameter(s)");
        finishLater();
    }
}

It is important to not emit the finished signal directly in the start() method as otherwise code interfacing would need to check twice for whether the job finished (directly after calling start as well as when the job really finished).

Protected Static Functions

static JobError fromNetworkError(const QNetworkReply &reply)

Map network errors to job errors.

This utility method checks the network reply and maps its error code to a JobError. It can be used by jobs using Qt’s QNetworkAccessManager API to map Qt’s errors consistently to job errors.

GetFileInfoJob

class GetFileInfoJob : public SynqClient::AbstractJob

Get information about a remote file or folder.

This class is an abstract base class for jobs which retrieve information about remote files or folders. The job is configured with a path to a remote file or folder. Running it will cause the job to retrieve meta information about the remote file. Once the job succeeded, you can query the information by using the fileInfo() method.

Subclassed by SynqClient::DropboxGetFileInfoJob, SynqClient::WebDAVGetFileInfoJob

Public Functions

explicit GetFileInfoJob(QObject *parent = nullptr)

Constructor.

~GetFileInfoJob() override

Destructor.

QString path() const

The path to the remote file or folder to get information for.

void setPath(const QString &path)

Set the path to the remote file or folder to get information for.

FileInfo fileInfo() const

Holds the retrieved information about the remote file.

Protected Functions

explicit GetFileInfoJob(GetFileInfoJobPrivate *d, QObject *parent = nullptr)

Constructor.

void setFileInfo(const FileInfo &fileInfo)

Set file information.

Concrete sub-classes shall use this method to set the file meta information for the remote file or folder if the job succeeds.

ListFilesJob

class ListFilesJob : public SynqClient::AbstractJob

List the contents of a remote folder.

This is an abstract base class for jobs which are used to list the contents of a remote folder. If the job succeeds, it holds a list of entries() (consisting of files and sub-folders) of the remote folder. Additionally, information about the folder itself can be retrieved by using the folder() method.

Note

If the path() configured points to a remote file, the job still should succeed. In this case, information about the file is found in the file information returned by folder() and entries() shall return an empty list. If a concrete implementation does not support this, it shall fail with a JobError::RemoteResourceIsNotAFolder error.

Subclassed by SynqClient::DropboxListFilesJob, SynqClient::WebDAVListFilesJob

Public Functions

explicit ListFilesJob(QObject *parent = nullptr)

Constructor.

~ListFilesJob() override

Destructor.

QString path() const

The path of the folder to list entries for.

void setPath(const QString &path)

Set the path to the folder for which to list entries.

FileInfos entries() const

File information about entries inside the folder.

This property holds the file information list of files and sub-folders contained in the listed folder.

FileInfo folder() const

File info for the folder which has been listed.

This property holds information about the folder that has been listed.

bool recursive() const

Shall files and folders be listed recursively.

If this property is set to true, listing entries within a folder is done recursively. The default is false.

Note

Not all implementations support recursive listing.

void setRecursive(bool recursive)

Set if files and folder shall be listed recursively.

QString cursor() const

A cursor to continue the folder listing later on.

This property holds a cursor - i.e. a token which is backend specific - which allows to query the folder later on for any changes. After listing a specific folder, one can read the cursor and - later on - create a new ListFilesJob object, setting the cursor on it. The new job will then only list changes compared to the last list operation.

Note

Not all implementations support cursors. Refer to the implementation of the concrete class to learn if it has this capability or not. Implementations not supporting cursors usually should return an empty string. Setting an empty string on a job before starting it should have no effect as well.

bool incremental() const

Indicates if the listing is incremental.

If a backend implements cursors for listing files, i.e. they are capable to only list changes since the last time the folder was listed, this property indicates if the listing is an update or - e.g. because the used cursor timed out and the a full listing was done - a full listing.

A value of true indicates that this is an incremental update and the job holds only changes compared to the last listing. A value of false indicates that the listing contains everything.

It is important to check this property, e.g. when searching for remote deletions. An incremental update will report individually deleted files. If a full listing is done, the client needs to keep track of previous listings to detect deletions on its own.

Concrete subclasses shall use setIncremental() to set this property during job execution.

Protected Functions

explicit ListFilesJob(ListFilesJobPrivate *d, QObject *parent = nullptr)

Constructor.

void setEntries(const FileInfos &entries)

Set the file information of entries inside the folder.

Concrete sub-classes shall use this method to set the file information about individual files and sub-folders of the listed folder.

void setFolder(const FileInfo &folder)

Set folder file information.

Concrete sub-classes shall use this method to set the file information of the listed folder.

void setIncremental(bool incremental)

Set if the listing is incremental.

This sets the incremental property of the job. The default value is false. Jobs shall set this to true if the listing is done incrementally.

CreateDirectoryJob

class CreateDirectoryJob : public SynqClient::AbstractJob

Create a remote folder.

This is an abstract base class for jobs which are used to create remote folders. The path to the folder to be created is specified by calling setPath().

Jobs of this type are only supposed to create one folder hierarchy level at a time. A concrete implementation may terminate with an error when you try to create a folder structure recursively. Concrete implementations might implement recursive creation of folders (e.g. if this is inherent to the used backing service). However, when writing generic code, always assume you have to create folders one by one.

Error Handling

Besides the usual errors, the following codes are used to warn about non-fatal errors:

Subclassed by SynqClient::DropboxCreateDirectoryJob, SynqClient::WebDAVCreateDirectoryJob

Public Functions

explicit CreateDirectoryJob(QObject *parent = nullptr)

Constructor.

~CreateDirectoryJob() override

Destructor.

QString path() const

The path of the remote folder to be created.

void setPath(const QString &path)

Set the path to the remote folder to be created.

Protected Functions

explicit CreateDirectoryJob(CreateDirectoryJobPrivate *d, QObject *parent = nullptr)

Constructor.

UploadFileJob

class UploadFileJob : public SynqClient::AbstractJob

Upload a file to a remote server.

This is an abstract base class for jobs that upload a file to a remote server. The job is configured with a path to a remote file. Additionally, some local form of data must be provided. For this, three methods can be used:

Only the one called last will be considered, e.g. if you first use setLocalFilename() to configure a path to a local file and afterwards setData() to set the raw data to upload, then the latter will win.

After a successful upload, information about the remote file can be retrieved using fileInfo(). This is useful to access e.g. sync attributes of a remote file.

Error Handling

Besides the usual error codes, upload jobs use the following errors to warn about non-fatal errors:

Subclassed by SynqClient::DropboxUploadFileJob, SynqClient::WebDAVUploadFileJob

Public Functions

explicit UploadFileJob(QObject *parent = nullptr)

Constructor.

~UploadFileJob() override

Destructor.

QString localFilename() const

The path to a local file to upload.

void setLocalFilename(const QString &localFilename)

Set the path to a local file to be uploaded.

Note

If previously setInput() or setData() have been used, their respecive configured values are discarded.

QIODevice *input() const

The input device to read data from for uploading.

void setInput(QIODevice *input)

Set the input device to read data from.

This sets the input device from which the data to be uplaoded is taken from. Note that this must be a sequential device with a known size.

Note

The job takes ownership of the device. It will be destroyed once the job is destroyed.

Note

If you previously used setLocalFilename() or setData(), their value will be discarded.

QByteArray data() const

The data to be uploaded.

void setData(const QByteArray &data)

Set the data to be uploaded.

Note

If you previously used setLocalFilename() or setInput(), their data will be discarded.

QString remoteFilename() const

The path to the remote file to upload to.

void setRemoteFilename(const QString &remoteFilename)

Set the path to the remote file to upload to.

FileInfo fileInfo() const

Meta information about the file just uploaded.

This returns meta information about the file which has just been uploaded. This can be used e.g. to learn the new sync property after creating or updating a remote file.

QVariant syncAttribute() const

Upload only if the remote and this sync attribute matches.

If this property is set to a valid (i.e. non-null) sync-attribute, the upload should only succeed if the remote current sync attribute matches the one set here. This can be used to prevent lost updates.

See also

FileInfo

Note

The implementation of this is specific to the concrete protocols used. If a protocol does not provide measures to handle conditional uploads, it might be ignored completely.

void setSyncAttribute(const QVariant &syncAttribute)

Set the expected syncAttribute of the remote file.

Protected Functions

explicit UploadFileJob(UploadFileJobPrivate *d, QObject *parent = nullptr)

Constructor.

QSharedPointer<QIODevice> getUploadDevice()

Get the device to use for uploading data.

This returns a shared pointer to a QIODevice used for uploading data. The device is constructed from the set input source. If the input is invalid (e.g. not set, points to a non-existing file, etc), a nullptr is returned and an appropriate error is set.

Note that in case an upload device is used, this will try to seek to the beginning of the input device, so don’t call this method more than once (e.g. once whenever you need access to the upload device). Instead, store it and only call this method another time when you e.g. need to retry an upload.

See also

error()

void setFileInfo(const FileInfo &fileInfo)

Set file meta information.

This method shall be used by classes implementing this job to set the file meta information for the file which has been uploaded.

DownloadFileJob

class DownloadFileJob : public SynqClient::AbstractJob

Download files from a remote server.

This is an abstract base class for jobs downloading files from a remote server. The job is configured with a path to the remote file. Additionally, one can use either setLocalFilename() or setOutput() to configure an output file or device for saving data into. If no output is configured, the downloaded data can be accessed using the data() method.

In addition to downloading the file data, meta information about the remote file can be accessed using fileInfo().

Subclassed by SynqClient::DropboxDownloadFileJob, SynqClient::WebDAVDownloadFileJob

Public Functions

explicit DownloadFileJob(QObject *parent = nullptr)

Constructor.

~DownloadFileJob() override

Destructor.

QString localFilename() const

The path to the local file to store downloaded data in.

void setLocalFilename(const QString &localFilename)

Set the path to the local file to store downloaded data in.

Note

If you previously used setOutput(), the configured device will be discarded.

QIODevice *output() const

The output device to write data to.

void setOutput(QIODevice *output)

Set the device to write received data into.

This sets the output device into which data is written. Note that this class does not take ownershop of the device - it is up to the caller to delete it later (or parent it to the job so it is deleted together with it).

If output is a nullptr, the downloaded data will be buffered and can be accessed using data() after the job succeeded.

QByteArray data() const

Get the data of the file which has been downloaded.

This returns the raw data of the downloaded file.

QString remoteFilename() const

The path to the remote file to be downloaded.

void setRemoteFilename(const QString &remoteFilename)

Set the path to the remote file to be downloaded.

FileInfo fileInfo() const

Meta information about the downloaded file.

After a successful download, this provides meta information about the downloaded file. In particular, this provides the remote sync attribute of the file.

Protected Functions

explicit DownloadFileJob(DownloadFileJobPrivate *d, QObject *parent = nullptr)

Constructor.

QIODevice *getDownloadDevice()

Get a QIODevice to write received data to.

This method returns a QIODevice which can be used to write the received data to. If an output device has been configured, it is returned. Otherwise, depending on if a local file name is set this either returns a QFile instance which can be used to write to the specified file or a QBuffer instance which can be used to write the received data into a buffer in memory. In the latter cases, the returned device is parented to this object. If a valid output device is set, it is returned as-is.

If creating a suitable output device fails, a nullptr is returned and a job error is set.

Note

When using an output device, this method will seek to the beginning of that device before returning it. Hence, buffer the returned value and only call this a second time of e.g. you need to retry the download.

void setFileInfo(const FileInfo &fileInfo)

Set meta information about the remote file.

Concrete sub-classes shall use this method to set file meta information for the remote file after a successful download.

DeleteJob

class DeleteJob : public SynqClient::AbstractJob

Delete remote files or folders.

This class is an abstract base for jobs to delete remote resources. The path() to the remote resource to delete needs to be specified. In addition, a syncAttribute() can be set: In this case, the deletion should - if possible - only be carried out if the remote version of the resource did not change.

If the remote resource is a folder, it is deleted recursively, i.e. all contained files and sub-folders (and their contents in turn) will be removed.

Error Handling

Besides the usual error handling, the following error codes are used to indicate non-fatal errors:

Subclassed by SynqClient::DropboxDeleteJob, SynqClient::WebDAVDeleteJob

Public Functions

explicit DeleteJob(QObject *parent = nullptr)

Constructor.

~DeleteJob() override

Destructor.

QString path() const

The path to the remote file or folder to delete.

void setPath(const QString &path)

Set the path to the remote file or folder to be deleted.

QVariant syncAttribute() const

Delete only if the remote file’s sync attribute matches.

If this property is set to a valid (i.e. non-null) sync attribute, then the request shall only succeed if the remote file’s sync attribute matches the set one.

Note

This might or might not work, depending on the concrete protocol in question. If a backened does not support conditional deletes, this attribute will be ignored.

Warning

This might not work when deleting folders.

void setSyncAttribute(const QVariant &syncAttribute)

Set the syncAttribute we expect on the remote file.

Protected Functions

explicit DeleteJob(DeleteJobPrivate *d, QObject *parent = nullptr)

Constructor.

Additional Type Definitions and Functions

JobError

enum class SynqClient::JobError : quint32

Used to encode the type of error a job had during its execution.

Values:

enumerator NoError

Indicates that no error occurred.

enumerator Stopped

The job has been stopped by the user.

enumerator MissingParameter

Some parameters required to run the job are missing.

enumerator InvalidParameter

Some parameters have values which are invalid.

enumerator InvalidResponse

Received an invalid response during an operation.

enumerator NetworkRequestFailed

A request to a server via the network failed with an error.

enumerator Forbidden

A request has been rejected because the user is not allowed to run it.

enumerator ResourceNotFound

The specified resource was not found on the server.

enumerator ServerContentConflict

The server encountered a content conflict.

enumerator SyncAttributeMismatch

Encountered a lost update during upload.

enumerator FolderExists

The remote folder already exists.

This error is used by jobs creating remote folders. It indicates that the remote folder already exists.

enumerator ServerClosedConnection

The remote unexpectedly closed the connection.

This error indicates that the server closed a network connection in an unexpected way. This can be due to network issues but also be a sign of potential server overload scenarios.

enumerator ResourceDeleted

The remove file or folder has been deleted.

This error is used to indicate that the remote resource which the job worked on has been deleted.

enumerator RemoteResourceIsNotAFolder

The remote path provided to a job did not point to a folder.

This error is used to indicate that the resource that a job was pointed to on the remote did not refer to a folder. For example, not all implementations of the ListFilesJob might support “listing” a remote file.

JobState

enum class SynqClient::JobState : quint32

Values:

enumerator Ready

The initial state of each job.

Newly created jobs are in this state. While in this state, jobs shall be set up (e.g. by setting paths to a file to be uploaded or to a remote folder which shall be listed).

enumerator Running

The job is currently running.

After a job has been configured and started, it transitions to this state.

enumerator Finished

The job has finished.

This is the final job state. Once a job finished processing, it transitions into this state. Once a job is in this state, it shall be deleted.

FileInfo

class FileInfo

Meta information about a file or folder.

This class is used to provide meta information about a file or folder. Usually, it is used by jobs which (also) retrieve meta information about remote resources, e.g. GetFileInfoJob() or ListFilesJob().

Public Functions

FileInfo()

Constructor.

This creates a new, invalid FileInfo object.

See also

isValid()

FileInfo(const FileInfo &other)

Copy constructor.

virtual ~FileInfo()

Destructor.

FileInfo &operator=(const FileInfo &other)

Copy assignment operator.

bool isValid() const

Indicates if the object is valid.

bool isFile() const

Indicates if the resource is a file.

void setIsFile()

Mark the resource as a file.

This will mark this object as refering to a file.

bool isDirectory() const

Indicates if the resource is a folder.

void setIsDirectory()

Mark this object as refering to a folder.

QString name() const

The name of the file or folder.

This holds the file name (i.e. without the path) of a file or folder.

void setName(const QString &name)

Set the file name.

QString path() const

Get the path to the file or folder.

This returns the path to the file or folder. By default, this is the same value as then name property. However, in some cases (e.g. recursively listing a folder), this will be set to the path relative to the folder that is listed.

void setPath(const QString &path)

Set the path.

QString syncAttribute() const

The remote sync attribute.

This attribute can be used for synchronizing a local and remote version of a file or folder. The sync attribute indicates the version of a file. It is a string, the exact content depends on the concrete backend. Sync attributes are used for:

  • Detecting if a file changed.

  • Detecting if a folder (e.g. the contents of the folder) changed, in other words: If there have been any creations, updates or deletes of entries inside this folder. In this case, the sync attribute of the folder shall change as well.

If no sync attribute could be retrieved, this will be an empty string.

void setSyncAttribute(const QString &syncAttribute)

Set the sync attribute.

QUrl url() const

The full URL to the remote file.

If this object refers to a remote file or folder, this should hold the full URL to it.

void setUrl(const QUrl &url)

Set the URL to the remote file or folder.

bool isDeleted() const

Indicates that the file or folder has been deleted.

If this flag is set, the file or folder for which information has been retrieved has been deleted.

void setDeleted(bool deleted)

Set the deleted flag of the file or folder.

QVariant customProperty(const QString &name) const

Retrieve custom properties called name.

Depending on the concrete backend, additional meta information might be retrieved for a remote file or folder. In this case, such information can be stored as custom properties in the form of a key-value mapping. Keys are arbitrary strings up to the concrete backend. Values can be anything. Refer to the documentation of the concrete jobs to learn about supported custom properties.

void setCustomProperty(const QString &name, const QVariant &propertyValue)

Set the custom property name to value.

Public Static Functions

static FileInfo fromLocalFile(const QString &path)

Construct a FileInfo object from a local file.

This is a utility method, which constructs a FileInfo object from the local file or folder pointed to by the given path.

Protected Functions

explicit FileInfo(FileInfoPrivate *d)

Constructor.

FileInfos

typedef QVector<FileInfo> SynqClient::FileInfos

Concrete Job Classes

In addition to these abstract classes, there are concrete classes that implement concrete access to a server of a particular type. The following server types are currently supported:

Higher Level Job Utilities

The abstract core jobs describe low level (quasi atomic) operations against a remote service. Usually, concrete applications will built on top of them to make use of their functionality, creating higher order functions. To avoid repetitive work in applications using SynqClient, the library also provides some higher order functionality to work with jobs.

CompositeJob

The SynqClient::CompositeJob class is a job class (i.e. it derives from the SynqClient::AbstractJob class) and hence, implements the same job interface like any other job. The purpose of this class is to allow combining several other jobs together into one larger batch of jobs, that can be run at once.

class CompositeJob : public SynqClient::AbstractJob

Public Functions

explicit CompositeJob(QObject *parent = nullptr)

Constructor.

~CompositeJob() override

Destructor.

int maxJobs() const

The maximum number of jobs that are run in parallel.

This property holds the maximum number of jobs that the composite will run in parallel. Running multiple jobs at once can be beneficial, e.g. by usitlizing parallelism and pipelining when accessing a remote server. Setting this property to 1 effectively causes the composite to run all child jobs sequentially.

By default, 12 jobs are run in parallel. This is double the number of network connections, a QNetworkAccessManager will spawn in parallel and hence should make optimal use of parallelism and pipelining (especially if additional actions are run in the finished handler of the child jobs).

Note

If the remote server requires sequential accesses, this value must be set to 1.

void setMaxJobs(int maxJobs)

Set the maximum number of jobs run in parallel to maxJobs.

CompositeJobErrorMode errorMode() const

Determines how child job errors are handled.

This option controls the behaviour in case a child job has an error. The default is CompositeJobErrorMode::RunAllJobs.

void setErrorMode(CompositeJobErrorMode errorMode)

Set the errorMode to be used.

void addJob(AbstractJob *job)

Add a child job to the composite.

This adds the given child job to this composite job. This function can be called before starting the composite job or also while it is running (e.g. it is possible to add another job to the composite after a previous job finished by creating follow up jobs in the first child job’s finished handler). The composite - once started - will start all child jobs and wait for them to finish.

Note

The composite will not take ownership of the job. It is up to the user to ensure, that jobs are eventually deleted. Ideally, connect the finished signal of the child job to QObject::deleteLater, so it is eventually deleted once it finished. The composite will detect deletions. However, if a job is deleted before it is finished (or after it finished but before the composite’s handler of that even is called), it won’t notice if the job finished with an error. Hence, the configured errorMode() might be ignored. If you delete a job by wiring its finished signal to deleteLater, this should not be an issue.

Warning

Jobs which are in the JobState::Finished state are ignored.

virtual void start() override

Implementation of AbstractJob::start().

virtual void stop() override

Implementation of AbstractJob::stop().

Protected Functions

explicit CompositeJob(CompositeJobPrivate *d, QObject *parent = nullptr)

Constructor.

Additional Type Definitions

The following type definitions are used together with the higher level job interface:

CompositeJobErrorMode

enum class SynqClient::CompositeJobErrorMode : quint32

Determines error handling of composite jobs.

This enumeration is used to configure the error handling of composite jobs (i.e. jobs that consist of multiple other jobs).

Values:

enumerator StopOnFirstError

Stop as soon as the first child job encounters an error.

This option will cause the composite job to run as soon as the first child job encounters an error.

enumerator RunAllJobs

Continue processing all child jobs, no matter if an error occurred.

This option will cause the composite job to finish running all child jobs even if some of them already finished with an error. The composite will report the error of the first failing child as its own error.