feat: establish catalog identity and atomic file ownership
This commit is contained in:
1 parent
390a7a557a
commit
6b9fb54b4f
16 files changed
+1381
-23
No files matched your search
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MeshVault\Tests\Integration;
|
||||
|
||||
use ArrayObject;
|
||||
use PDOStatement;
|
||||
|
||||
/** Records execution, including the lock attempt that throws, rather than just SQL preparation. */
|
||||
final class CatalogLockStatement extends PDOStatement
|
||||
{
|
||||
protected function __construct(private ArrayObject $locks)
|
||||
{
|
||||
}
|
||||
|
||||
public function execute(?array $params = null): bool
|
||||
{
|
||||
if (preg_match('/SELECT .* FROM files WHERE id = \? FOR UPDATE$/i', $this->queryString)) {
|
||||
$this->locks[] = $params;
|
||||
}
|
||||
return parent::execute($params);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user