Lock & API REST
Lock technique
Lock fonctionnel
vs
Mechanism to provide exclusive access to a shared resource.
![](https://s3.amazonaws.com/media-p.slid.es/uploads/309684/images/9393856/Screenshot_2022-03-09_at_12.15.49.png)
Lock fonctionnel - acquire
![](https://s3.amazonaws.com/media-p.slid.es/uploads/309684/images/9393857/Screenshot_2022-03-09_at_12.17.09.png)
Lock fonctionnel - blocked
Optimistic locking vs Pessimistic locking
Architecture REST & Lock
Method HTTP
https://webconcepts.info/specs/IETF/RFC/4918
![](https://s3.amazonaws.com/media-p.slid.es/uploads/309684/images/9393881/Screenshot_2022-03-09_at_12.25.35.png)
Ressource REST
GET /users/{uuid}/lock
POST /users/{uuid}/lock
PUT /users/{uuid}/lock
DELETE /users/{uuid}/lock
API Platform
/**
* Creates a resource metadata value object.
*
* @author Kévin Dunglas <dunglas@gmail.com>
*/
interface ResourceMetadataFactoryInterface
{
/**
* Creates a resource metadata.
*
* @throws ResourceClassNotFoundException
*/
public function create(string $resourceClass): ResourceMetadata;
}
Code
![](https://s3.amazonaws.com/media-p.slid.es/uploads/309684/images/9393893/Screenshot_2022-03-09_at_12.28.01.png)
Open API
![](https://s3.amazonaws.com/media-p.slid.es/uploads/309684/images/9393913/Untitled_Diagram-Page-1.drawio.png)
![](https://s3.amazonaws.com/media-p.slid.es/uploads/309684/images/9393916/Untitled_Diagram-Page-2.drawio.png)
Json-LD
![](https://s3.amazonaws.com/media-p.slid.es/uploads/309684/images/9393919/Screenshot_2022-03-09_at_12.50.14.png)
With a NormalizerInterface
deck
By skigun
deck
- 112