1 | <?php |
||
12 | class InstanceState |
||
13 | { |
||
14 | |||
15 | const REACHABLE = 0; |
||
16 | const MAYBE_REACHABLE = 1; |
||
17 | const UNREACHABLE = 2; |
||
18 | |||
19 | /** |
||
20 | * @var int the number of retries since marked as unreachable |
||
21 | */ |
||
22 | private $_retryCount = 0; |
||
23 | |||
24 | /** |
||
25 | * @var int the instance reachability state |
||
26 | */ |
||
27 | private $_reachability = self::MAYBE_REACHABLE; |
||
28 | |||
29 | |||
30 | /** |
||
31 | * Increments the retry counter |
||
32 | */ |
||
33 | public function incrementRetryCount() |
||
37 | |||
38 | |||
39 | /** |
||
40 | * @return int the retry count |
||
41 | */ |
||
42 | public function getRetryCount() |
||
46 | |||
47 | |||
48 | /** |
||
49 | * Resets the retry count |
||
50 | */ |
||
51 | public function resetRetryCount() |
||
55 | |||
56 | |||
57 | /** |
||
58 | * @return bool whether the instance is reachable |
||
59 | */ |
||
60 | public function isReachable() |
||
64 | |||
65 | |||
66 | /** |
||
67 | * @return int the instance reachability state |
||
68 | */ |
||
69 | public function getReachability() |
||
73 | |||
74 | |||
75 | /** |
||
76 | * Sets the reachability state of the instance |
||
77 | * |
||
78 | * @param int $reachable one of the reachability states |
||
79 | */ |
||
80 | public function setReachability($reachable) |
||
84 | |||
85 | } |
||
86 |