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;
|
|
|
|
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
2017-07-20 01:49:41 +00:00
|
|
|
use Pterodactyl\Contracts\Repository\Attributes\SearchableInterface;
|
|
|
|
|
|
|
|
interface NodeRepositoryInterface extends RepositoryInterface, SearchableInterface
|
|
|
|
{
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
* @param bool $refresh
|
|
|
|
* @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
|
|
|
|
* @param bool $refresh
|
|
|
|
* @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
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a node with all of the servers attached to that node.
|
|
|
|
*
|
2017-08-22 03:10:48 +00:00
|
|
|
* @param int $id
|
2018-01-05 04:49:50 +00:00
|
|
|
* @return \Pterodactyl\Models\Node
|
2017-08-05 22:20:07 +00:00
|
|
|
*
|
|
|
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
|
|
|
*/
|
2018-01-05 04:49:50 +00:00
|
|
|
public function getNodeServers(int $id): 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;
|
2017-07-20 01:49:41 +00:00
|
|
|
}
|