Skip to content

Instantly share code, notes, and snippets.

@duglin
Last active January 21, 2022 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save duglin/5e8accfc4f745f6bff715c89af7687fa to your computer and use it in GitHub Desktop.
Save duglin/5e8accfc4f745f6bff715c89af7687fa to your computer and use it in GitHub Desktop.

Current version of the spec defines epoch as:


Epoch: Description: The Discovery Endpoint's epoch value for this Service Entry. This specification does not mandate any particular semantic meaning to the value used. For example, implementations are free to use a value that represents a timestamp or could choose to simply use a monotonically increasing number. The only requirement is that the value MUST always increase each time the Service Entry is updated. This allows for a quick integer comparision to determine which version of this Service Entry is the latest - meaning, the one with the larger integer value.


For the purposes of this example, epoch starts at 1 and increases by one each time.

Proposal #1: POST=import, PUT=update/create

Action Incoming Epoch DE's Epoch Result / Today Proposal #1 Proposal #2
POST /services/ (ID in Body) missing no resource . 1 (generated)
POST /services/ (ID in Body) 2 no resource . 2 (from incoming)
POST /services/ (ID in Body) missing 1 . 1 (from incoming/create)
POST /services/ (no ID) missing no resource , 1 (generated)
POST /services/ (no ID) 2 no resource . 2 (from incoming)
POST /services/ (ID in Body) 2 2 . 2 (from incoming)
POST /services/ (ID in Body) 3 1 . 3 (from incoming)
POST /services/ (ID in Body) 1 2 . 1 (from incoming)
POST /services/ID (ID in Body) . Error - ID not allowed in URL
-
PUT /services/ . Error - missing ID in URL
PUT /services/ID missing no resource . 1 (generated)
PUT /services/ID 2 no resource . Error - epoch didn't match
PUT /services/ID missing 1 . 2 (generated)
PUT /services/ID 1 1 . 2 (generated)
PUT /services/ID 3 1 . Error - epoch didn't match
PUT /services/ID 1 2 . Error - epoch is old
-
DELETE /services/ID missing no resource 200 - already gone 200 200
DELETE /services/ID?epoch=1 1 no resource 200 - already gone 200 200
DELETE /services/ID missing 1 delete delete delete
DELETE /services/ID?epoch=1 1 1 delete delete delete
DELETE /services/ID?epoch=2 2 1 Error - epoch didn't match error error
DELETE /services . . Mixture of above based on epoch values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment