profswitch.bend relies on unsafe/foreign
raw source on the hub · import cswap-bend-cli@0.1.0.0/profswitch.bend as Profswitch
19 imports
import Base import ./json.bend as Json import ./act.bend as Act import ./clock.bend as Clock import ./cmd.bend as Cmd import ./fs.bend as Fs import ./setload.bend as Setload import ./store/base.bend as SBase import ./swbase.bend as B import ./swlive.bend as L import ./switch.bend as Sw import ./cliswitch.bend as Cliswitch import ./profile.bend as P import ./policy/types.bend as T import ./policy/safe.bend as SF import ./policy/algo.bend as A import ./daemon/config.bend as Cfg import ./daemon/gather.bend as G import ./daemon/view.bend as V
Definitions
def ActM source · line 30 · raw
@-A:Type -> Type
def ActM.pure source · line 33 · raw
@-A:Type -> @x:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)
def ActM.bind source · line 36 · raw
@-A:Type -> @-B:Type -> @m:0x0717344745a30ebad1f19045228e8f18/act.of(A) -> @f:(@_:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)
def snap_live source · line 39 · raw
@+s:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap -> 0x0717344745a30ebad1f19045228e8f18/swlive.Live
def snap_ents source · line 44 · raw
@+s:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap -> List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent>
def snap_rows source · line 47 · raw
@+s:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap -> 0x0717344745a30ebad1f19045228e8f18/json.Json
def tag source · line 50 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+r:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/json.Json
def noop source · line 53 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+reason:String -> @+message:String -> @+to:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/json.Json
def pad_detail2 source · line 56 · raw
@+empty:Bool -> @+d:String -> String
def pad_detail source · line 63 · raw
@+d:String -> String
def nothing_msg source · line 66 · raw
@+reason:0x0717344745a30ebad1f19045228e8f18/policy/types.Reason -> @+detail:String -> String
def decided source · line 69 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+opts:0x0717344745a30ebad1f19045228e8f18/swlive.Opts -> @+cur:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+d:0x0717344745a30ebad1f19045228e8f18/policy/types.Decision -> 0x0717344745a30ebad1f19045228e8f18/act.of(0x0717344745a30ebad1f19045228e8f18/json.Json)
def usages_for source · line 78 · raw
@+s:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap -> @+a:String -> @+t:U32 -> List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage>
def pcfg_for source · line 81 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Config
def decision_for source · line 84 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+s:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap -> @+a:String -> @+t:U32 -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Decision
def cur_ref source · line 87 · raw
@+s:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap -> @+a:String -> 0x0717344745a30ebad1f19045228e8f18/json.Json
def rotate_at source · line 90 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+opts:0x0717344745a30ebad1f19045228e8f18/swlive.Opts -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+s:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap -> @+a:String -> @+t:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(0x0717344745a30ebad1f19045228e8f18/json.Json)
def rotate_snap source · line 93 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+opts:0x0717344745a30ebad1f19045228e8f18/swlive.Opts -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+s:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap -> @+act:Maybe<&2, String> -> @+t:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(0x0717344745a30ebad1f19045228e8f18/json.Json)
def rotate_opt source · line 100 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+opts:0x0717344745a30ebad1f19045228e8f18/swlive.Opts -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap> -> @+t:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(0x0717344745a30ebad1f19045228e8f18/json.Json)
def rotate_act source · line 107 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+opts:0x0717344745a30ebad1f19045228e8f18/swlive.Opts -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(0x0717344745a30ebad1f19045228e8f18/json.Json)
def run_profile source · line 113 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+json:Bool -> @+opts:0x0717344745a30ebad1f19045228e8f18/swlive.Opts -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
def with_opts source · line 116 · raw
@+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+json:Bool -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
def legacy source · line 121 · raw
@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+ident:Maybe<&2, String> -> @+force:Bool -> @+strategy:Maybe<&2, String> -> @+model:Maybe<&2, String> -> @+json:Bool -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
def has source · line 124 · raw
@+m:Maybe<&2, String> -> Bool
def usage_err source · line 131 · raw
@+msg:String -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
def unknown_name source · line 136 · raw
@+explicit:Bool -> @+name:String -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+ident:Maybe<&2, String> -> @+force:Bool -> @+strategy:Maybe<&2, String> -> @+model:Maybe<&2, String> -> @+json:Bool -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
A name from --profile that matches nothing is an error; a stale
active_profile falls back to the legacy rotation.
def by_name source · line 143 · raw
@+is_default:Bool -> @+p:0x0717344745a30ebad1f19045228e8f18/profile.Prof -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+ident:Maybe<&2, String> -> @+force:Bool -> @+strategy:Maybe<&2, String> -> @+model:Maybe<&2, String> -> @+json:Bool -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
def resolved source · line 150 · raw
@+res:0x0717344745a30ebad1f19045228e8f18/profile.Res -> @+over:Maybe<&2, String> -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+ident:Maybe<&2, String> -> @+force:Bool -> @+strategy:Maybe<&2, String> -> @+model:Maybe<&2, String> -> @+json:Bool -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
def targeted source · line 160 · raw
@+ident:Maybe<&2, String> -> @+strategy:Maybe<&2, String> -> Bool
Only a bare switch (no target, no --strategy) follows a profile.
def loaded source · line 163 · raw
@+over:Maybe<&2, String> -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+ident:Maybe<&2, String> -> @+force:Bool -> @+strategy:Maybe<&2, String> -> @+model:Maybe<&2, String> -> @+json:Bool -> @+raw:0x0717344745a30ebad1f19045228e8f18/json.Json -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
def targeted_out source · line 166 · raw
@+over:Maybe<&2, String> -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+ident:Maybe<&2, String> -> @+force:Bool -> @+strategy:Maybe<&2, String> -> @+model:Maybe<&2, String> -> @+json:Bool -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
def route source · line 173 · raw
@+tgt:Bool -> @+over:Maybe<&2, String> -> @+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+ident:Maybe<&2, String> -> @+force:Bool -> @+strategy:Maybe<&2, String> -> @+model:Maybe<&2, String> -> @+json:Bool -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
def switch_cmd source · line 181 · raw
@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+over:Maybe<&2, String> -> @+ident:Maybe<&2, String> -> @+force:Bool -> @+strategy:Maybe<&2, String> -> @+model:Maybe<&2, String> -> @+json:Bool -> IO(0x0717344745a30ebad1f19045228e8f18/cmd.Out)
cswap switch [TARGET] [--profile NAME] ...