PHP Интерфейс Kraken\Loop\LoopModelInterface

Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
addPeriodicTimer ( float $interval, callable $callback ) : Kraken\Loop\Timer\TimerInterface Enqueue a callback to be invoked repeatedly after the given interval.
addReadStream ( resource $stream, callable $listener ) Register a listener to be notified when a stream is ready to read.
addTimer ( float $interval, callable $callback ) : Kraken\Loop\Timer\TimerInterface Enqueue a callback to be invoked once after the given interval.
addWriteStream ( resource $stream, callable $listener ) Register a listener to be notified when a stream is ready to write.
cancelTimer ( Kraken\Loop\Timer\TimerInterface $timer ) Cancel a pending timer.
erase ( boolean $all = false ) : Kraken\Loop\LoopModelInterface Flush loop.
export ( Kraken\Loop\LoopModelInterface $loop, boolean $all = false ) : Kraken\Loop\LoopModelInterface Export loop not fired handlers and/or streams to another loop model.
getFlowController ( ) : FlowController Return FlowController used by model.
import ( Kraken\Loop\LoopModelInterface $loop, boolean $all = false ) : Kraken\Loop\LoopModelInterface Import handlers and/or streams from another loop model.
isRunning ( ) : boolean Check if loop is currently running.
isTimerActive ( Kraken\Loop\Timer\TimerInterface $timer ) : boolean Check if a given timer is active.
onAfterTick ( callable $listener ) Schedule a callback to be invoked on a future tick of the event loop.
onBeforeTick ( callable $listener ) Schedule a callback to be invoked on the next tick of the event loop.
onStart ( callable $listener ) Schedule a callback to be invoked on the start tick of event loop.
onStop ( callable $listener ) Schedule a callback to be invoked on the stop tick of event loop.
removeReadStream ( resource $stream ) Remove the read event listener for the given stream.
removeStream ( resource $stream ) Remove all listeners for the given stream.
removeWriteStream ( resource $stream ) Remove the write event listener for the given stream.
setFlowController ( mixed $flowController ) Set FlowController used by model.
start ( ) Run the event loop until there are no more tasks to perform.
stop ( ) Instruct a running event loop to stop.
swap ( Kraken\Loop\LoopModelInterface $loop, boolean $all = false ) : Kraken\Loop\LoopModelInterface Swap handlers and/or stream between loop models.
tick ( ) Perform a single iteration of the event loop.

Описание методов

addPeriodicTimer() публичный Метод

The execution order of timers scheduled to execute at the same time is not guaranteed.
public addPeriodicTimer ( float $interval, callable $callback ) : Kraken\Loop\Timer\TimerInterface
$interval float
$callback callable
Результат Kraken\Loop\Timer\TimerInterface

addReadStream() публичный Метод

Register a listener to be notified when a stream is ready to read.
public addReadStream ( resource $stream, callable $listener )
$stream resource
$listener callable

addTimer() публичный Метод

The execution order of timers scheduled to execute at the same time is not guaranteed.
public addTimer ( float $interval, callable $callback ) : Kraken\Loop\Timer\TimerInterface
$interval float
$callback callable
Результат Kraken\Loop\Timer\TimerInterface

addWriteStream() публичный Метод

Register a listener to be notified when a stream is ready to write.
public addWriteStream ( resource $stream, callable $listener )
$stream resource
$listener callable

cancelTimer() публичный Метод

Cancel a pending timer.
public cancelTimer ( Kraken\Loop\Timer\TimerInterface $timer )
$timer Kraken\Loop\Timer\TimerInterface

erase() публичный Метод

Flush loop.
public erase ( boolean $all = false ) : Kraken\Loop\LoopModelInterface
$all boolean
Результат Kraken\Loop\LoopModelInterface

export() публичный Метод

Export loop not fired handlers and/or streams to another loop model.
public export ( Kraken\Loop\LoopModelInterface $loop, boolean $all = false ) : Kraken\Loop\LoopModelInterface
$loop Kraken\Loop\LoopModelInterface
$all boolean
Результат Kraken\Loop\LoopModelInterface

getFlowController() публичный Метод

Return FlowController used by model.
public getFlowController ( ) : FlowController
Результат Kraken\Loop\Flow\FlowController

import() публичный Метод

Import handlers and/or streams from another loop model.
public import ( Kraken\Loop\LoopModelInterface $loop, boolean $all = false ) : Kraken\Loop\LoopModelInterface
$loop Kraken\Loop\LoopModelInterface
$all boolean
Результат Kraken\Loop\LoopModelInterface

isRunning() публичный Метод

Check if loop is currently running.
public isRunning ( ) : boolean
Результат boolean

isTimerActive() публичный Метод

Check if a given timer is active.
public isTimerActive ( Kraken\Loop\Timer\TimerInterface $timer ) : boolean
$timer Kraken\Loop\Timer\TimerInterface
Результат boolean

onAfterTick() публичный Метод

Callbacks are guaranteed to be executed in the order they are enqueued.
public onAfterTick ( callable $listener )
$listener callable

onBeforeTick() публичный Метод

Callbacks are guaranteed to be executed in the order they are enqueued, before any timer or stream events.
public onBeforeTick ( callable $listener )
$listener callable

onStart() публичный Метод

Callbacks are guarenteed to be executed in the order they are enqueued, before anything else.
public onStart ( callable $listener )
$listener callable

onStop() публичный Метод

Callbacks are guarenteed to be executed in the order they are enqueued.
public onStop ( callable $listener )
$listener callable

removeReadStream() публичный Метод

Remove the read event listener for the given stream.
public removeReadStream ( resource $stream )
$stream resource

removeStream() публичный Метод

Remove all listeners for the given stream.
public removeStream ( resource $stream )
$stream resource

removeWriteStream() публичный Метод

Remove the write event listener for the given stream.
public removeWriteStream ( resource $stream )
$stream resource

setFlowController() публичный Метод

Set FlowController used by model.
public setFlowController ( mixed $flowController )
$flowController mixed

start() публичный Метод

Run the event loop until there are no more tasks to perform.
public start ( )

stop() публичный Метод

Instruct a running event loop to stop.
public stop ( )

swap() публичный Метод

Swap handlers and/or stream between loop models.
public swap ( Kraken\Loop\LoopModelInterface $loop, boolean $all = false ) : Kraken\Loop\LoopModelInterface
$loop Kraken\Loop\LoopModelInterface
$all boolean
Результат Kraken\Loop\LoopModelInterface

tick() публичный Метод

Perform a single iteration of the event loop.
public tick ( )