PHP Class Kraken\Runtime\Container\Manager\ProcessManagerBase

Inheritance: implements Kraken\Runtime\Container\ProcessManagerInterface
Show file Open project: kraken-php/framework

Protected Properties

Property Type Description
$channel Kraken\Channel\ChannelInterface
$context string[]
$fs Kraken\Filesystem\FilesystemInterface
$fsPath string
$processes string[][]
$runtime Kraken\Runtime\RuntimeContainerInterface
$scriptRoot string
$system Kraken\Util\System\SystemInterface

Public Methods

Method Description
__construct ( Kraken\Runtime\RuntimeContainerInterface $runtime, Kraken\Channel\ChannelInterface $channel, string[] $context, Kraken\Util\System\SystemInterface $system, Kraken\Filesystem\FilesystemInterface $fs )
__destruct ( )
allocateProcess ( string $alias, string $name, string $pid ) : boolean Allocate process.
createProcess ( $alias, $name, $flags = Runtime::CREATE_DEFAULT, $params = [] )
createProcesses ( $definitions, $flags = Runtime::CREATE_DEFAULT, $params = [] )
destroyProcess ( $alias, $flags = Runtime::DESTROY_FORCE_SOFT, $params = [] )
destroyProcesses ( $aliases, $flags = Runtime::DESTROY_FORCE_SOFT, $params = [] )
existsProcess ( $alias )
flushProcesses ( $flags = Runtime::DESTROY_KEEP )
freeProcess ( string $alias ) : boolean Free process.
getProcesses ( )
sendCommand ( $alias, $command, $params = [] )
sendMessage ( $alias, $message, $flags = Channel::MODE_DEFAULT )
sendRequest ( $alias, $message, $params = [] )
startProcess ( $alias, $params = [] )
startProcesses ( $aliases, $params = [] )
stopProcess ( $alias, $params = [] )
stopProcesses ( $aliases, $params = [] )

Protected Methods

Method Description
createRequest ( Kraken\Channel\ChannelInterface $channel, string $receiver, string $command ) : Request Create Request.

Private Methods

Method Description
phpCommand ( string $command, string[] $params = [], string[] $context = [] ) : string Run external PHP script.
selectFromStorage ( ) : string[][] Copy data from persistent storage to temporary one.
updateStorage ( string[] $with = [] ) Copy temporary process allocation data to persistent storage.

Method Details

__construct() public method

public __construct ( Kraken\Runtime\RuntimeContainerInterface $runtime, Kraken\Channel\ChannelInterface $channel, string[] $context, Kraken\Util\System\SystemInterface $system, Kraken\Filesystem\FilesystemInterface $fs )
$runtime Kraken\Runtime\RuntimeContainerInterface
$channel Kraken\Channel\ChannelInterface
$context string[]
$system Kraken\Util\System\SystemInterface
$fs Kraken\Filesystem\FilesystemInterface

__destruct() public method

public __destruct ( )

allocateProcess() public method

Allocate process.
public allocateProcess ( string $alias, string $name, string $pid ) : boolean
$alias string
$name string
$pid string
return boolean

createProcess() public method

public createProcess ( $alias, $name, $flags = Runtime::CREATE_DEFAULT, $params = [] )

createProcesses() public method

public createProcesses ( $definitions, $flags = Runtime::CREATE_DEFAULT, $params = [] )

createRequest() protected method

Create Request.
protected createRequest ( Kraken\Channel\ChannelInterface $channel, string $receiver, string $command ) : Request
$channel Kraken\Channel\ChannelInterface
$receiver string
$command string
return Kraken\Channel\Extra\Request

destroyProcess() public method

public destroyProcess ( $alias, $flags = Runtime::DESTROY_FORCE_SOFT, $params = [] )

destroyProcesses() public method

public destroyProcesses ( $aliases, $flags = Runtime::DESTROY_FORCE_SOFT, $params = [] )

existsProcess() public method

public existsProcess ( $alias )

flushProcesses() public method

public flushProcesses ( $flags = Runtime::DESTROY_KEEP )

freeProcess() public method

Free process.
public freeProcess ( string $alias ) : boolean
$alias string
return boolean

getProcesses() public method

public getProcesses ( )

sendCommand() public method

public sendCommand ( $alias, $command, $params = [] )

sendMessage() public method

public sendMessage ( $alias, $message, $flags = Channel::MODE_DEFAULT )

sendRequest() public method

public sendRequest ( $alias, $message, $params = [] )

startProcess() public method

public startProcess ( $alias, $params = [] )

startProcesses() public method

public startProcesses ( $aliases, $params = [] )

stopProcess() public method

public stopProcess ( $alias, $params = [] )

stopProcesses() public method

public stopProcesses ( $aliases, $params = [] )

Property Details

$channel protected property

protected ChannelInterface,Kraken\Channel $channel
return Kraken\Channel\ChannelInterface

$context protected property

protected string[] $context
return string[]

$fs protected property

protected FilesystemInterface,Kraken\Filesystem $fs
return Kraken\Filesystem\FilesystemInterface

$fsPath protected property

protected string $fsPath
return string

$processes protected property

protected string[][] $processes
return string[][]

$runtime protected property

protected RuntimeContainerInterface,Kraken\Runtime $runtime
return Kraken\Runtime\RuntimeContainerInterface

$scriptRoot protected property

protected string $scriptRoot
return string

$system protected property

protected SystemInterface,Kraken\Util\System $system
return Kraken\Util\System\SystemInterface