| 1 | package provision |
| 2 | |
| 3 | // Record-write census entries for plans-3a-creation-caps, layered on |
| 4 | // dbRegionForward2WriteCensusInventory. Reviewed by the branch author; the census |
| 5 | // owner rules on #280 (PROPOSED-plans-3a-creation-caps). |
| 6 | // - The instance, sidecar and both domain-attach doors gain a plan-cap |
| 7 | // check under the account lock before their existing writes; their |
| 8 | // write sites and classes are unchanged. |
| 9 | // - Server.runningThings, Server.checkSidecars and Server.appInstanceCount |
| 10 | // only list and parse record keys to count an account's running things |
| 11 | // and an app's workers; they write nothing: key-site. |
| 12 | func plans3aWriteCensusInventory() []censusEntry { |
| 13 | entries := append([]censusEntry(nil), dbRegionForward2WriteCensusInventory()...) |
| 14 | replacements := []censusEntry{ |
| 15 | {"internal/console/apidomains.go", "Server.handleAPIDomainAttach", "key-site", "lit:instances", "27aa0452556355854cf2a211bd21c33092f241f450d8263d3058cd6c424bcfd9"}, |
| 16 | {"internal/console/apiinstances.go", "Server.handleAPIInstanceCreate", "record-writer", "key:CreateRecord", "e3ecf19f43f8ebf7cd117c6f78393e35bf8fe35571df50e3df8b7d120d393928"}, |
| 17 | {"internal/console/apisidecars.go", "Server.handleAPISidecarCreate", "record-writer", "key:CreateSidecarRecord", "bbcb85365658ed1ba2bb090a1a3d4f02123ecd8d7d6d04a6bbbf433e94f965ed"}, |
| 18 | {"internal/console/domainattach.go", "Server.attachDomainAs", "record-writer", "key:CreateRecord", "dcb7c4fc09a181d27f6a549965273b27b24ac8180aa38abc1b250923fc3ccb3b"}, |
| 19 | {"internal/console/plancaps.go", "Server.checkSidecars", "key-site", "key:SidecarsPrefix", "01c9ce701fd8da1d2d41a42eb048c0f2dcfe6654ee245a0a43d8944294d46a62"}, |
| 20 | {"internal/console/plancaps.go", "Server.runningThings", "key-site", "key:ParseRecordKey", "6668bb47e5364f4064abd0c4e92f06901fb5803e13e5b3ccb71e169d4afde1f6"}, |
| 21 | {"internal/console/plancaps.go", "Server.appInstanceCount", "key-site", "key:ParseRecordKey,key:RecordsPrefix", "e49e0b3ca9ee49240fd88840997fb93ea39aaa7c8e51d6ae634099f5e47595e7"}, |
| 22 | } |
| 23 | for _, replacement := range replacements { |
| 24 | found := false |
| 25 | for i, entry := range entries { |
| 26 | if entry.File == replacement.File && entry.Unit == replacement.Unit { |
| 27 | entries[i], found = replacement, true |
| 28 | break |
| 29 | } |
| 30 | } |
| 31 | if !found { |
| 32 | entries = append(entries, replacement) |
| 33 | } |
| 34 | } |
| 35 | return entries |
| 36 | } |
| 37 | |