1
0
Fork 0
mirror of synced 2024-09-30 09:18:14 +13:00

fix(realtime): phpdoc and access modifiers

This commit is contained in:
Torsten Dittmann 2021-06-15 09:15:14 +02:00
parent 03b03bbcc2
commit d8bae25438
2 changed files with 43 additions and 38 deletions

View file

@ -550,24 +550,24 @@ services:
# - RESQUE_WEB_HTTP_BASIC_AUTH_USER=user # - RESQUE_WEB_HTTP_BASIC_AUTH_USER=user
# - RESQUE_WEB_HTTP_BASIC_AUTH_PASSWORD=password # - RESQUE_WEB_HTTP_BASIC_AUTH_PASSWORD=password
# chronograf: chronograf:
# image: chronograf:1.5 image: chronograf:1.5
# container_name: appwrite-chronograf container_name: appwrite-chronograf
# restart: unless-stopped restart: unless-stopped
# networks: networks:
# - appwrite - appwrite
# volumes: volumes:
# - appwrite-chronograf:/var/lib/chronograf - appwrite-chronograf:/var/lib/chronograf
# ports: ports:
# - "8888:8888" - "8888:8888"
# environment: environment:
# - INFLUXDB_URL=http://influxdb:8086 - INFLUXDB_URL=http://influxdb:8086
# - KAPACITOR_URL=http://kapacitor:9092 - KAPACITOR_URL=http://kapacitor:9092
# - AUTH_DURATION=48h - AUTH_DURATION=48h
# - TOKEN_SECRET=duperduper5674829!jwt - TOKEN_SECRET=duperduper5674829!jwt
# - GH_CLIENT_ID=d86f7145a41eacfc52cc - GH_CLIENT_ID=d86f7145a41eacfc52cc
# - GH_CLIENT_SECRET=9e0081062367a2134e7f2ea95ba1a32d08b6c8ab - GH_CLIENT_SECRET=9e0081062367a2134e7f2ea95ba1a32d08b6c8ab
# - GH_ORGS=appwrite - GH_ORGS=appwrite
# webgrind: # webgrind:
# image: 'jokkedk/webgrind:latest' # image: 'jokkedk/webgrind:latest'
@ -591,4 +591,4 @@ volumes:
appwrite-functions: appwrite-functions:
appwrite-influxdb: appwrite-influxdb:
appwrite-config: appwrite-config:
# appwrite-chronograf: appwrite-chronograf:

View file

@ -55,10 +55,11 @@ class Server
/** /**
* This is executed when the Realtime server starts. * This is executed when the Realtime server starts.
*
* @param SwooleServer $server * @param SwooleServer $server
* @return void * @return void
*/ */
public function onStart(SwooleServer $server): void private function onStart(SwooleServer $server): void
{ {
Console::success('Server started succefully'); Console::success('Server started succefully');
Console::info("Master pid {$server->master_pid}, manager pid {$server->manager_pid}"); Console::info("Master pid {$server->master_pid}, manager pid {$server->manager_pid}");
@ -101,12 +102,13 @@ class Server
/** /**
* This is executed when a WebSocket worker process starts. * This is executed when a WebSocket worker process starts.
*
* @param SwooleServer $server * @param SwooleServer $server
* @param int $workerId * @param int $workerId
* @return void * @return void
* @throws Exception * @throws Exception
*/ */
public function onWorkerStart(SwooleServer $server, int $workerId): void private function onWorkerStart(SwooleServer $server, int $workerId): void
{ {
Console::success('Worker ' . $workerId . ' started succefully'); Console::success('Worker ' . $workerId . ' started succefully');
@ -163,7 +165,7 @@ class Server
* @throws Exception * @throws Exception
* @throws UtopiaException * @throws UtopiaException
*/ */
public function onOpen(SwooleServer $server, Request $request): void private function onOpen(SwooleServer $server, Request $request): void
{ {
$app = new App('UTC'); $app = new App('UTC');
$connection = $request->fd; $connection = $request->fd;
@ -284,11 +286,12 @@ class Server
/** /**
* This is executed when a message is received by the Realtime server. * This is executed when a message is received by the Realtime server.
*
* @param SwooleServer $server * @param SwooleServer $server
* @param Frame $frame * @param Frame $frame
* @return void * @return void
*/ */
public function onMessage(SwooleServer $server, Frame $frame) private function onMessage(SwooleServer $server, Frame $frame)
{ {
$server->push($frame->fd, 'Sending messages is not allowed.'); $server->push($frame->fd, 'Sending messages is not allowed.');
$server->close($frame->fd); $server->close($frame->fd);
@ -296,11 +299,12 @@ class Server
/** /**
* This is executed when a Realtime connection is closed. * This is executed when a Realtime connection is closed.
*
* @param SwooleServer $server * @param SwooleServer $server
* @param int $connection * @param int $connection
* @return void * @return void
*/ */
public function onClose(SwooleServer $server, int $connection) private function onClose(SwooleServer $server, int $connection)
{ {
if (array_key_exists($connection, $this->connections)) { if (array_key_exists($connection, $this->connections)) {
$this->stats->decr($this->connections[$connection]['projectId'], 'connectionsTotal'); $this->stats->decr($this->connections[$connection]['projectId'], 'connectionsTotal');
@ -311,25 +315,25 @@ class Server
/** /**
* This is executed when an event is published on realtime channel in Redis. * This is executed when an event is published on realtime channel in Redis.
*
* Supported Resources:
* - Collection
* - Document
* - File
* - Account
* - Session
* - Team? (not implemented yet)
* - Membership? (not implemented yet)
* - Function
* - Execution
*
* @param string $payload * @param string $payload
* @param SwooleServer $server * @param SwooleServer $server
* @param int $workerId * @param int $workerId
* @return void * @return void
*/ */
public function onRedisPublish(string $payload, SwooleServer &$server, int $workerId) private function onRedisPublish(string $payload, SwooleServer &$server, int $workerId)
{ {
/**
* Supported Resources:
* - Collection
* - Document
* - File
* - Account
* - Session
* - Team? (not implemented yet)
* - Membership? (not implemented yet)
* - Function
* - Execution
*/
$event = json_decode($payload, true); $event = json_decode($payload, true);
$receivers = Parser::identifyReceivers($event, $this->subscriptions); $receivers = Parser::identifyReceivers($event, $this->subscriptions);
@ -361,10 +365,11 @@ class Server
/** /**
* This sends the usage to the `console` channel. * This sends the usage to the `console` channel.
*
* @param SwooleServer $server * @param SwooleServer $server
* @return void * @return void
*/ */
public function tickSendProjectUsage(SwooleServer &$server) private function tickSendProjectUsage(SwooleServer &$server)
{ {
if ( if (
array_key_exists('console', $this->subscriptions) array_key_exists('console', $this->subscriptions)