appwrite/src/Appwrite/Event/StatsUsageDump.php

45 lines
808 B
PHP
Raw Normal View History

2024-01-28 09:28:59 +00:00
<?php
namespace Appwrite\Event;
2025-02-05 09:53:29 +00:00
use Utopia\Queue\Publisher;
2024-01-28 09:28:59 +00:00
2025-01-30 04:43:16 +00:00
class StatsUsageDump extends Event
2024-01-28 09:28:59 +00:00
{
protected array $stats;
2025-02-05 09:53:29 +00:00
public function __construct(protected Publisher $publisher)
2024-01-28 09:28:59 +00:00
{
2025-02-05 09:53:29 +00:00
parent::__construct($publisher);
2024-01-28 09:28:59 +00:00
$this
2025-01-30 04:43:16 +00:00
->setQueue(Event::STATS_USAGE_DUMP_QUEUE_NAME)
->setClass(Event::STATS_USAGE_DUMP_CLASS_NAME);
2024-01-28 09:28:59 +00:00
}
/**
* Add Stats.
*
* @param array $stats
* @return self
*/
public function setStats(array $stats): self
{
$this->stats = $stats;
return $this;
}
/**
2025-01-17 05:08:39 +00:00
* Prepare the payload for the usage dump event.
2024-01-28 09:28:59 +00:00
*
2025-01-17 05:08:39 +00:00
* @return array
2024-01-28 09:28:59 +00:00
*/
2025-01-17 05:08:39 +00:00
protected function preparePayload(): array
2024-01-28 09:28:59 +00:00
{
2025-01-17 05:08:39 +00:00
return [
2024-01-28 09:28:59 +00:00
'stats' => $this->stats,
2025-01-17 05:08:39 +00:00
];
2024-01-28 09:28:59 +00:00
}
}