PHP Interface Kraken\Runtime\RuntimeModelInterface

Inheritance: extends Kraken\Runtime\RuntimeContextInterface, extends Kraken\Runtime\RuntimeManagerAwareInterface, extends Kraken\Supervision\SupervisorAwareInterface, extends Kraken\Core\CoreAwareInterface, extends Kraken\Event\EventEmitterAwareInterface, extends Kraken\Loop\LoopExtendedAwareInterface
Show file Open project: kraken-php/framework Interface Usage Examples

Public Methods

Method Description
create ( ) : Kraken\Promise\PromiseInterface Create model.
destroy ( ) : Kraken\Promise\PromiseInterface Destroy model.
fail ( Erro\Error | Exceptio\Exception $ex, mixed[] $params = [] ) Temporarily switch model to failed workflow and allow supervisor to take control.
getHash ( ) : string | null Return failure hash if the container is in the failed state or null if it is not.
getState ( ) : integer Return state of model.
isCreated ( ) : boolean Checks if model is in created state.
isDestroyed ( ) : boolean Checks if model is in destroyed state.
isFailed ( ) : boolean Checks if model is in stopped state.
isStarted ( ) : boolean Checks if model is in started state.
isState ( integer $state ) : boolean Checks if model is in specified state.
isStopped ( ) : boolean Checks if model is in stopped state.
setState ( integer $state ) Set state of model.
start ( ) : Kraken\Promise\PromiseInterface Start model.
state ( ) : integer
stop ( ) : Kraken\Promise\PromiseInterface Stop model.
succeed ( ) Switch back from failed to normal workflow.

Method Details

create() public method

Create model.
public create ( ) : Kraken\Promise\PromiseInterface
return Kraken\Promise\PromiseInterface

destroy() public method

Destroy model.
public destroy ( ) : Kraken\Promise\PromiseInterface
return Kraken\Promise\PromiseInterface

fail() public method

Temporarily switch model to failed workflow and allow supervisor to take control.
public fail ( Erro\Error | Exceptio\Exception $ex, mixed[] $params = [] )
$ex Erro\Error | Exceptio\Exception
$params mixed[]

getHash() public method

Return failure hash if the container is in the failed state or null if it is not.
public getHash ( ) : string | null
return string | null

getState() public method

Returned value might be one of: Runtime::STATE_CREATED Runtime::STATE_STARTED Runtime::STATE_STOPPED Runtime::STATE_DESTROYED
public getState ( ) : integer
return integer

isCreated() public method

Checks if model is in created state.
public isCreated ( ) : boolean
return boolean

isDestroyed() public method

Checks if model is in destroyed state.
public isDestroyed ( ) : boolean
return boolean

isFailed() public method

Checks if model is in stopped state.
public isFailed ( ) : boolean
return boolean

isStarted() public method

Checks if model is in started state.
public isStarted ( ) : boolean
return boolean

isState() public method

State might be one of: Runtime::STATE_CREATED Runtime::STATE_STARTED Runtime::STATE_STOPPED Runtime::STATE_DESTROYED Runtime::STATE_FAILED
public isState ( integer $state ) : boolean
$state integer
return boolean

isStopped() public method

Checks if model is in stopped state.
public isStopped ( ) : boolean
return boolean

setState() public method

The state might be one of: Runtime::STATE_CREATED Runtime::STATE_STARTED Runtime::STATE_STOPPED Runtime::STATE_DESTROYED
public setState ( integer $state )
$state integer

start() public method

Start model.
public start ( ) : Kraken\Promise\PromiseInterface
return Kraken\Promise\PromiseInterface

state() public method

public state ( ) : integer
return integer

stop() public method

Stop model.
public stop ( ) : Kraken\Promise\PromiseInterface
return Kraken\Promise\PromiseInterface

succeed() public method

Switch back from failed to normal workflow.
public succeed ( )