Download this file
| 1 | package dbreads |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | |
| 6 | "github.com/carlosframework/platform/internal/provision" |
| 7 | ) |
| 8 | |
| 9 | // ClassRefusal is the class rail as a sentence, or "" for an |
| 10 | // activator-managed exec instance: the only class whose database the |
| 11 | // platform replicates. It moved here from the console's db door so the door |
| 12 | // and the box's identity bracket refuse on one rule (spec §8.2); the |
| 13 | // sentences are the door's, unchanged. |
| 14 | func ClassRefusal(rec provision.Record) string { |
| 15 | if k := rec.Kind; k != "" && k != "instance" { |
| 16 | return fmt.Sprintf("%s is a %s route. The platform keeps a database copy only for instances.", rec.Host, k) |
| 17 | } |
| 18 | if rec.Addr != "" || len(rec.Addrs) > 0 { |
| 19 | return fmt.Sprintf("%s is served from its own address, so the platform does not manage its database.", rec.Host) |
| 20 | } |
| 21 | if !rec.HibernateOrDefault() { |
| 22 | return fmt.Sprintf("%s does not sleep, so the platform does not keep a copy of its database.", rec.Host) |
| 23 | } |
| 24 | return "" |
| 25 | } |
| 26 | |