Update locking_notes.md

Updated the proposal document by adding the API's expected Request and Response Json data.
This commit is contained in:
pratap043 2022-07-21 17:40:23 +05:30 committed by GitHub
parent 056ed1fbc9
commit aa4d936dc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,7 +11,7 @@ The git-lfs REST API for Locks creation should be able to accept additonal attri
The current Git LFS File Locking API [https://github.com/git-lfs/git-lfs/blob/v3.2.0/docs/api/locking.md] doesn't have a field to capture some information related to Locks creation which would be useful to understand why and from where the lock was acquired. To get more understanding, below is the use case:
In our application team development feature, there are 3 workspaces with 2 users working on a single Repository containing 6 files.
Consider an application where source control management is one of the feature and GitHub is the repository being used. Here there are 3 workspaces with 2 users working on a single Repository containing 6 files.
Here the User1 is working on FileA, FileB under Workspace W1, User2 is working on FileC, FileD under Workspace W2 and also User1 is working on FileE, FileF under Workspace W3.
@ -31,7 +31,7 @@ W3
------ FileE
------ FileF
Now when we run fetchLocks request from W1, we will get all locks on the Repo as given below. Here we doesn't know from which workspaces, the locks were acquired.
Now when we run List Locks request from W1, we will get all locks on the Repo as given below. Here we doesn't know from which workspaces, the locks were acquired.
User Workspace File
User1 -- FileA
@ -60,3 +60,182 @@ Sample pre-defined comment during acquiring lock is as given below:
Here UserDN element has the Logged in username of the Application. The owner attribute from the List Locks response would give us the Git Repo user. The Workspace element would give us the workspace information.
With this enhancement, we can have some predefined comment as part of lock creation and get back same with the List Locks REST API so that it will be useful to differentiate and get more information on the File lock.
# Create Locks Enhancement API proposal
### Request
```
> POST https://lfs-server.com/locks
> Accept: application/vnd.git-lfs+json
> Content-Type: application/vnd.git-lfs+json
> Authorization: Basic ...
> {
> "path": "foo/bar.zip",
> "ref": {
> "name": "refs/heads/my-feature"
> },
> "notes": "Lock applied from Workspace A"
> }
```
### Response
* **Successful response**
```
< HTTP/1.1 201 Created
< Content-Type: application/vnd.git-lfs+json
< {
< "lock": {
< "id": "some-uuid",
< "path": "foo/bar.zip",
< "locked_at": "2022-05-17T15:49:06+00:00",
< "owner": {
< "name": "Jane Doe"
< },
< "notes": "Lock applied from Workspace A"
< }
< }
```
# List Locks Enhancement API proposal
### Request (with notes -- notes=true)
```
> GET https://lfs-server.com/locks?path=&id&cursor=limit&**notes=true**&refspec=
> Accept: application/vnd.git-lfs+json
> Authorization: Basic ... (if needed)
```
### Response
* **Successful response**
```
< HTTP/1.1 200 Ok
< Content-Type: application/vnd.git-lfs+json
< {
< "locks": [
< {
< "id": "some-uuid",
< "path": "foo/bar.zip",
< "locked_at": "2022-05-17T15:49:06+00:00",
< "owner": {
< "name": "Jane Doe"
< },
< "notes": "Lock applied from Workspace A"
< }
< ],
< "next_cursor": "optional next ID"
< }
```
### Request (with out notes)
```
> GET https://lfs-server.com/locks?path=&id&cursor=limit&refspec=
> Accept: application/vnd.git-lfs+json
> Authorization: Basic ... (if needed)
```
### Response
* **Successful response**
```
< HTTP/1.1 200 Ok
< Content-Type: application/vnd.git-lfs+json
< {
< "locks": [
< {
< "id": "some-uuid",
< "path": "foo/bar.zip",
< "locked_at": "2022-05-17T15:49:06+00:00",
< "owner": {
< "name": "Jane Doe"
< }
< }
< ],
< "next_cursor": "optional next ID"
< }
```
# List Locks for Verification Enhancement API proposal
### Request (with notes)
```
> POST https://lfs-server.com/locks/verify
> Accept: application/vnd.git-lfs+json
> Content-Type: application/vnd.git-lfs+json
> Authorization: Basic ...
> {
> "cursor": "optional cursor",
> "limit": 100, // also optional
> "ref": {
> "name": "refs/heads/my-feature"
> },
> "notes" : true, // also optional
> }
```
### Response
* **Successful response**
```
< HTTP/1.1 200 Ok
< Content-Type: application/vnd.git-lfs+json
< {
< "ours": [
< {
< "id": "some-uuid",
< "path": "/path/to/file",
< "locked_at": "2016-05-17T15:49:06+00:00",
< "owner": {
< "name": "Jane Doe"
< },
< "notes": "Lock applied from Workspace A"
< }
< ],
< "theirs": [],
< "next_cursor": "optional next ID"
< }
```
### Request (with out notes)
```
> POST https://lfs-server.com/locks/verify
> Accept: application/vnd.git-lfs+json
> Content-Type: application/vnd.git-lfs+json
> Authorization: Basic ...
> {
> "cursor": "optional cursor",
> "limit": 100, // also optional
> "ref": {
> "name": "refs/heads/my-feature"
> }
> }
```
### Response
* **Successful response**
```
< HTTP/1.1 200 Ok
< Content-Type: application/vnd.git-lfs+json
< {
< "ours": [
< {
< "id": "some-uuid",
< "path": "/path/to/file",
< "locked_at": "2016-05-17T15:49:06+00:00",
< "owner": {
< "name": "Jane Doe"
< }
< }
< ],
< "theirs": [],
< "next_cursor": "optional next ID"
< }
```