Service
Service
- Full name:
\Hazaar\Warlock\Service
- Parent class:
\Hazaar\Warlock\Process
- This class is an Abstract class
Properties
name
protected string $name
config
protected \Hazaar\Map $config
schedule
protected array<int,mixed> $schedule
next
protected ?int $next
slept
protected bool $slept
lastHeartbeat
private int $lastHeartbeat
lastCheckfile
private int $lastCheckfile
serviceFile
private string $serviceFile
serviceFileMtime
private int $serviceFileMtime
__logLevels
private int[] $__logLevels
__strPad
private int $__strPad
__logFile
private string $__logFile
__log
private false|resource $__log
__localLogLevel
private int $__localLogLevel
__remote
private bool $__remote
Methods
__construct
final public __construct(\Hazaar\Application $application, \Hazaar\Warlock\Protocol $protocol, bool $remote = false): mixed
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$application | \Hazaar\Application | |
$protocol | \Hazaar\Warlock\Protocol | |
$remote | bool |
__destruct
public __destruct(): mixed
__errorHandler
final public __errorHandler(int $errno, string $errstr, ?string $errfile = null, ?int $errline = null, array $errcontext = []): bool
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$errno | int | |
$errstr | string | |
$errfile | ?string | |
$errline | ?int | |
$errcontext | array |
__exceptionHandler
final public __exceptionHandler(\Throwable $e): bool
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$e | \Throwable |
__processCommand
final protected __processCommand(string $command, mixed $payload = null): bool
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$command | string | |
$payload | mixed |
__processSchedule
private __processSchedule(): void
__sendHeartbeat
final protected __sendHeartbeat(): void
- This method is final.
__stateString
private __stateString(?int $state = null): string
Parameters:
Parameter | Type | Description |
---|---|---|
$state | ?int |
__rotateLogFiles
private __rotateLogFiles(int $logfiles): void
Parameters:
Parameter | Type | Description |
---|---|---|
$logfiles | int |
log
public log(int $level, mixed $message, ?string $name = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$level | int | |
$message | mixed | |
$name | ?string |
debug
public debug(mixed $data, ?string $name = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$data | mixed | |
$name | ?string |
main
final public main(array $params = null, bool $dynamic = false): int
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$params | array | |
$dynamic | bool |
run
public run(): void
shutdown
public shutdown(): bool
stop
final public stop(): void
- This method is final.
restart
final public restart(): bool
- This method is final.
state
final public state(): int
- This method is final.
delay
final public delay(int $seconds, callable|string $callback, ?\Hazaar\Map $arguments = null): bool|string
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$seconds | int | |
$callback | callable|string | |
$arguments | ?\Hazaar\Map |
interval
final public interval(int $seconds, callable|string $callback, ?\Hazaar\Map $params = null, ?string $tag = null, bool $overwrite = false): false|string
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$seconds | int | |
$callback | callable|string | |
$params | ?\Hazaar\Map | |
$tag | ?string | |
$overwrite | bool |
schedule
final public schedule(\Hazaar\Date $date, callable|string $callback, ?\Hazaar\Map $params = null, ?string $tag = null, bool $overwrite = false): false|string
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$date | \Hazaar\Date | |
$callback | callable|string | |
$params | ?\Hazaar\Map | |
$tag | ?string | |
$overwrite | bool |
cron
final public cron(string $format, callable|string $callback, array $arguments = null): bool|string
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$format | string | |
$callback | callable|string | |
$arguments | array |
cancel
final public cancel(string $id): bool
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$id | string |
signal
final public signal(string $eventID, mixed $data): bool
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$eventID | string | |
$data | mixed |
send
final public send(string $command, mixed $payload = null): bool
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$command | string | |
$payload | mixed |
recv
final public recv(mixed& $payload = null, int $tv_sec = 3, int $tv_usec): null|bool|string
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$payload | mixed | |
$tv_sec | int | |
$tv_usec | int |
connect
protected connect(\Hazaar\Warlock\Protocol $protocol, ?string $guid = null): \Hazaar\Warlock\Interfaces\Connection|false
Parameters:
Parameter | Type | Description |
---|---|---|
$protocol | \Hazaar\Warlock\Protocol | |
$guid | ?string |
sleep
Sleep for a number of seconds. If data is received during the sleep it is processed. If the timeout is greater than zero and data is received, the remaining timeout amount will be used in subsequent selects to ensure the full sleep period is used. If the timeout parameter is not set then the loop will just dump out after one execution.
final protected sleep(int $timeout): bool
- This method is final.
Parameters:
Parameter | Type | Description |
---|---|---|
$timeout | int |
invokeMethod
private invokeMethod(string $method, array $arguments = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$method | string | |
$arguments | array |
start
private start(): bool
Inherited methods
__construct
public __construct(\Hazaar\Application $application, \Hazaar\Warlock\Protocol $protocol, ?string $guid = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$application | \Hazaar\Application | |
$protocol | \Hazaar\Warlock\Protocol | |
$guid | ?string |
__destruct
public __destruct(): mixed
__processCommand
protected __processCommand(string $command, mixed $payload = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$command | string | |
$payload | mixed |
__kv_send_recv
private __kv_send_recv(string $command, array $data): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$command | string | |
$data | array |
send
public send(string $command, mixed $payload = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$command | string | |
$payload | mixed |
recv
public recv(mixed& $payload = null, int $tv_sec = 3, int $tv_usec): null|bool|string
Parameters:
Parameter | Type | Description |
---|---|---|
$payload | mixed | |
$tv_sec | int | |
$tv_usec | int |
ping
public ping(bool $waitPong = false): bool|string
Parameters:
Parameter | Type | Description |
---|---|---|
$waitPong | bool |
subscribe
public subscribe(string $event, string $callback, array<string,mixed> $filter = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$event | string | |
$callback | string | |
$filter | array<string,mixed> |
unsubscribe
public unsubscribe(string $event): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$event | string |
trigger
public trigger(string $event, mixed $data = null, bool $echoSelf = false): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$event | string | |
$data | mixed | |
$echoSelf | bool |
log
public log(int $level, string[]|string $message, ?string $name = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$level | int | |
$message | string[]|string | |
$name | ?string |
debug
public debug(mixed $data, ?string $name = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$data | mixed | |
$name | ?string |
spawn
public spawn(string $service, array $params = []): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$service | string | |
$params | array |
kill
public kill(string $service): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$service | string |
status
public status(): false|\stdClass
runDelay
public runDelay(int $delay, callable $callable, ?\Hazaar\Map $params = null, ?string $tag = null, bool $overwrite = false): bool|string
Parameters:
Parameter | Type | Description |
---|---|---|
$delay | int | |
$callable | callable | |
$params | ?\Hazaar\Map | |
$tag | ?string | |
$overwrite | bool |
interval
public interval(int $seconds, string $callable, ?\Hazaar\Map $params = null, ?string $tag = null, bool $overwrite = false): bool|string
Parameters:
Parameter | Type | Description |
---|---|---|
$seconds | int | |
$callable | string | |
$params | ?\Hazaar\Map | |
$tag | ?string | |
$overwrite | bool |
schedule
public schedule(\Hazaar\Date $when, string $callable, ?\Hazaar\Map $params = null, ?string $tag = null, bool $overwrite = false): bool|string
Parameters:
Parameter | Type | Description |
---|---|---|
$when | \Hazaar\Date | |
$callable | string | |
$params | ?\Hazaar\Map | |
$tag | ?string | |
$overwrite | bool |
cancel
public cancel(string $taskID): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$taskID | string |
startService
public startService(string $name): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$name | string |
stopService
public stopService(string $name): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$name | string |
service
public service(string $name): bool|string
Parameters:
Parameter | Type | Description |
---|---|---|
$name | string |
get
public get(string $key, ?string $namespace = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$namespace | ?string |
set
public set(string $key, mixed $value, ?int $timeout = null, ?string $namespace = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$value | mixed | |
$timeout | ?int | |
$namespace | ?string |
has
public has(string $key, ?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$namespace | ?string |
del
public del(string $key, ?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$namespace | ?string |
clear
public clear(?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$namespace | ?string |
list
public list(?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$namespace | ?string |
pull
public pull(string $key, ?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$namespace | ?string |
push
public push(string $key, mixed $value, ?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$value | mixed | |
$namespace | ?string |
pop
public pop(string $key, ?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$namespace | ?string |
shift
public shift(string $key, ?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$namespace | ?string |
unshift
public unshift(string $key, mixed $value, ?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$value | mixed | |
$namespace | ?string |
incr
public incr(string $key, ?int $step = null, ?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$step | ?int | |
$namespace | ?string |
decr
public decr(string $key, ?int $step = null, ?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$step | ?int | |
$namespace | ?string |
keys
public keys(?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$namespace | ?string |
vals
public vals(?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$namespace | ?string |
count
public count(string $key, ?string $namespace = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$key | string | |
$namespace | ?string |
runner
public static runner(\Hazaar\Application $application, array $argv = null): int
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$application | \Hazaar\Application | |
$argv | array |
getServiceClass
public static getServiceClass(string $serviceName, \Hazaar\Application $application, \Hazaar\Warlock\Protocol $protocol, bool $remote = false): false|\Hazaar\Warlock\Service
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$serviceName | string | |
$application | \Hazaar\Application | |
$protocol | \Hazaar\Warlock\Protocol | |
$remote | bool |
setErrorHandler
protected setErrorHandler(string $methodName): ?callable
Parameters:
Parameter | Type | Description |
---|---|---|
$methodName | string |
setExceptionHandler
protected setExceptionHandler(string $methodName): ?callable
Parameters:
Parameter | Type | Description |
---|---|---|
$methodName | string |
connect
protected connect(\Hazaar\Warlock\Protocol $protocol, ?string $guid = null): \Hazaar\Warlock\Interfaces\Connection|false
Parameters:
Parameter | Type | Description |
---|---|---|
$protocol | \Hazaar\Warlock\Protocol | |
$guid | ?string |
disconnect
protected disconnect(): void
connected
protected connected(): bool
makeCallable
protected makeCallable(callable|\Closure $callable): array<string,mixed>
Parameters:
Parameter | Type | Description |
---|---|---|
$callable | callable|\Closure |
sendExec
private sendExec(string $command, mixed $data, callable $callable, ?\Hazaar\Map $params = null, ?string $tag = null, bool $overwrite = false): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$command | string | |
$data | mixed | |
$callable | callable | |
$params | ?\Hazaar\Map | |
$tag | ?string | |
$overwrite | bool |
getopt
private static getopt(): array<string,mixed>
- This method is static.
showHelp
private static showHelp(): int
- This method is static.
Automatically generated on 2024-11-14