PHP Class Cronario\Producer

Inheritance: use trait TraitOptions
Afficher le fichier Open project: cronario/cronario Class Usage Examples

Protected Properties

Свойство Type Description
$appId
$config
$logger Psr\Log\LoggerInterface
$managerIgnoreSet
$managerSet region MANAGER ************************************************************
$queue
$redis
$storage Cronario\Storage\StorageInterface

Méthodes publiques

Méthode Description
__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

Méthodes protégées

Méthode Description
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 ( )

Method Details

__construct() public méthode

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

buildManagerId() protected méthode

protected buildManagerId ( $workerClass, $managerId ) : string
$workerClass
$managerId
Résultat string

calcManagerSize() protected méthode

protected calcManagerSize ( $countJobsReady, $managerPoolSize, $managersLimit ) : float
$countJobsReady
$managerPoolSize
$managersLimit
Résultat float

cleanData() protected méthode

protected cleanData ( )

cleanManagerSet() protected méthode

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

countManagerSet() protected méthode

protected countManagerSet ( ) : integer
Résultat integer

decData() protected méthode

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

deleteData() protected méthode

protected deleteData ( $key )
$key

getAppId() public méthode

public getAppId ( ) : string
Résultat string

getConfig() protected méthode

protected getConfig ( null $key = null ) : array | integer | string | null
$key null
Résultat array | integer | string | null

getData() protected méthode

protected getData ( null $key = null ) : array | string
$key null
Résultat array | string

getLogger() public méthode

public getLogger ( ) : Psr\Log\LoggerInterface
Résultat Psr\Log\LoggerInterface

getProcessId() protected méthode

protected getProcessId ( ) : array | string
Résultat array | string

getQueue() public méthode

public getQueue ( ) : Queue
Résultat Queue

getRedis() public méthode

public getRedis ( ) : Client
Résultat Predis\Client

getRedisNamespace() public méthode

public getRedisNamespace ( ) : string
Résultat string

getState() protected méthode

protected getState ( ) : array | string
Résultat array | string

getStats() public méthode

public getStats ( ) : array | string
Résultat array | string

getStorage() public méthode

public getStorage ( ) : Cronario\Storage\StorageInterface
Résultat Cronario\Storage\StorageInterface

incData() protected méthode

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

isState() protected méthode

protected isState ( $state ) : boolean
$state
Résultat boolean

isStateStart() public méthode

public isStateStart ( ) : boolean
Résultat boolean

kill() public méthode

public kill ( ) : boolean
Résultat boolean

mainLoop() protected méthode

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 méthode

protected parseManagerId ( $string ) : array
$string
Résultat array

processExists() protected méthode

protected processExists ( ) : boolean
Résultat boolean

processKill() protected méthode

protected processKill ( ) : string
Résultat string

reset() public méthode

public reset ( )

restart() public méthode

public restart ( )

setAppId() protected méthode

protected setAppId ( $appId )
$appId

setConfig() protected méthode

protected setConfig ( array $config )
$config array

setData() protected méthode

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

setLogger() protected méthode

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

setProcessId() protected méthode

protected setProcessId ( $id )
$id

setQueue() protected méthode

protected setQueue ( Queue $queue )
$queue Queue

setRedis() protected méthode

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

setState() protected méthode

protected setState ( $state )
$state

setStorage() protected méthode

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

start() public méthode

1) get
public start ( ) : boolean
Résultat boolean

stop() public méthode

public stop ( boolean $async = false ) : boolean
$async boolean
Résultat boolean

updateInfo() protected méthode

protected updateInfo ( )

updateManagerSet() protected méthode

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 méthode

protected waitManagersDone ( )

Property Details

$appId protected_oe property

protected $appId

$config protected_oe property

protected $config

$logger protected_oe property

protected LoggerInterface,Psr\Log $logger
Résultat Psr\Log\LoggerInterface

$managerIgnoreSet protected_oe property

protected $managerIgnoreSet

$managerSet protected_oe property

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

$queue protected_oe property

protected $queue

$redis protected_oe property

protected $redis

$storage protected_oe property

protected StorageInterface,Cronario\Storage $storage
Résultat Cronario\Storage\StorageInterface