PHP Класс Cronario\Producer

Наследование: use trait TraitOptions
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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