3 abstract class PhabricatorSearchHost
6 const KEY_REFS
= 'cluster.search.refs';
7 const KEY_HEALTH
= 'cluster.search.health';
10 protected $healthRecord;
11 protected $roles = array();
17 const STATUS_OKAY
= 'okay';
18 const STATUS_FAIL
= 'fail';
20 public function __construct(PhabricatorFulltextStorageEngine
$engine) {
21 $this->engine
= $engine;
24 public function setDisabled($disabled) {
25 $this->disabled
= $disabled;
29 public function getDisabled() {
30 return $this->disabled
;
34 * @return PhabricatorFulltextStorageEngine
36 public function getEngine() {
40 public function isWritable() {
41 return $this->hasRole('write');
44 public function isReadable() {
45 return $this->hasRole('read');
48 public function hasRole($role) {
49 return isset($this->roles
[$role]) && $this->roles
[$role] === true;
52 public function setRoles(array $roles) {
53 foreach ($roles as $role => $val) {
54 $this->roles
[$role] = $val;
59 public function getRoles() {
61 foreach ($this->roles
as $key => $val) {
69 public function setPort($value) {
74 public function getPort() {
78 public function setHost($value) {
83 public function getHost() {
88 public function getHealthRecordCacheKey() {
89 $host = $this->getHost();
90 $port = $this->getPort();
91 $key = self
::KEY_HEALTH
;
93 return "{$key}({$host}, {$port})";
97 * @return PhabricatorClusterServiceHealthRecord
99 public function getHealthRecord() {
100 if (!$this->healthRecord
) {
101 $this->healthRecord
= new PhabricatorClusterServiceHealthRecord(
102 $this->getHealthRecordCacheKey());
104 return $this->healthRecord
;
107 public function didHealthCheck($reachable) {
108 $record = $this->getHealthRecord();
109 $should_check = $record->getShouldCheck();
112 $record->didHealthCheck($reachable);
117 * @return string[] Get a list of fields to show in the status overview UI
119 abstract public function getStatusViewColumns();
121 abstract public function getConnectionStatus();