Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 03acce4

Browse filesBrowse files
committed
[Lock][WIP] Address some of reviews comments and CS
1 parent 93677c8 commit 03acce4
Copy full SHA for 03acce4

File tree

Expand file treeCollapse file tree

4 files changed

+24
-16
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+24
-16
lines changed

‎src/Symfony/Component/Lock/Bridge/DynamoDb/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Bridge/DynamoDb/CHANGELOG.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ CHANGELOG
44
7.3
55
---
66

7-
* Introduced the Amazon DynamoDb bridge.
7+
* Add the bridge

‎src/Symfony/Component/Lock/Bridge/DynamoDb/LICENSE

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Bridge/DynamoDb/LICENSE
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2020-present Fabien Potencier
1+
Copyright (c) 2025-present Fabien Potencier
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

‎src/Symfony/Component/Lock/Bridge/DynamoDb/README.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Bridge/DynamoDb/README.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Amazon DynamoDb Lock
1+
Amazon DynamoDB Lock
22
====================
33

4-
Provides Amazon DynamoDb integration for Symfony Lock.
4+
Provides Amazon DynamoDB integration for Symfony Lock.
55

66
Resources
77
---------

‎src/Symfony/Component/Lock/Bridge/DynamoDb/Store/DynamoDbStore.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Lock/Bridge/DynamoDb/Store/DynamoDbStore.php
+20-12Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@
2222
use Symfony\Component\Lock\PersistingStoreInterface;
2323
use Symfony\Component\Lock\Store\ExpiringStoreTrait;
2424

25+
/**
26+
* This file is part of the Symfony package.
27+
*
28+
* (c) Fabien Potencier <fabien@symfony.com>
29+
*
30+
* For the full copyright and license information, please view the LICENSE
31+
* file that was distributed with this source code.
32+
*/
2533
class DynamoDbStore implements PersistingStoreInterface
2634
{
2735
use ExpiringStoreTrait;
@@ -131,7 +139,7 @@ public function save(Key $key): void
131139
$key->reduceLifetime($this->initialTtl);
132140

133141
try {
134-
$this->client->putItem(new PutItemInput([
142+
$this->client->putItem([
135143
'TableName' => $this->tableName,
136144
'Item' => [
137145
$this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
@@ -146,36 +154,36 @@ public function save(Key $key): void
146154
'ExpressionAttributeValues' => [
147155
':now' => new AttributeValue(['N' => (string) \microtime()]),
148156
],
149-
]));
157+
]);
150158
} catch (ConditionalCheckFailedException) {
151159
// the lock is already acquired. It could be us. Let's try to put off.
152160
$this->putOffExpiration($key, $this->initialTtl);
153161
} catch (\Throwable $throwable) {
154-
throw new LockAcquiringException('Failed to acquire lock', 0, $throwable);
162+
throw new LockAcquiringException('Failed to acquire lock.', 0, $throwable);
155163
}
156164

157165
$this->checkNotExpired($key);
158166
}
159167

160168
public function delete(Key $key): void
161169
{
162-
$this->client->deleteItem(new DeleteItemInput([
170+
$this->client->deleteItem([
163171
'TableName' => $this->tableName,
164172
'Key' => [
165173
$this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
166174
],
167-
]));
175+
]);
168176
}
169177

170178
public function exists(Key $key): bool
171179
{
172-
$existingLock = $this->client->getItem(new GetItemInput([
180+
$existingLock = $this->client->getItem([
173181
'TableName' => $this->tableName,
174182
'ConsistentRead' => true,
175183
'Key' => [
176184
$this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
177185
],
178-
]));
186+
]);
179187

180188
$item = $existingLock->getItem();
181189

@@ -204,7 +212,7 @@ public function putOffExpiration(Key $key, float $ttl): void
204212
$uniqueToken = $this->getUniqueToken($key);
205213

206214
try {
207-
$this->client->putItem(new PutItemInput([
215+
$this->client->putItem([
208216
'TableName' => $this->tableName,
209217
'Item' => [
210218
$this->idAttr => new AttributeValue(['S' => $this->getHashedKey($key)]),
@@ -221,20 +229,20 @@ public function putOffExpiration(Key $key, float $ttl): void
221229
':now' => new AttributeValue(['N' => (string) \microtime()]),
222230
':token' => $uniqueToken,
223231
],
224-
]));
232+
]);
225233
} catch (ConditionalCheckFailedException) {
226234
// The item doesn't exist or was acquired by someone else
227235
throw new LockConflictedException();
228236
} catch (\Throwable $throwable) {
229-
throw new LockAcquiringException('Failed to acquire lock', 0, $throwable);
237+
throw new LockAcquiringException('Failed to acquire lock.', 0, $throwable);
230238
}
231239

232240
$this->checkNotExpired($key);
233241
}
234242

235243
public function createTable(): void
236244
{
237-
$this->client->createTable(new CreateTableInput([
245+
$this->client->createTable([
238246
'TableName' => $this->tableName,
239247
'AttributeDefinitions' => [
240248
new AttributeDefinition(['AttributeName' => $this->idAttr, 'AttributeType' => 'S']),
@@ -248,7 +256,7 @@ public function createTable(): void
248256
'ReadCapacityUnits' => $this->readCapacityUnits,
249257
'WriteCapacityUnits' => $this->writeCapacityUnits,
250258
]),
251-
]));
259+
]);
252260

253261
$this->client->tableExists(new DescribeTableInput(['TableName' => $this->tableName]))->wait();
254262
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.