You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/10/24 20:39:20 UTC

[GitHub] [trafficcontrol] rob05c opened a new pull request, #7154: Add Traffic Ops Batch Endpoint

rob05c opened a new pull request, #7154:
URL: https://github.com/apache/trafficcontrol/pull/7154

   This is a Proof-of-Concept. I just needed to prove to myself that it's reasonable, it still needs the details worked out, docs, tests, etc. I'm making a Draft PR in case anyone else is interested in it.
   
   It allows users to make a single atomic request, such as 
   ```
   POST https://fqdn.example/api/5.0/batch/ -d '[{
   "method": "GET",
   "path": "/api/5.0/ping"
   }, {
   "method": "GET",
   "path": "/api/5.0/cdns"
   }]' 
   ```
   
   And get a response, with each member of the batch executed with sequential consistency (that is, GETs may be executed in parallel, but everything will appear to have been executed sequentially, e.g. GET-POST-GET will have the POST changes in the second GET but not the first), like:
   
   ```
   [ { "code": 200,
       "headers": {
         "Access-Control-Allow-Headers": [ "Origin, Content-Type" ],
         "Content-Type": [ "application/json" ] },
       "body": { "ping": "pong" }
     }, {
       "code": 200,
       "headers": {
         "Access-Control-Allow-Headers": [ "Origin, Content-Type" ],
         "Content-Type": [ "application/json" ], },
       "body": { "response": [ {
             "id": 42,
             "lastUpdated": "2001-01-01 12:34:56+00",
             "name": "ALL"
           }, {
             "domainName": "cdn.example.net",
             "id": 24,
             "lastUpdated": "2001-01-01 12:34:56+00",
             "name": "my-cdn"
             } ] } } ]
   
   ```
   
   The main goal here is atomicity, not convenience. By allowing users to execute multiple requests atomically, we can make it safe to do things that aren't safe today. For example, changing a Delivery Service, changing it's Profile, and seven different Parameters, all at once. This doesn't completely solve the Snapshot-Queue Automation a.k.a. "Kill the Chicken" problem, but it addresses a large subset of it, in a much smaller feature than a complete solution.
   
   It's unlikely I'll have time to finish this. But anyone else is welcome to fork and make a real PR from it.
   
   ## Which Traffic Control components are affected by this PR?
   - Traffic Ops
   
   ## What is the best way to verify this PR?
   <!-- Please include here ALL the steps necessary to test your PR.
   If your PR has tests (and most should), provide the steps needed to run the tests.
   If not, please provide step-by-step instructions to test the PR manually and explain why your PR does not need tests. -->
   
   
   ## If this is a bugfix, which Traffic Control versions contained the bug?
   <!-- Delete this section if the PR is not a bugfix, or if the bug is only in the master branch.
   Examples:
   - 5.1.2
   - 5.1.3 (RC1)
    -->
   
   
   ## PR submission checklist
   - [ ] This PR has tests <!-- If not, please delete this text and explain why this PR does not need tests. -->
   - [ ] This PR has documentation <!-- If not, please delete this text and explain why this PR does not need documentation. -->
   - [ ] This PR has a CHANGELOG.md entry <!-- A fix for a bug from an ATC release, an improvement, or a new feature should have a changelog entry. -->
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://apache.org/security) for details)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org