Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Contracts/Repository/ServerRepositoryInterface.php
10279 views
1
<?php
2
3
namespace Pterodactyl\Contracts\Repository;
4
5
use Pterodactyl\Models\Server;
6
use Illuminate\Support\Collection;
7
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
8
9
interface ServerRepositoryInterface extends RepositoryInterface
10
{
11
/**
12
* Load the egg relations onto the server model.
13
*/
14
public function loadEggRelations(Server $server, bool $refresh = false): Server;
15
16
/**
17
* Return a collection of servers with their associated data for rebuild operations.
18
*/
19
public function getDataForRebuild(?int $server = null, ?int $node = null): Collection;
20
21
/**
22
* Return a collection of servers with their associated data for reinstall operations.
23
*/
24
public function getDataForReinstall(?int $server = null, ?int $node = null): Collection;
25
26
/**
27
* Return a server model and all variables associated with the server.
28
*
29
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
30
*/
31
public function findWithVariables(int $id): Server;
32
33
/**
34
* Get the primary allocation for a given server. If a model is passed into
35
* the function, load the allocation relationship onto it. Otherwise, find and
36
* return the server from the database.
37
*/
38
public function getPrimaryAllocation(Server $server, bool $refresh = false): Server;
39
40
/**
41
* Return enough data to be used for the creation of a server via the daemon.
42
*/
43
public function getDataForCreation(Server $server, bool $refresh = false): Server;
44
45
/**
46
* Load associated databases onto the server model.
47
*/
48
public function loadDatabaseRelations(Server $server, bool $refresh = false): Server;
49
50
/**
51
* Get data for use when updating a server on the Daemon. Returns an array of
52
* the egg which is used for build and rebuild. Only loads relations
53
* if they are missing, or refresh is set to true.
54
*/
55
public function getDaemonServiceData(Server $server, bool $refresh = false): array;
56
57
/**
58
* Return a server by UUID.
59
*
60
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
61
*/
62
public function getByUuid(string $uuid): Server;
63
64
/**
65
* Check if a given UUID and UUID-Short string are unique to a server.
66
*/
67
public function isUniqueUuidCombo(string $uuid, string $short): bool;
68
69
/**
70
* Returns all the servers that exist for a given node in a paginated response.
71
*/
72
public function loadAllServersForNode(int $node, int $limit): LengthAwarePaginator;
73
}
74
75