package moves import "fmt" // The operator sentences two packages speak (preflight L12): the carlos move // CLI (package main) and the app's member stream (internal/host). One // template each, so the copy record names this file for them. A sentence // only one of them speaks stays in that file. // MoveStartingLine is M-C1. func MoveStartingLine(host, from, to string) string { return fmt.Sprintf("Moving %s from %s to %s.", host, from, to) } // CutStartingLine is M-C5; estimate is CutBudgetText's. func CutStartingLine(to, host, estimate string) string { return fmt.Sprintf("%s is ready. Starting the cut. %s will be offline for about %s.", to, host, estimate) } // FlippedLine is M-C6. func FlippedLine(from, to string) string { return fmt.Sprintf("Stopped in %s. Starting in %s.", from, to) } // MovedLine is M-C7. func MovedLine(host, to string, offlineSeconds int) string { return fmt.Sprintf("Moved. %s is served from %s. It was offline for %d seconds.", host, to, offlineSeconds) } // MovingBackLine is M-C8; reason is a recorded rollback sentence. func MovingBackLine(to, host, reason, from string) string { return fmt.Sprintf("%s could not start %s: %s. Moving it back to %s.", to, host, reason, from) } // MovedBackLine is M-C9. func MovedBackLine(host, from string) string { return fmt.Sprintf("%s is back in %s and serving. Nothing was lost.", host, from) } // StuckMemberLine is what members read for a stuck move (MV-N380): M-C11 // without the operator's command. func StuckMemberLine(host, to, from string) string { return fmt.Sprintf("%s could not start in %s or in %s. It is offline. An operator has been paged.", host, to, from) } // CutBudgetText renders a cut budget for M-C5. func CutBudgetText(seconds int) string { if seconds < 90 { return fmt.Sprintf("%d seconds", seconds) } return fmt.Sprintf("%d minutes", (seconds+59)/60) } // HomeRegionText names the home region where only its code, "", is known // (MV-N381): a box knows the deployment's home only as the record's empty // region. const HomeRegionText = "the home region" // RegionText is a region as a sentence names it: its code, or // HomeRegionText for the home's "". func RegionText(code string) string { if code == "" { return HomeRegionText } return code }