Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Traffic Ops Batch Endpoint #7154

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

rob05c
Copy link
Member

@rob05c rob05c commented Oct 24, 2022

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?

If this is a bugfix, which Traffic Control versions contained the bug?

PR submission checklist

@rob05c rob05c added new feature A new feature, capability or behavior Traffic Ops related to Traffic Ops labels Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature A new feature, capability or behavior Traffic Ops related to Traffic Ops
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant