-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There were very minor edge cases with the previous system that had issues when users paused a torrent immediately after they completed it, causing data to be duplicated. We now opt to use DTOs to transfer the data into the job queue instead of models to prevent the extra database queries caused by passing models into a job queue.
- Loading branch information
Showing
8 changed files
with
440 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE. | ||
* | ||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0 | ||
* The details is bundled with this project in the file LICENSE.txt. | ||
* | ||
* @project UNIT3D Community Edition | ||
* | ||
* @author Roardom <roardom@protonmail.com> | ||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 | ||
*/ | ||
|
||
namespace App\DTO; | ||
|
||
readonly class AnnounceGroupDTO | ||
{ | ||
public function __construct( | ||
public bool $isFreeleech, | ||
public bool $isDoubleUpload, | ||
public bool $isImmune, | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE. | ||
* | ||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0 | ||
* The details is bundled with this project in the file LICENSE.txt. | ||
* | ||
* @project UNIT3D Community Edition | ||
* | ||
* @author Roardom <roardom@protonmail.com> | ||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 | ||
*/ | ||
|
||
namespace App\DTO; | ||
|
||
readonly class AnnouncePeerDTO | ||
{ | ||
public function __construct( | ||
public bool $active, | ||
public int $uploaded, | ||
public int $downloaded, | ||
public int $left, | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE. | ||
* | ||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0 | ||
* The details is bundled with this project in the file LICENSE.txt. | ||
* | ||
* @project UNIT3D Community Edition | ||
* | ||
* @author Roardom <roardom@protonmail.com> | ||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 | ||
*/ | ||
|
||
namespace App\DTO; | ||
|
||
readonly class AnnounceQueryDTO | ||
{ | ||
private string $agent; | ||
private string $infoHash; | ||
private string $peerId; | ||
private string $ip; | ||
|
||
public function __construct( | ||
public int $port, | ||
public int $uploaded, | ||
public int $downloaded, | ||
public int $left, | ||
public int $corrupt, | ||
public int $numwant, | ||
public string $event, | ||
public string $key, | ||
string $agent, | ||
string $infoHash, | ||
string $peerId, | ||
string $ip, | ||
) { | ||
$this->agent = bin2hex($agent); | ||
$this->infoHash = bin2hex($infoHash); | ||
$this->peerId = bin2hex($peerId); | ||
$this->ip = bin2hex($ip); | ||
} | ||
|
||
public function getAgent(): string | ||
{ | ||
/** @var string */ | ||
return hex2bin($this->agent); | ||
} | ||
|
||
public function getInfoHash(): string | ||
{ | ||
/** @var string */ | ||
return hex2bin($this->infoHash); | ||
} | ||
|
||
public function getPeerId(): string | ||
{ | ||
/** @var string */ | ||
return hex2bin($this->peerId); | ||
} | ||
|
||
public function getIp(): string | ||
{ | ||
/** @var string */ | ||
return hex2bin($this->ip); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE. | ||
* | ||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0 | ||
* The details is bundled with this project in the file LICENSE.txt. | ||
* | ||
* @project UNIT3D Community Edition | ||
* | ||
* @author Roardom <roardom@protonmail.com> | ||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 | ||
*/ | ||
|
||
namespace App\DTO; | ||
|
||
readonly class AnnounceTorrentDTO | ||
{ | ||
public function __construct( | ||
public int $id, | ||
public int $percentFree, | ||
public bool $isDoubleUpload, | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE. | ||
* | ||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0 | ||
* The details is bundled with this project in the file LICENSE.txt. | ||
* | ||
* @project UNIT3D Community Edition | ||
* | ||
* @author Roardom <roardom@protonmail.com> | ||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 | ||
*/ | ||
|
||
namespace App\DTO; | ||
|
||
readonly class AnnounceUserDTO | ||
{ | ||
public function __construct( | ||
public int $id, | ||
public AnnounceGroupDTO $group, | ||
) { | ||
} | ||
} |
Oops, something went wrong.