Interface IJobStore
Interface representing a storage service for background job processing
Namespace: DataWeb.Worker
Assembly: DataWeb.Core.dll
Syntax
public interface IJobStore
Properties
Name
Gets the name of the job store
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
string |
Methods
ExistsInStatusAsync(string, JobStatus, CancellationToken)
Determines whether a job with a specified name and status exists
Declaration
Task<bool> ExistsInStatusAsync(string name, JobStatus status, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the job to search for |
JobStatus | status | The JobStatus of the job to search for |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | An asynchronous operation that returns a value indicating whether the job exists |
GetJobAsync(JobFilter, CancellationToken)
Retrieves a job based on a specified filter
Declaration
Task<Job> GetJobAsync(JobFilter filter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
JobFilter | filter | The JobFilter to apply when retrieving the job |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Job> | An asynchronous operation that returns the job |
GetJobsAsync(JobFilter, CancellationToken)
Retrieves a collection of jobs based on a specified filter
Declaration
Task<IEnumerable<Job>> GetJobsAsync(JobFilter filter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
JobFilter | filter | The JobFilter to apply when retrieving jobs |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<IEnumerable<Job>> | An asynchronous operation that returns a collection of jobs |
GetLogAsync(string, CancellationToken)
Retrieves the text log of a specified job
Declaration
Task<string> GetLogAsync(string id, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | id | The unique identifier of the job to retrieve the text log for |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | An asynchronous operation that returns the text log of the job |
SetJobAsync(string, int, JobStatus, List<Parameter>, CancellationToken)
Creates a new job and returns the unique identifier of the job
Declaration
Task<string> SetJobAsync(string name, int total, JobStatus status, List<Parameter> parameters = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the job |
int | total | The total number of units of work for the job |
JobStatus | status | The initial JobStatus of the job |
List<Parameter> | parameters | The collection of parameters for the job |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<string> | An asynchronous operation that returns the unique identifier of the new job |
SetStatusAsync(string, int, CancellationToken)
Updates the status of a specified job
Declaration
Task SetStatusAsync(string id, int status, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | id | The unique identifier of the job to update |
int | status | The new status of the job |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | An asynchronous operation that updates the job status |
UpdateEntryAsync(string, int, int, CancellationToken)
Updates the progress and error count for a specified job
Declaration
Task UpdateEntryAsync(string id, int progress, int errors, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | id | The unique identifier of the job to update |
int | progress | The updated progress count for the job |
int | errors | The updated error count for the job |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | An asynchronous operation that updates the job entry |
UpdateTextLogAsync(string, string, CancellationToken)
Appends a line to the text log of a specified job
Declaration
Task UpdateTextLogAsync(string id, string line, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | id | The unique identifier of the job to update |
string | line | The line to append to the text log |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | An asynchronous operation that appends a line to the job text log |