JobPersister
public protocol JobPersister: class
Provides the means of persisting jobs for a JobQueue
.
JobQueue
s which have not been assigned a JobPersister
will operate as in-memory only queues.
-
The type of QueueJob a conforming type can persist.
Declaration
Swift
associatedtype JobType: QueueJob
-
Will save the jobs to a permanent destination
Throws
If there’s an error persisting 1 or more of the jobs.Declaration
Swift
func persist(_ jobs: [JobType]) throws -> Void
Parameters
jobs
The jobs to persist
-
Deletes the job’s persisted data
Throws
If there’s an error deleting the job’s persisted data.Declaration
Swift
func delete(_ job: JobType) throws -> Void
Parameters
job
The job whose data is to be deleted
-
Loads all the Jobs from their permanent source.
Throws
If there’s an error loading and deserializing 1 or more jobs from their persisted data.Declaration
Swift
func load() throws -> [JobType]
Return Value
An array of deserialized jobs.
-
Deletes all jobs from the persisted location.
Declaration
Swift
func clear(completion: ((Error?) -> Void)?) -> Void
Parameters
completion
An optional callback to be called after the clearing has completed.