[mirror] Scalable static site server for Git forges (like GitHub Pages)

Rename PATCH `Race-Free:` header to `Atomic:`.

Neither of these names is self-explanatory, and it is better to have
fewer distinct identifiers for the same concept.

Changed files
+10 -10
src
test
stresspatch
+2 -2
README.md
··· 80 80 - A directory entry replaces any existing file or directory with the same name (if any), recursively removing the old contents. 81 81 - A file or symlink entry replaces any existing file or directory with the same name (if any). 82 82 - In any case, the parent of an entry must exist and be a directory. 83 - - The request must have a `Race-Free: yes` or `Race-Free: no` header. Not every backend configuration makes it possible to perform atomic compare-and-swap operations; on backends without atomic CAS support, `Race-Free: yes` requests will fail, while `Race-Free: no` requests will provide a best-effort approximation. 84 - - If a `PATCH` request loses a race against another content update request, it may return `409 Conflict`. This is true regardless of the `Race-Free:` header value. Whenever this happens, resubmit the request as-is. 83 + - The request must have a `Atomic: yes` or `Atomic: no` header. Not every backend configuration makes it possible to perform atomic compare-and-swap operations; on backends without atomic CAS support, `Atomic: yes` requests will fail, while `Atomic: no` requests will provide a best-effort approximation. 84 + - If a `PATCH` request loses a race against another content update request, it may return `409 Conflict`. This is true regardless of the `Atomic:` header value. Whenever this happens, resubmit the request as-is. 85 85 - If the site has no contents after the update is applied, performs the same action as `DELETE`. 86 86 * In response to a `DELETE` request, the server unpublishes a site. The URL of the request must be the root URL of the site that is being unpublished. Site data remains stored for an indeterminate period of time, but becomes completely inaccessible. 87 87 * If a `Dry-Run: yes` header is provided with a `PUT`, `PATCH`, `DELETE`, or `POST` request, only the authorization checks are run; no destructive updates are made. Note that this functionality was added in _git-pages_ v0.2.0.
+7 -7
src/pages.go
··· 537 537 // on the backend in use and its configuration, but for applications where a mostly-atomic 538 538 // compare-and-swap operation is good enough (e.g. generating page previews) we don't want 539 539 // to prevent the use of partial updates. 540 - wantRaceFree := r.Header.Get("Race-Free") 540 + wantAtomicCAS := r.Header.Get("Atomic") 541 541 hasAtomicCAS := backend.HasAtomicCAS(r.Context()) 542 542 switch { 543 - case wantRaceFree == "yes" && hasAtomicCAS || wantRaceFree == "no": 543 + case wantAtomicCAS == "yes" && hasAtomicCAS || wantAtomicCAS == "no": 544 544 // all good 545 - case wantRaceFree == "yes": 546 - http.Error(w, "race free partial updates unsupported", http.StatusPreconditionFailed) 545 + case wantAtomicCAS == "yes": 546 + http.Error(w, "atomic partial updates unsupported", http.StatusPreconditionFailed) 547 547 return nil 548 - case wantRaceFree == "": 549 - http.Error(w, "must provide \"Race-Free: yes|no\" header", http.StatusPreconditionRequired) 548 + case wantAtomicCAS == "": 549 + http.Error(w, "must provide \"Atomic: yes|no\" header", http.StatusPreconditionRequired) 550 550 return nil 551 551 default: 552 - http.Error(w, "malformed Race-Free: header", http.StatusBadRequest) 552 + http.Error(w, "malformed Atomic: header", http.StatusBadRequest) 553 553 return nil 554 554 } 555 555
+1 -1
test/stresspatch/main.go
··· 57 57 panic(err) 58 58 } 59 59 60 - req.Header.Add("Race-Free", "no") 60 + req.Header.Add("Atomic", "no") 61 61 req.Header.Add("Content-Type", "application/x-tar") 62 62 resp, err := http.DefaultClient.Do(req) 63 63 if err != nil {