ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\BackgroundTasks\Implementation\TaskManager\NonPersistingObserver Class Reference

Class NonPersistingObserver. More...

+ Inheritance diagram for ILIAS\BackgroundTasks\Implementation\TaskManager\NonPersistingObserver:
+ Collaboration diagram for ILIAS\BackgroundTasks\Implementation\TaskManager\NonPersistingObserver:

Public Member Functions

 __construct (protected Bucket $bucket)
 
 notifyState (int $state)
 
 notifyPercentage (Task $task, int $percentage)
 You can change the progress of a currently running task. More...
 
 notifyCurrentTask (Task $task)
 If the current task changes notify the observer. More...
 
 heartbeat ()
 I'm still alive! If your calculation takes a really long time don't forget to use the heartbeat. More...
 
 notifyState (int $state)
 If the bucket goes into another state notify the observer. More...
 
 notifyPercentage (Task $task, int $percentage)
 You can change the progress of a currently running task. More...
 
 notifyCurrentTask (Task $task)
 If the current task changes notify the observer. More...
 
 heartbeat ()
 I'm still alive! If your calculation takes a really long time don't forget to use the heartbeat. More...
 

Detailed Description

Class NonPersistingObserver.

Author
Oskar Truffer ot@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch The NonPersistingObserver just updates the bucket, without persisting it into the database.

Definition at line 30 of file NonPersistingObserver.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\BackgroundTasks\Implementation\TaskManager\NonPersistingObserver::__construct ( protected Bucket  $bucket)

Definition at line 32 of file NonPersistingObserver.php.

33 {
34 }

Member Function Documentation

◆ heartbeat()

ILIAS\BackgroundTasks\Implementation\TaskManager\NonPersistingObserver::heartbeat ( )

I'm still alive! If your calculation takes a really long time don't forget to use the heartbeat.

Otherwise the bucket might be killed while still running. All notify tasks of the observer also trigger a heartbeat.

Implements ILIAS\BackgroundTasks\Observer.

Definition at line 61 of file NonPersistingObserver.php.

61 : void
62 {
63 $this->bucket->heartbeat();
64 }

◆ notifyCurrentTask()

ILIAS\BackgroundTasks\Implementation\TaskManager\NonPersistingObserver::notifyCurrentTask ( Task  $task)

If the current task changes notify the observer.

This also triggers a heartbeat.

Implements ILIAS\BackgroundTasks\Observer.

Definition at line 51 of file NonPersistingObserver.php.

51 : void
52 {
53 $this->bucket->heartbeat();
54 $this->bucket->setCurrentTask($task);
55 }

◆ notifyPercentage()

ILIAS\BackgroundTasks\Implementation\TaskManager\NonPersistingObserver::notifyPercentage ( Task  $task,
int  $percentage 
)

You can change the progress of a currently running task.

This also triggers a heartbeat.

Implements ILIAS\BackgroundTasks\Observer.

Definition at line 45 of file NonPersistingObserver.php.

45 : void
46 {
47 $this->bucket->heartbeat();
48 $this->bucket->setPercentage($task, $percentage);
49 }

◆ notifyState()

ILIAS\BackgroundTasks\Implementation\TaskManager\NonPersistingObserver::notifyState ( int  $state)
Parameters
$stateint

Implements ILIAS\BackgroundTasks\Observer.

Definition at line 39 of file NonPersistingObserver.php.

39 : void
40 {
41 $this->bucket->heartbeat();
42 $this->bucket->setState($state);
43 }

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