PHP 인터페이스 Kraken\Loop\LoopModelInterface

파일 보기 프로젝트 열기: kraken-php/framework 0 사용 예제들

공개 메소드들

메소드 설명
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 ( )