2017-07-20 01:49:41 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Contracts\Repository;
|
|
|
|
|
2018-01-05 04:49:50 +00:00
|
|
|
use Pterodactyl\Models\Node;
|
|
|
|
use Illuminate\Support\Collection;
|
2019-09-05 04:05:46 +00:00
|
|
|
use Illuminate\Support\LazyCollection;
|
2018-01-05 04:49:50 +00:00
|
|
|
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
2017-07-20 01:49:41 +00:00
|
|
|
use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface;
|
|
|
|
|
2020-09-13 18:29:47 +00:00
|
|
|
interface NodeRepositoryInterface extends RepositoryInterface
|
2017-07-20 01:49:41 +00:00
|
|
|
{
|
2018-01-05 04:49:50 +00:00
|
|
|
const THRESHOLD_PERCENTAGE_LOW = 75;
|
|
|
|
const THRESHOLD_PERCENTAGE_MEDIUM = 90;
|
|
|
|
|
2017-08-05 22:20:07 +00:00
|
|
|
/**
|
|
|
|
* Return the usage stats for a single node.
|
|
|
|
*
|
2018-01-05 04:49:50 +00:00
|
|
|
* @param \Pterodactyl\Models\Node $node
|
2017-08-05 22:20:07 +00:00
|
|
|
* @return array
|
|
|
|
*/
|
2018-01-05 04:49:50 +00:00
|
|
|
public function getUsageStats(Node $node): array;
|
2017-08-05 22:20:07 +00:00
|
|
|
|
2018-05-26 22:16:13 +00:00
|
|
|
/**
|
|
|
|
* Return the usage stats for a single node.
|
|
|
|
*
|
|
|
|
* @param \Pterodactyl\Models\Node $node
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function getUsageStatsRaw(Node $node): array;
|
|
|
|
|
2017-08-05 22:20:07 +00:00
|
|
|
/**
|
|
|
|
* Return all available nodes with a searchable interface.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
|
|
|
|
*/
|
2018-01-05 04:49:50 +00:00
|
|
|
public function getNodeListingData(): LengthAwarePaginator;
|
2017-08-05 22:20:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a single node with location and server information.
|
|
|
|
*
|
2018-01-05 04:49:50 +00:00
|
|
|
* @param \Pterodactyl\Models\Node $node
|
2019-09-06 04:32:57 +00:00
|
|
|
* @param bool $refresh
|
2018-01-05 04:49:50 +00:00
|
|
|
* @return \Pterodactyl\Models\Node
|
2017-08-05 22:20:07 +00:00
|
|
|
*/
|
2018-01-05 04:49:50 +00:00
|
|
|
public function loadLocationAndServerCount(Node $node, bool $refresh = false): Node;
|
2017-08-05 22:20:07 +00:00
|
|
|
|
|
|
|
/**
|
2018-01-05 04:49:50 +00:00
|
|
|
* Attach a paginated set of allocations to a node mode including
|
|
|
|
* any servers that are also attached to those allocations.
|
2017-08-05 22:20:07 +00:00
|
|
|
*
|
2018-01-05 04:49:50 +00:00
|
|
|
* @param \Pterodactyl\Models\Node $node
|
2019-09-06 04:32:57 +00:00
|
|
|
* @param bool $refresh
|
2018-01-05 04:49:50 +00:00
|
|
|
* @return \Pterodactyl\Models\Node
|
2017-08-05 22:20:07 +00:00
|
|
|
*/
|
2018-01-05 04:49:50 +00:00
|
|
|
public function loadNodeAllocations(Node $node, bool $refresh = false): Node;
|
2017-08-05 22:20:07 +00:00
|
|
|
|
2017-07-22 02:17:42 +00:00
|
|
|
/**
|
2017-11-05 20:12:53 +00:00
|
|
|
* Return a collection of nodes for all locations to use in server creation UI.
|
2017-07-22 02:17:42 +00:00
|
|
|
*
|
2018-01-05 04:49:50 +00:00
|
|
|
* @return \Illuminate\Support\Collection
|
2017-07-22 02:17:42 +00:00
|
|
|
*/
|
2018-01-05 04:49:50 +00:00
|
|
|
public function getNodesForServerCreation(): Collection;
|
2018-01-28 23:14:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the IDs of all nodes that exist in the provided locations and have the space
|
|
|
|
* available to support the additional disk and memory provided.
|
|
|
|
*
|
|
|
|
* @param array $locations
|
2019-09-06 04:32:57 +00:00
|
|
|
* @param int $disk
|
|
|
|
* @param int $memory
|
2019-09-05 04:05:46 +00:00
|
|
|
* @return \Illuminate\Support\LazyCollection
|
2018-01-28 23:14:14 +00:00
|
|
|
*/
|
2019-09-05 04:05:46 +00:00
|
|
|
public function getNodesWithResourceUse(array $locations, int $disk, int $memory): LazyCollection;
|
2017-07-20 01:49:41 +00:00
|
|
|
}
|