|
FOSSredder 0.5.0
|
#include <JobManager.h>
Public Member Functions | |
| JobManager (std::shared_ptr< core::ports::diagnostics::IErrorReporter > errorReporter) | |
| Create a manager for generic job state and event delivery. | |
| JobId | submit (JobKind kind) |
| Create a tracked job in the pending state. | |
| SubscriptionId | subscribe (const JobId &id, JobEventCallback cb) |
| Subscribe to events for a job. | |
| void | unsubscribe (const JobId &id, SubscriptionId subId) |
| Remove a job event subscription. | |
| void | cancel (const JobId &id) |
| Mark a job as canceled and set its cancellation flag. | |
| void | pause (const JobId &id) |
| Mark a running job as paused and set its pause flag. | |
| void | resume (const JobId &id) |
| Resume a paused job and clear its pause flag. | |
| std::optional< JobSnapshot > | snapshot (const JobId &id) const |
| Retrieve the latest state snapshot for a job. | |
| std::shared_ptr< std::atomic< bool > > | cancelFlag (const JobId &id) const |
| Retrieve a job cancellation flag. | |
| std::shared_ptr< std::atomic< bool > > | pauseFlag (const JobId &id) const |
| Retrieve a job pause flag. | |
| void | publish (const JobEvent &ev) |
| Publish an event to subscribers and update the stored snapshot. | |
| void | fail (const JobId &id, const std::string &error) |
| Mark a job as failed. | |
| void | finish (const JobId &id) |
| Mark a job as finished. | |
| void | start (const JobId &id) |
| Mark a job as running. | |
Definition at line 26 of file JobManager.h.
|
explicit |
Create a manager for generic job state and event delivery.
| errorReporter | Reporter used when callbacks or flag updates throw. |
Definition at line 50 of file JobManager.cpp.
| void core::jobs::JobManager::cancel | ( | const JobId & | id | ) |
Mark a job as canceled and set its cancellation flag.
| id | Job identifier. |
Definition at line 108 of file JobManager.cpp.

| std::shared_ptr< std::atomic< bool > > core::jobs::JobManager::cancelFlag | ( | const JobId & | id | ) | const |
Retrieve a job cancellation flag.
| id | Job identifier. |
Definition at line 194 of file JobManager.cpp.
| void core::jobs::JobManager::fail | ( | const JobId & | id, |
| const std::string & | error ) |
Mark a job as failed.
| id | Job identifier. |
| error | Error message to store and publish. |
Definition at line 317 of file JobManager.cpp.

| void core::jobs::JobManager::finish | ( | const JobId & | id | ) |
Mark a job as finished.
| id | Job identifier. |
Definition at line 253 of file JobManager.cpp.

| void core::jobs::JobManager::pause | ( | const JobId & | id | ) |
Mark a running job as paused and set its pause flag.
| id | Job identifier. |
Definition at line 133 of file JobManager.cpp.

| std::shared_ptr< std::atomic< bool > > core::jobs::JobManager::pauseFlag | ( | const JobId & | id | ) | const |
Retrieve a job pause flag.
| id | Job identifier. |
Definition at line 201 of file JobManager.cpp.
| void core::jobs::JobManager::publish | ( | const JobEvent & | ev | ) |
Publish an event to subscribers and update the stored snapshot.
| ev | Event to publish. |
Definition at line 208 of file JobManager.cpp.


| void core::jobs::JobManager::resume | ( | const JobId & | id | ) |
Resume a paused job and clear its pause flag.
| id | Job identifier. |
Definition at line 157 of file JobManager.cpp.

| std::optional< JobSnapshot > core::jobs::JobManager::snapshot | ( | const JobId & | id | ) | const |
Retrieve the latest state snapshot for a job.
| id | Job identifier. |
Definition at line 181 of file JobManager.cpp.
| void core::jobs::JobManager::start | ( | const JobId & | id | ) |
Mark a job as running.
| id | Job identifier. |
Definition at line 231 of file JobManager.cpp.

Create a tracked job in the pending state.
| kind | Kind of job to create. |
Definition at line 58 of file JobManager.cpp.
| SubscriptionId core::jobs::JobManager::subscribe | ( | const JobId & | id, |
| JobEventCallback | cb ) |
Subscribe to events for a job.
| id | Job identifier. |
| cb | Callback to invoke when events are published. |
Definition at line 78 of file JobManager.cpp.
| void core::jobs::JobManager::unsubscribe | ( | const JobId & | id, |
| SubscriptionId | subId ) |
Remove a job event subscription.
| id | Job identifier. |
| subId | Subscription identifier. |
Definition at line 94 of file JobManager.cpp.