ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
PersistingObserver.php
Go to the documentation of this file.
1 <?php
2 
20 
25 
31 class PersistingObserver implements Observer
32 {
33  public function __construct(protected Bucket $bucket, protected Persistence $persistence)
34  {
35  }
36 
40  public function notifyState(int $state): void
41  {
42  $this->bucket->setState($state);
43  $this->bucket->heartbeat();
44  $this->persistence->updateBucket($this->bucket);
45  }
46 
47  public function notifyPercentage(Task $task, int $percentage): void
48  {
49  $this->bucket->setPercentage($task, $percentage);
50  $this->bucket->heartbeat();
51  $this->persistence->updateBucket($this->bucket);
52  }
53 
54  public function notifyCurrentTask(Task $task): void
55  {
56  $this->bucket->setCurrentTask($task);
57  $this->bucket->heartbeat();
58  $this->persistence->updateBucket($this->bucket);
59  }
60 
65  public function heartbeat(): void
66  {
67  $this->bucket->heartbeat();
68  $this->persistence->updateBucket($this->bucket);
69  }
70 }
heartbeat()
I&#39;m still alive! If your calculation takes a really long time don&#39;t forget to use the heartbeat...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Job.php:19
__construct(protected Bucket $bucket, protected Persistence $persistence)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...