2020final class PostgresAdvisoryLocker
2121{
2222 /**
23- * Acquire a transaction-level advisory lock with a configurable acquisition type and mode.
23+ * Acquire a transaction-level advisory lock with configurable wait and access modes.
24+ *
25+ * TODO: Cover with tests
26+ */
27+ public function acquireTransactionLevelLockHandler (
28+ PDO $ dbConnection ,
29+ PostgresLockId $ postgresLockId ,
30+ PostgresAdvisoryLockWaitModeEnum $ waitMode = PostgresAdvisoryLockWaitModeEnum::NonBlocking,
31+ PostgresLockAccessModeEnum $ accessMode = PostgresLockAccessModeEnum::Exclusive,
32+ ): AdvisoryLockTransactionLevel {
33+ return new AdvisoryLockTransactionLevel (
34+ wasAcquired: $ this ->acquireLock (
35+ $ dbConnection ,
36+ $ postgresLockId ,
37+ PostgresAdvisoryLockLevelEnum::Transaction,
38+ $ waitMode ,
39+ $ accessMode ,
40+ ),
41+ );
42+ }
43+
44+ /**
45+ * Acquire a transaction-level advisory lock with configurable wait and access modes.
2446 */
2547 public function acquireTransactionLevelLock (
2648 PDO $ dbConnection ,
@@ -38,7 +60,7 @@ public function acquireTransactionLevelLock(
3860 }
3961
4062 /**
41- * Acquire a session-level advisory lock with a configurable wait & access modes.
63+ * Acquire a session-level advisory lock with configurable wait and access modes.
4264 *
4365 * TODO: Write that transaction-level is recommended.
4466 * TODO: Cover with tests
@@ -65,7 +87,7 @@ public function acquireSessionLevelLockHandler(
6587 }
6688
6789 /**
68- * Acquire a session-level advisory lock with a configurable wait & access modes.
90+ * Acquire a session-level advisory lock with configurable wait and access modes.
6991 *
7092 * TODO: Write that transaction-level is recommended.
7193 */
0 commit comments