PHP 클래스 Cronario\Producer

상속: use trait TraitOptions
파일 보기 프로젝트 열기: cronario/cronario 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$appId
$config
$logger Psr\Log\LoggerInterface
$managerIgnoreSet
$managerSet region MANAGER ************************************************************
$queue
$redis
$storage Cronario\Storage\StorageInterface

공개 메소드들

메소드 설명
__construct ( array $options = [] )
getAppId ( ) : string
getLogger ( ) : Psr\Log\LoggerInterface
getQueue ( ) : Queue
getRedis ( ) : Client
getRedisNamespace ( ) : string
getStats ( ) : array | string
getStorage ( ) : Cronario\Storage\StorageInterface
isStateStart ( ) : boolean
kill ( ) : boolean
reset ( )
restart ( )
start ( ) : boolean START daemon
stop ( boolean $async = false ) : boolean

보호된 메소드들

메소드 설명
buildManagerId ( $workerClass, $managerId ) : string
calcManagerSize ( $countJobsReady, $managerPoolSize, $managersLimit ) : float
cleanData ( )
cleanManagerSet ( ) Clean Manager SET
countManagerSet ( ) : integer
decData ( $key, integer $by = 1 )
deleteData ( $key )
getConfig ( null $key = null ) : array | integer | string | null
getData ( null $key = null ) : array | string
getProcessId ( ) : array | string
getState ( ) : array | string
incData ( $key, integer $by = 1 )
isState ( $state ) : boolean
mainLoop ( ) Daemon Main Loop 1) checking if Daemon should finish work (if redis flag is finish then finish loop) 2) updating info about loop and current process 3) Migrate all 'delayed job' to 'ready queue' if time is become 4) Update Manager set with theirs worker balance (create new Managers if needed) 5) Clean Manager if they are finished theirs works 6) loop sleep cause and run again until redis flag is 'start'
parseManagerId ( $string ) : array
processExists ( ) : boolean
processKill ( ) : string
setAppId ( $appId )
setConfig ( array $config )
setData ( $key, $value )
setLogger ( Psr\Log\LoggerInterface $logger )
setProcessId ( $id )
setQueue ( Queue $queue )
setRedis ( Client $redis )
setState ( $state )
setStorage ( Cronario\Storage\StorageInterface $storage )
updateInfo ( )
updateManagerSet ( ) Update Manager SET
waitManagersDone ( )

메소드 상세

__construct() 공개 메소드

public __construct ( array $options = [] )
$options array

buildManagerId() 보호된 메소드

protected buildManagerId ( $workerClass, $managerId ) : string
$workerClass
$managerId
리턴 string

calcManagerSize() 보호된 메소드

protected calcManagerSize ( $countJobsReady, $managerPoolSize, $managersLimit ) : float
$countJobsReady
$managerPoolSize
$managersLimit
리턴 float

cleanData() 보호된 메소드

protected cleanData ( )

cleanManagerSet() 보호된 메소드

Checking each manager in ManagerSet and delete manager that done theirs work
protected cleanManagerSet ( )

countManagerSet() 보호된 메소드

protected countManagerSet ( ) : integer
리턴 integer

decData() 보호된 메소드

protected decData ( $key, integer $by = 1 )
$key
$by integer

deleteData() 보호된 메소드

protected deleteData ( $key )
$key

getAppId() 공개 메소드

public getAppId ( ) : string
리턴 string

getConfig() 보호된 메소드

protected getConfig ( null $key = null ) : array | integer | string | null
$key null
리턴 array | integer | string | null

getData() 보호된 메소드

protected getData ( null $key = null ) : array | string
$key null
리턴 array | string

getLogger() 공개 메소드

public getLogger ( ) : Psr\Log\LoggerInterface
리턴 Psr\Log\LoggerInterface

getProcessId() 보호된 메소드

protected getProcessId ( ) : array | string
리턴 array | string

getQueue() 공개 메소드

public getQueue ( ) : Queue
리턴 Queue

getRedis() 공개 메소드

public getRedis ( ) : Client
리턴 Predis\Client

getRedisNamespace() 공개 메소드

public getRedisNamespace ( ) : string
리턴 string

getState() 보호된 메소드

protected getState ( ) : array | string
리턴 array | string

getStats() 공개 메소드

public getStats ( ) : array | string
리턴 array | string

getStorage() 공개 메소드

public getStorage ( ) : Cronario\Storage\StorageInterface
리턴 Cronario\Storage\StorageInterface

incData() 보호된 메소드

protected incData ( $key, integer $by = 1 )
$key
$by integer

isState() 보호된 메소드

protected isState ( $state ) : boolean
$state
리턴 boolean

isStateStart() 공개 메소드

public isStateStart ( ) : boolean
리턴 boolean

kill() 공개 메소드

public kill ( ) : boolean
리턴 boolean

mainLoop() 보호된 메소드

Daemon Main Loop 1) checking if Daemon should finish work (if redis flag is finish then finish loop) 2) updating info about loop and current process 3) Migrate all 'delayed job' to 'ready queue' if time is become 4) Update Manager set with theirs worker balance (create new Managers if needed) 5) Clean Manager if they are finished theirs works 6) loop sleep cause and run again until redis flag is 'start'
protected mainLoop ( )

parseManagerId() 보호된 메소드

protected parseManagerId ( $string ) : array
$string
리턴 array

processExists() 보호된 메소드

protected processExists ( ) : boolean
리턴 boolean

processKill() 보호된 메소드

protected processKill ( ) : string
리턴 string

reset() 공개 메소드

public reset ( )

restart() 공개 메소드

public restart ( )

setAppId() 보호된 메소드

protected setAppId ( $appId )
$appId

setConfig() 보호된 메소드

protected setConfig ( array $config )
$config array

setData() 보호된 메소드

protected setData ( $key, $value )
$key
$value

setLogger() 보호된 메소드

protected setLogger ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface

setProcessId() 보호된 메소드

protected setProcessId ( $id )
$id

setQueue() 보호된 메소드

protected setQueue ( Queue $queue )
$queue Queue

setRedis() 보호된 메소드

protected setRedis ( Client $redis )
$redis Predis\Client

setState() 보호된 메소드

protected setState ( $state )
$state

setStorage() 보호된 메소드

protected setStorage ( Cronario\Storage\StorageInterface $storage )
$storage Cronario\Storage\StorageInterface

start() 공개 메소드

1) get
public start ( ) : boolean
리턴 boolean

stop() 공개 메소드

public stop ( boolean $async = false ) : boolean
$async boolean
리턴 boolean

updateInfo() 보호된 메소드

protected updateInfo ( )

updateManagerSet() 보호된 메소드

REMEMBER queueName === workerClass (cause we have relation one queue name for one type of worker) 1) get Queue stats for all queues on server 2) filter queues (stopping flag / existing ready job in it) 3) get worker configuration (to know what manager balance should do later) - if worker have problems with config we will add him to ignore manager set 4) then we try to create manager depend on exists managerSet and current balance
protected updateManagerSet ( )

waitManagersDone() 보호된 메소드

protected waitManagersDone ( )

프로퍼티 상세

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

protected $appId

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

protected $config

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

protected LoggerInterface,Psr\Log $logger
리턴 Psr\Log\LoggerInterface

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

protected $managerIgnoreSet

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

region MANAGER ************************************************************
protected $managerSet

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

protected $queue

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

protected $redis

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

protected StorageInterface,Cronario\Storage $storage
리턴 Cronario\Storage\StorageInterface