Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F449215
PhabricatorSearchHost.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorSearchHost.php
View Options
<?php
abstract
class
PhabricatorSearchHost
extends
Phobject
{
const
KEY_REFS
=
'cluster.search.refs'
;
const
KEY_HEALTH
=
'cluster.search.health'
;
protected
$engine
;
protected
$healthRecord
;
protected
$roles
=
array
();
protected
$disabled
;
protected
$host
;
protected
$port
;
const
STATUS_OKAY
=
'okay'
;
const
STATUS_FAIL
=
'fail'
;
public
function
__construct
(
PhabricatorFulltextStorageEngine
$engine
)
{
$this
->
engine
=
$engine
;
}
public
function
setDisabled
(
$disabled
)
{
$this
->
disabled
=
$disabled
;
return
$this
;
}
public
function
getDisabled
()
{
return
$this
->
disabled
;
}
/**
* @return PhabricatorFulltextStorageEngine
*/
public
function
getEngine
()
{
return
$this
->
engine
;
}
public
function
isWritable
()
{
return
$this
->
hasRole
(
'write'
);
}
public
function
isReadable
()
{
return
$this
->
hasRole
(
'read'
);
}
public
function
hasRole
(
$role
)
{
return
isset
(
$this
->
roles
[
$role
])
&&
$this
->
roles
[
$role
]
===
true
;
}
public
function
setRoles
(
array
$roles
)
{
foreach
(
$roles
as
$role
=>
$val
)
{
$this
->
roles
[
$role
]
=
$val
;
}
return
$this
;
}
public
function
getRoles
()
{
$roles
=
array
();
foreach
(
$this
->
roles
as
$key
=>
$val
)
{
if
(
$val
)
{
$roles
[
$key
]
=
$val
;
}
}
return
$roles
;
}
public
function
setPort
(
$value
)
{
$this
->
port
=
$value
;
return
$this
;
}
public
function
getPort
()
{
return
$this
->
port
;
}
public
function
setHost
(
$value
)
{
$this
->
host
=
$value
;
return
$this
;
}
public
function
getHost
()
{
return
$this
->
host
;
}
public
function
getHealthRecordCacheKey
()
{
$host
=
$this
->
getHost
();
$port
=
$this
->
getPort
();
$key
=
self
::
KEY_HEALTH
;
return
"{$key}({$host}, {$port})"
;
}
/**
* @return PhabricatorClusterServiceHealthRecord
*/
public
function
getHealthRecord
()
{
if
(!
$this
->
healthRecord
)
{
$this
->
healthRecord
=
new
PhabricatorClusterServiceHealthRecord
(
$this
->
getHealthRecordCacheKey
());
}
return
$this
->
healthRecord
;
}
public
function
didHealthCheck
(
$reachable
)
{
$record
=
$this
->
getHealthRecord
();
$should_check
=
$record
->
getShouldCheck
();
if
(
$should_check
)
{
$record
->
didHealthCheck
(
$reachable
);
}
}
/**
* @return string[] Get a list of fields to show in the status overview UI
*/
abstract
public
function
getStatusViewColumns
();
abstract
public
function
getConnectionStatus
();
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 7:10 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
66727
Default Alt Text
PhabricatorSearchHost.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment