Download this file
| 1 | package dbdoor |
| 2 | |
| 3 | import "regexp" |
| 4 | |
| 5 | // ForwardBody is the db door's 409 for an instance a forwarding console can |
| 6 | // read in its own region (db region forward spec §5.5 step 1). It is |
| 7 | // additive to the {"error"} body every CLI reads, so an old CLI prints Error |
| 8 | // as it is (DBF-14) and a new one switches to the forwarded read. |
| 9 | type ForwardBody struct { |
| 10 | Error string `json:"error"` |
| 11 | Forward int `json:"forward"` |
| 12 | Region string `json:"region"` |
| 13 | ForwardOps []string `json:"forward_ops"` |
| 14 | } |
| 15 | |
| 16 | // Forward is a DoorError's marker: where the data is, and which operations |
| 17 | // the console forwards there. |
| 18 | type Forward struct { |
| 19 | Region string |
| 20 | Ops []string |
| 21 | } |
| 22 | |
| 23 | // forwardRegion is dbreads.ValidRegion's shape. dbreads imports this |
| 24 | // package, so it is repeated here rather than imported. |
| 25 | var forwardRegion = regexp.MustCompile(`^[a-z][a-z0-9-]{0,31}$`) |
| 26 | |