PHP 클래스 PHPDaemon\Core\AppInstance

저자: Vasily Zorin ([email protected])
상속: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog
파일 보기 프로젝트 열기: kakserpom/phpdaemon 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$config Related config section
$enableRPC Is RPC enabled?
$passphrase Optional passphrase
$ready Ready to run?
$requestClass Default class of incoming requests
$runOnDemand If true, it's allowed to be run without defined config section'

보호된 프로퍼티들

프로퍼티 타입 설명
$name Instance name

공개 메소드들

메소드 설명
RPCall ( string $method, array $args ) : mixed Function handles incoming Remote Procedure Calls You can override it
__construct ( string $name = '' ) : void Application constructor
beginRequest ( object $req, object $upstream ) : object Create Request instance
broadcastCall ( string $method, array $args = [], callable $cb = null ) : boolean Send broadcast RPC You can override it
directCall ( integer $workerId, string $method, array $args = [], mixed $cb = null ) : boolean Send RPC, executed once in certain worker You can override it
getConfig ( ) : Section Returns a config section
getInstance ( string $name, boolean $spawn = true ) : AppInstance
getName ( ) : string Returns the instance name
handleRequest ( object $parent, object $upstream ) : object Handle the request
handleStatus ( integer $ret ) : boolean Handle the worker status
isEnabled ( ) : boolean Returns whether if this application is enabled
log ( string $message ) : void Log something
onConfigUpdated ( ) : void Called when worker is going to update configuration
onReady ( ) : void Called when the worker is ready to go
singleCall ( string $method, array $args = [], mixed $cb = null ) : boolean Send RPC, executed once in any worker You can override it

보호된 메소드들

메소드 설명
getConfigDefaults ( ) : boolean Function to get default config options from application Override to set your own
init ( ) : void Called when creates instance of the application
onShutdown ( $graceful = false ) : boolean Called when application instance is going to shutdown

메소드 상세

RPCall() 공개 메소드

Function handles incoming Remote Procedure Calls You can override it
public RPCall ( string $method, array $args ) : mixed
$method string Method name
$args array Arguments
리턴 mixed Result

__construct() 공개 메소드

Application constructor
public __construct ( string $name = '' ) : void
$name string Instance name
리턴 void

beginRequest() 공개 메소드

Create Request instance
public beginRequest ( object $req, object $upstream ) : object
$req object Generic
$upstream object Upstream application instance
리턴 object Request

broadcastCall() 공개 메소드

Send broadcast RPC You can override it
public broadcastCall ( string $method, array $args = [], callable $cb = null ) : boolean
$method string Method name
$args array Arguments
$cb callable Callback
리턴 boolean Success

directCall() 공개 메소드

Send RPC, executed once in certain worker You can override it
public directCall ( integer $workerId, string $method, array $args = [], mixed $cb = null ) : boolean
$workerId integer Worker Id
$method string Method name
$args array Arguments
$cb mixed Callback
리턴 boolean Success

getConfig() 공개 메소드

Returns a config section
public getConfig ( ) : Section
리턴 PHPDaemon\Config\Section

getConfigDefaults() 보호된 메소드

Function to get default config options from application Override to set your own
protected getConfigDefaults ( ) : boolean
리턴 boolean

getInstance() 공개 정적인 메소드

public static getInstance ( string $name, boolean $spawn = true ) : AppInstance
$name string Instance name
$spawn boolean If true, we spawn an instance if absent
리턴 AppInstance

getName() 공개 메소드

Returns the instance name
public getName ( ) : string
리턴 string

handleRequest() 공개 메소드

Handle the request
public handleRequest ( object $parent, object $upstream ) : object
$parent object Parent request
$upstream object Upstream application
리턴 object Request

handleStatus() 공개 메소드

Handle the worker status
public handleStatus ( integer $ret ) : boolean
$ret integer Status code
리턴 boolean Result

init() 보호된 메소드

Called when creates instance of the application
protected init ( ) : void
리턴 void

isEnabled() 공개 메소드

Returns whether if this application is enabled
public isEnabled ( ) : boolean
리턴 boolean

log() 공개 메소드

Log something
public log ( string $message ) : void
$message string Message
리턴 void

onConfigUpdated() 공개 메소드

Called when worker is going to update configuration
public onConfigUpdated ( ) : void
리턴 void

onReady() 공개 메소드

Called when the worker is ready to go
public onReady ( ) : void
리턴 void

onShutdown() 보호된 메소드

Called when application instance is going to shutdown
protected onShutdown ( $graceful = false ) : boolean
리턴 boolean Ready to shutdown?

singleCall() 공개 메소드

Send RPC, executed once in any worker You can override it
public singleCall ( string $method, array $args = [], mixed $cb = null ) : boolean
$method string Method name
$args array Arguments
$cb mixed Callback
리턴 boolean Success

프로퍼티 상세

$config 공개적으로 프로퍼티

Related config section
public $config

$enableRPC 공개적으로 프로퍼티

Is RPC enabled?
public $enableRPC

$name 보호되어 있는 프로퍼티

Instance name
protected $name

$passphrase 공개적으로 프로퍼티

Optional passphrase
public $passphrase

$ready 공개적으로 프로퍼티

Ready to run?
public $ready

$requestClass 공개적으로 프로퍼티

Default class of incoming requests
public $requestClass

$runOnDemand 공개적으로 정적으로 프로퍼티

If true, it's allowed to be run without defined config section'
public static $runOnDemand