Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 15 |
CRAP | |
0.00% |
0 / 1 |
ReindexStatus | |
0.00% |
0 / 15 |
|
0.00% |
0 / 15 |
240 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isComplete | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTotal | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getUpdated | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCreated | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getDeleted | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getBatches | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getVersionConflicts | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getNoops | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getBulkRetries | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSearchRetries | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getThrottledMillis | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getRequestsPerSecond | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getThrottledUntil | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSlices | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace CirrusSearch\Elastica; |
4 | |
5 | class ReindexStatus { |
6 | /** @var array */ |
7 | protected $status; |
8 | |
9 | /** |
10 | * @param array $status Status part of response from elasticsearch _tasks api |
11 | */ |
12 | public function __construct( array $status ) { |
13 | $this->status = $status; |
14 | } |
15 | |
16 | /** |
17 | * @return bool |
18 | */ |
19 | public function isComplete() { |
20 | return false; |
21 | } |
22 | |
23 | /** |
24 | * @return int The total number of documents this request will process. |
25 | * 0 means we don't yet know or, possibly, there are actually 0 documents |
26 | * to process. |
27 | */ |
28 | public function getTotal() { |
29 | return $this->status['total']; |
30 | } |
31 | |
32 | /** |
33 | * @return int Count of documents updated. |
34 | */ |
35 | public function getUpdated() { |
36 | return $this->status['updated']; |
37 | } |
38 | |
39 | /** |
40 | * @return int Count of documents created. |
41 | */ |
42 | public function getCreated() { |
43 | return $this->status['created']; |
44 | } |
45 | |
46 | /** |
47 | * @return int Count of successful delete operations. |
48 | */ |
49 | public function getDeleted() { |
50 | return $this->status['deleted']; |
51 | } |
52 | |
53 | /** |
54 | * @return int Number of scan responses this request has processed. |
55 | */ |
56 | public function getBatches() { |
57 | return $this->status['batches']; |
58 | } |
59 | |
60 | /** |
61 | * @return int Number of version conflicts this request has hit. |
62 | */ |
63 | public function getVersionConflicts() { |
64 | return $this->status['version_conflicts']; |
65 | } |
66 | |
67 | /** |
68 | * @return int Number of noops (skipped bulk items) as part of this request. |
69 | */ |
70 | public function getNoops() { |
71 | return $this->status['noops']; |
72 | } |
73 | |
74 | /** |
75 | * @return int Number of retires that had to be attempted due to bulk |
76 | * actions being rejected. |
77 | */ |
78 | public function getBulkRetries() { |
79 | return $this->status['retries']['bulk']; |
80 | } |
81 | |
82 | /** |
83 | * @return int Number of retries that had to be attempted due to search |
84 | * actions being rejected. |
85 | */ |
86 | public function getSearchRetries() { |
87 | return $this->status['retries']['search']; |
88 | } |
89 | |
90 | /** |
91 | * @return int The total time this request has throttled itself not |
92 | * including the current throttle time if it is currently sleeping. |
93 | */ |
94 | public function getThrottledMillis() { |
95 | return $this->status['throttled_millis']; |
96 | } |
97 | |
98 | /** |
99 | * @return int The number of requests per second to which to throttle the |
100 | * request. -1 means unlimited. |
101 | */ |
102 | public function getRequestsPerSecond() { |
103 | return $this->status['requests_per_second']; |
104 | } |
105 | |
106 | /** |
107 | * @return int Remaining delay of any current throttle sleep or 0 |
108 | * if not sleeping. |
109 | */ |
110 | public function getThrottledUntil() { |
111 | return $this->status['throttled_until_millis']; |
112 | } |
113 | |
114 | /** |
115 | * @return array Statuses of the sub requests into which this sub-request was |
116 | * sliced. Empty if this request wasn't sliced into sub-requests. |
117 | */ |
118 | public function getSlices() { |
119 | return $this->status['slices'] ?? []; |
120 | } |
121 | } |