forked from tsterker/Solarium-Collection-Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CollectionManagerInterface.php
87 lines (73 loc) · 2.04 KB
/
CollectionManagerInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
namespace TSterker\SolariumCollectionManager;
use Solarium\Core\Client\State\CollectionState;
use Solarium\Core\Query\Result\ResultInterface;
use Solarium\QueryType\Server\Collections\Result\ClusterStatusResult;
interface CollectionManagerInterface
{
/**
* Get status of given collection or all collections.
*
* @param string $name
* @return ResultInterface|ClusterStatusResult
*/
public function status(string $name = null): ResultInterface;
/**
* Get all collection names
*
* @return CollectionState[]
*/
public function getCollections(): array;
public function hasCollection(string $name): bool;
public function ensureCollection(string $name): void;
/**
* Create collection
*
* @param string $name
* @param array<string, mixed> $options
* @return ResultInterface|ClusterStatusResult
*/
public function create(string $name, array $options = []): ResultInterface;
/**
* Alias collection
*
* @param string $collection
* @param string $alias
* @return mixed[] JSON response
*/
public function alias(string $collection, string $alias): array;
/**
* Delete Alias collection
*
* @param string $alias
* @return mixed[] JSON response
*/
public function deleteAlias(string $alias): array;
public function hasAlias(string $alias): bool;
/**
* List all aliases
*
* @return string[] alias names
*/
public function getAliases(): array;
/**
* List all aliases with collection mappings
*
* @return string[] alias names
*/
public function getAliasMappings(): array;
/**
* Get collection for given alias or null
*
* @param string $alias
* @return null|string
*/
public function getAliasedCollection(string $alias): ?string;
/**
* Delete collection
*
* @param string $name
* @return ResultInterface|ClusterStatusResult
*/
public function delete(string $name): ResultInterface;
}