Loading...
Searching...
No Matches
WorkshopJob Interface Reference

This is interface to track state and control individual asynchronous jobs withing workshop. More...

Public Member Functions

void ~WorkshopJob ()
 
proto external WorkshopAssetBase GetAsset ()
 Returns asset to which this job belongs to.
 
proto external WorkshopRevisionBase GetRevision ()
 Returns revision to which this job is currently doing the task.
 
proto external WorkshopRevisionBase GetPreviousRevision ()
 Returns previous revision for some specific tasks if there was some.
 
proto external EWorkshopJobTask GetTask ()
 Returns primary task this job is supposed to do.
 
proto external EWorkshopJobState GetState ()
 Returns in what state the job currently is in.
 
proto external bool IsCanceled ()
 Return true if job was canceled.
 
proto external float GetProcessProgress ()
 Returns primary progress of the jobs process in range 0.0f to 1.0f.
 
proto external int GetProcessTotalKB ()
 Return total amount of data in KB which will be processed by the job.
 
proto external int GetProcessDoneKB ()
 Returns amount of data in KB which was already processed by the job.
 
proto external int GetWriteSpeedKBpS ()
 Returns speed in KB per Second for writing data onto the disk.
 
proto external float GetDownloadProgress ()
 Returns progress of downloading missing data in range of 0.0f to 1.0f.
 
proto external int GetDownloadTotalKB ()
 Return total amount of missing data in KB which will be downloaded by the job.
 
proto external int GetDownloadDoneKB ()
 Return amount of missing data in KB which was already downloaded by the job.
 
proto external int GetDownloadSpeedKBpS ()
 Returns speed in KB per Second for downloading missing data.
 
proto external void Pause ()
 Will pause the job and will not continue until Resume is invoked.
 
proto external void Resume (notnull BackendCallback callback)
 Will resume the paused job.
 
proto external void SetQueuePriority (int priority)
 Will change the priority/position in processing queue for the jobs.
 
proto external int GetQueuePriority ()
 Returns priority of this job in processing queue.
 
proto external void Cancel (notnull BackendCallback callback)
 Will gracefully cancel job and attempt to revert all changes that were done during active state of the asset.
 
proto external void ForceCancel ()
 Will forcefully cancel job without attempting to revert any previous changes.
 
proto external void Retry (notnull BackendCallback callback)
 Will retry the job after it failed or was canceled.
 

Detailed Description

This is interface to track state and control individual asynchronous jobs withing workshop.

State is saved into meta files of the asset which allows persistence between game restarts and continue unfinished jobs.

Jobs which was finished with any result or canceled by user is discarded by the workshop but Script or Native code can store these jobs with strong reference. This allows to preserve some kind of history with possibility to retry failed or canceled jobs.

Constructor & Destructor Documentation

◆ ~WorkshopJob()

void WorkshopJob.~WorkshopJob ( )

Member Function Documentation

◆ Cancel()

proto external void WorkshopJob.Cancel ( notnull BackendCallback callback)

Will gracefully cancel job and attempt to revert all changes that were done during active state of the asset.

job will change to CANCELED state after it finishes reverting.

  • For DOWNLOAD this will revert by deleting all data as there were none before this job.
  • For UPDATE/DOWNGRADE this will revert to previous revision which might take some time until it is fixed.
    Note
    You can use ForceCancel to immediately cancel the job but with different behavior. Refer to its documentation.
    Warning
    Original callback which was used to create this will not be invoked and instead will be replaced with one used in this method. You can also reuse the original one used to create this job.

◆ ForceCancel()

proto external void WorkshopJob.ForceCancel ( )

Will forcefully cancel job without attempting to revert any previous changes.

Warning
Canceling some tasks can possibly leave asset in corrupted state and might still require repair to be usable afterwards.

◆ GetAsset()

proto external WorkshopAssetBase WorkshopJob.GetAsset ( )

Returns asset to which this job belongs to.

◆ GetDownloadDoneKB()

proto external int WorkshopJob.GetDownloadDoneKB ( )

Return amount of missing data in KB which was already downloaded by the job.

Warning
If Job did not properly begin yet this can return -1 due to ongoing calculation.

◆ GetDownloadProgress()

proto external float WorkshopJob.GetDownloadProgress ( )

Returns progress of downloading missing data in range of 0.0f to 1.0f.

Warning
If Job did not properly begin yet this can return -1.0f due to ongoing calculation.

◆ GetDownloadSpeedKBpS()

proto external int WorkshopJob.GetDownloadSpeedKBpS ( )

Returns speed in KB per Second for downloading missing data.

◆ GetDownloadTotalKB()

proto external int WorkshopJob.GetDownloadTotalKB ( )

Return total amount of missing data in KB which will be downloaded by the job.

Warning
If Job did not properly begin yet this can return -1 due to ongoing calculation.

◆ GetPreviousRevision()

proto external WorkshopRevisionBase WorkshopJob.GetPreviousRevision ( )

Returns previous revision for some specific tasks if there was some.

Note
If job is canceled then return value is swapped with GetPreviousRevision() to revert progress.

◆ GetProcessDoneKB()

proto external int WorkshopJob.GetProcessDoneKB ( )

Returns amount of data in KB which was already processed by the job.

Warning
If Job did not properly begin yet this can return -1 due to ongoing calculation.

◆ GetProcessProgress()

proto external float WorkshopJob.GetProcessProgress ( )

Returns primary progress of the jobs process in range 0.0f to 1.0f.

Warning
If Job did not properly begin yet this can return -1.0f due to ongoing calculation.

◆ GetProcessTotalKB()

proto external int WorkshopJob.GetProcessTotalKB ( )

Return total amount of data in KB which will be processed by the job.

Warning
If Job did not properly begin yet this can return -1 due to ongoing calculation.

◆ GetQueuePriority()

proto external int WorkshopJob.GetQueuePriority ( )

Returns priority of this job in processing queue.

◆ GetRevision()

proto external WorkshopRevisionBase WorkshopJob.GetRevision ( )

Returns revision to which this job is currently doing the task.

Note
If job is canceled then return value is swapped with GetPreviousRevision() to revert progress.

◆ GetState()

proto external EWorkshopJobState WorkshopJob.GetState ( )

Returns in what state the job currently is in.

◆ GetTask()

proto external EWorkshopJobTask WorkshopJob.GetTask ( )

Returns primary task this job is supposed to do.

Note
This value will not change during entire existence of the job.

◆ GetWriteSpeedKBpS()

proto external int WorkshopJob.GetWriteSpeedKBpS ( )

Returns speed in KB per Second for writing data onto the disk.

◆ IsCanceled()

proto external bool WorkshopJob.IsCanceled ( )

Return true if job was canceled.

Note
This can return true even if current state is not canceled because some tasks might require to make some reverting operations so it can take time before task is truly finished with canceled state.

◆ Pause()

proto external void WorkshopJob.Pause ( )

Will pause the job and will not continue until Resume is invoked.

Warning
Original callback which was used to create this will not be invoked. You will have to provide new one (or reuse original) with Resume.
Note
Pause will immediately mark the job as paused and moved out of main processing queue. Upon game restart any previously active/queued or paused job will be recovered in paused state.

◆ Resume()

proto external void WorkshopJob.Resume ( notnull BackendCallback callback)

Will resume the paused job.

Note
Resumed job is always appended at the end of the processing queue. You can use SetQueuePriority() right after resume to change the priority of the job.

◆ Retry()

proto external void WorkshopJob.Retry ( notnull BackendCallback callback)

Will retry the job after it failed or was canceled.

Warning
Original callback which was used to create this will not be invoked and instead will be replaced with one used in this method. You can also reuse the original one used to create or cancel this job.

◆ SetQueuePriority()

proto external void WorkshopJob.SetQueuePriority ( int priority)

Will change the priority/position in processing queue for the jobs.

Warning
Priority can be changed only for ACTIVE or QUEUED jobs.

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