planner.bend relies on unsafe/foreign
raw source on the hub · import bend-kit-planner@0.4.1.0/planner.bend as Planner
Dependency plans with proved order and closure, incremental invalidation, and a build runner.
7 imports
import Base import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes import bend-kit-hash@0.3.0.4/hash.bend as Hash import bend-kit-files@0.3.1.0/files.bend as Files import bend-kit-process@0.5.0.1/process.bend as Proc import bend-kit-collections@0.1.5.0/omap.bend as OMap import bend-kit-collections@0.1.5.0/order.bend as Order
Types
type Node source · line 11 · raw
@-K:Data -> Data
A node and the nodes it requires. Its prerequisites must succeed before it runs.
Node@-K:Data -> @id:K -> @deps:List<&2, K> -> Node<K>
type Error source · line 14 · raw
@-K:Data -> Data
Missing@-K:Data -> @node:K -> @chain:List<&2, K> -> Error<K>
node is undefined; chain is the requirement path from a target to the node that names it.
Cycle@-K:Data -> @path:List<&2, K> -> Error<K>
Each node requires the next, and the last is the first.
Refused@-K:Data -> Error<K>
The candidate failed the plan check. This is a planner bug.
type Status source · line 22 · raw
Data
BuiltStatus
The command ran and exited 0.
FreshStatus
The node was not stale, so its command did not run.
FailedStatus
The command ran and failed.
SkippedStatus
The node is undefined, or a prerequisite did not succeed.
type Entry source · line 32 · raw
@-K:Data -> Data
Entry@-K:Data -> @node:K -> @status:Status -> Entry<K>
type Action source · line 35 · raw
Data
RunAction
Run the command, then record Built or Failed.
Mark@status:Status -> Action
Record this status without a run.
PassAction
The node already has a status.
type Walk source · line 253 · raw
@-K:Data -> Data
A walk's finished nodes and their index.
Walk@-K:Data -> @done:List<&2, K> -> @idx:0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K) -> Walk<K>
type Pool source · line 518 · raw
@-K:Data -> Data
The statuses so far, the nodes whose commands run now, and every node started, latest first.
Pool@-K:Data -> @st:List<&2, Entry<K>> -> @running:List<&2, K> -> @log:List<&2, K> -> Pool<K>
type Fin source · line 522 · raw
@-K:Data -> Data
A command finished: its node, and whether it exited 0.
Fin@-K:Data -> @node:K -> @ok:Bool -> Fin<K>
type Step source · line 525 · raw
Data
PSkipStep
The node has a status or is running.
PMark@status:Status -> Step
Record this status without a run.
PStartStep
Start the command.
PWaitStep
Wait for a running command to finish: a prerequisite runs, or every slot is busy.
type Task source · line 656 · raw
Data
A node with its command and the source files it reads.
Task@id:String -> @deps:List<&2, String> -> @argv:List<&2, String> -> @inputs:List<&2, String> -> Task
argv is the command and its arguments; an empty argv is a group with no command.
type Stamp source · line 825 · raw
Data
A node and the hash of its command, prerequisites, and inputs.
Stamp@node:String -> @hash:String -> Stamp
type Ran source · line 947 · raw
Data
What a command left: its exit code and the last 4096 octets of its stdout and stderr, or why it did not start.
Exited@code:U32 -> @out:String -> @err:String -> Ran
Unstarted@error:String -> Ran
type Log source · line 951 · raw
Data
Log@node:String -> @ran:Ran -> Log
type Outcome source · line 955 · raw
Data
A planned node, its status, and what its command left; None when no command ran.
Outcome@node:String -> @status:Status -> @ran:Maybe<&2, Ran> -> Outcome
type Msg source · line 1015 · raw
Data
A finished command, as its job reports it.
Msg@node:String -> @ran:Maybe<&2, Ran> -> Msg
type Ledger source · line 1018 · raw
Data
Ledger@pool:Pool<String> -> @logs:List<&2, Log> -> Ledger
Definitions
def when source · line 43 · raw
@-A:Type -> @rest:(@_:Unit -> A) -> @hit:Bool -> @yes:A -> A
def rev source · line 82 · raw
@-K:Data -> @xs:List<&2, K> -> @acc:List<&2, K> -> List<&2, K>
def cat source · line 89 · raw
@-K:Data -> @xs:List<&2, K> -> @ys:List<&2, K> -> List<&2, K>
def go.node source · line 154 · raw
@-K:Data -> @-R:Type -> @m:Maybe<&2, List<&2, K>> -> @missing:(@_:Unit -> R) -> @child:(@_:List<&2, K> -> R) -> R
def go.open source · line 161 · raw
@-K:Data -> @-R:Type -> @open:Bool -> @m:(@_:Unit -> Maybe<&2, List<&2, K>>) -> @loop:(@_:Unit -> R) -> @missing:(@_:Unit -> R) -> @child:(@_:List<&2, K> -> R) -> R
def go.at source · line 169 · raw
@-K:Data -> @-R:Type -> @seen:Bool -> @open:(@_:Unit -> Bool) -> @m:(@_:Unit -> Maybe<&2, List<&2, K>>) -> @skip:(@_:Unit -> R) -> @loop:(@_:Unit -> R) -> @missing:(@_:Unit -> R) -> @child:(@_:List<&2, K> -> R) -> R
One node d: skip it when done, report a cycle when open, report it when missing, else visit its prerequisites.
def go.then source · line 179 · raw
@-K:Data -> @r:Result<&2, &2, Error<K>, List<&2, K>> -> @k:(@_:List<&2, K> -> Result<&2, &2, Error<K>, List<&2, K>>) -> Result<&2, &2, Error<K>, List<&2, K>>
def go.out source · line 186 · raw
@-K:Data -> @ds:List<&2, K> -> @done:List<&2, K> -> Result<&2, &2, Error<K>, List<&2, K>>
def plan.ok source · line 213 · raw
@-K:Data -> @c:Bool -> @p:List<&2, K> -> Result<&2, &2, Error<K>, List<&2, K>>
def fast.at source · line 256 · raw
@-K:Data -> @-R:Type -> @seen:Bool -> @open:Bool -> @m:Maybe<&2, List<&2, K>> -> @skip:(@_:Unit -> R) -> @loop:(@_:Unit -> R) -> @missing:(@_:Unit -> R) -> @child:(@_:List<&2, K> -> R) -> R
def fast.then source · line 271 · raw
@-K:Data -> @r:Result<&2, &2, Error<K>, Walk<K>> -> @k:(@_:List<&2, K> -> @_:0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K) -> Result<&2, &2, Error<K>, Walk<K>>) -> Result<&2, &2, Error<K>, Walk<K>>
def fast.out source · line 278 · raw
@-K:Data -> @ds:List<&2, K> -> @done:List<&2, K> -> @di:0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K) -> Result<&2, &2, Error<K>, Walk<K>>
def plan.fast.fin source · line 316 · raw
@-K:Data -> @r:Result<&2, &2, Error<K>, Walk<K>> -> Result<&2, &2, Error<K>, List<&2, K>>
def invalidate.if source · line 331 · raw
@-K:Data -> @hit:Bool -> @x:K -> @acc:List<&2, K> -> List<&2, K>
def Status.ok source · line 381 · raw
@s:Status -> Bool
def Status.selected source · line 393 · raw
@s:Status -> Bool
Built, Fresh, or Failed: the node was not skipped.
def ok.at source · line 400 · raw
@m:Maybe<&2, Status> -> Bool
def selected.at source · line 407 · raw
@m:Maybe<&2, Status> -> Bool
def decide.ready source · line 422 · raw
@go:Bool -> @stale:Bool -> Action
def outcome source · line 451 · raw
@rs:List<&2, Bool> -> Status
def Action.status source · line 459 · raw
@a:Action -> @rs:List<&2, Bool> -> Maybe<&2, Status>
The status that action a records; a Run takes its result from the head of rs.
def record source · line 468 · raw
@-K:Data -> @m:Maybe<&2, Status> -> @st:List<&2, Entry<K>> -> @x:K -> List<&2, Entry<K>>
def step source · line 475 · raw
@-K:Data -> @a:Action -> @st:List<&2, Entry<K>> -> @x:K -> @rs:List<&2, Bool> -> List<&2, Entry<K>>
def step.rest source · line 478 · raw
@a:Action -> @rs:List<&2, Bool> -> List<&2, Bool>
def keys source · line 497 · raw
@-K:Data -> @st:List<&2, Entry<K>> -> List<&2, K>
def le source · line 508 · raw
@a:Nat -> @b:Nat -> Bool
a <= b.
def Fin.status source · line 543 · raw
@ok:Bool -> Status
def finish.if source · line 550 · raw
@-K:Data -> @run:Bool -> @+y:K -> @ok:Bool -> @st:List<&2, Entry<K>> -> @running:List<&2, K> -> @dropped:List<&2, K> -> @log:List<&2, K> -> Pool<K>
def decide.par.room source · line 563 · raw
@room:Bool -> Step
def decide.par.go source · line 570 · raw
@go:Bool -> @stale:Bool -> @room:Bool -> Step
def decide.par.wait source · line 581 · raw
@busy:Bool -> @go:Bool -> @stale:Bool -> @room:Bool -> Step
def apply source · line 609 · raw
@-K:Data -> @a:Step -> @pool:Pool<K> -> @+x:K -> Pool<K>
def par.at source · line 622 · raw
@-R:Type -> @a:Step -> @wait:(@_:Unit -> R) -> @go:(@_:Unit -> R) -> R
def Run source · line 660 · raw
@-A:Type -> Type
def Run.pure source · line 663 · raw
@-A:Type -> @x:A -> Run(A)
def Run.fail source · line 666 · raw
@-A:Type -> @e:Pair(U32, String) -> Run(A)
def Run.next source · line 669 · raw
@-A:Type -> @-B:Type -> @r:Result<&1, &1, Pair(U32, String), A> -> @f:(@_:A -> Run(B)) -> Run(B)
def Run.bind source · line 676 · raw
@-A:Type -> @-B:Type -> @m:Run(A) -> @f:(@_:A -> Run(B)) -> Run(B)
def Run.lift source · line 679 · raw
@-A:Type -> @m:IO(A) -> Run(A)
def Task.node source · line 682 · raw
@t:Task -> Node<String>
def graph source · line 687 · raw
@ts:List<&2, Task> -> List<&2, Node<String>>
def task source · line 695 · raw
@ts:List<&2, Task> -> @+k:String -> Maybe<&2, Task>
The first task named k.
def id.char source · line 702 · raw
@c:Char -> Bool
def id.chars source · line 706 · raw
@s:String -> Bool
def id.ok source · line 714 · raw
@+s:String -> Bool
A stamp file holds one id per line, so an id is printable ASCII and not empty.
def ids.bad source · line 717 · raw
@ts:List<&2, Task> -> Maybe<&2, String>
def Error.show source · line 724 · raw
@e:Error<String> -> String
def Status.show source · line 735 · raw
@s:Status -> String
def text source · line 747 · raw
@s:String -> String
Each code point in decimal, so distinct strings give distinct text.
def texts source · line 754 · raw
@xs:List<&2, String> -> String
def digest.of source · line 761 · raw
@r:Pair(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes, 0xd6aea21c4de95b225a135a3c995751a3/hash.W64) -> String
def digest source · line 766 · raw
@b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> String
def file.end source · line 769 · raw
@empty:Bool -> @f:File -> @acc:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> @b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> @k:(@_:File -> @_:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> IO(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes)) -> IO(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes)
def file.got source · line 778 · raw
@r:Pair(File, Result<&1, &1, Pair(U32, String), 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes>) -> @acc:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> @k:(@_:File -> @_:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> IO(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes)) -> IO(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes)
def file.more source · line 789 · raw
@n:Nat -> @f:File -> @acc:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> IO(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes)
The rest of f, read 1 MiB at a time, in at most n reads.
def file.opened source · line 799 · raw
@r:Result<&1, &1, Pair(U32, String), File> -> IO(String)
def file.stamp source · line 807 · raw
@path:String -> IO(String)
"m" when path does not open, else "f" and the hash of its octets.
def inputs.stamp source · line 810 · raw
@xs:List<&2, String> -> @+dir:String -> @acc:String -> IO(String)
def Task.stamp source · line 818 · raw
@t:Task -> @+dir:String -> IO(String)
The hash of the command, the prerequisites, and every input file.
def lookup source · line 828 · raw
@xs:List<&2, Stamp> -> @+k:String -> Maybe<&2, String>
def stamps.now source · line 835 · raw
@p:List<&2, String> -> @+ts:List<&2, Task> -> @+dir:String -> @acc:List<&2, Stamp> -> IO(List<&2, Stamp>)
def same source · line 844 · raw
@a:Maybe<&2, String> -> @b:Maybe<&2, String> -> Bool
def changed source · line 852 · raw
@p:List<&2, String> -> @+old:List<&2, Stamp> -> @+now:List<&2, Stamp> -> List<&2, String>
The nodes of p whose stamp now is not the recorded one.
def after.new source · line 860 · raw
@st:List<&2, Entry<String>> -> @+now:List<&2, Stamp> -> List<&2, Stamp>
The stamps of the nodes that ended Built or Fresh, and the old stamps of nodes the run did not reach.
def after.keep source · line 868 · raw
@old:List<&2, Stamp> -> @+done:List<&2, String> -> List<&2, Stamp>
def after source · line 876 · raw
@+st:List<&2, Entry<String>> -> @+now:List<&2, Stamp> -> @old:List<&2, Stamp> -> List<&2, Stamp>
def stamps.line source · line 879 · raw
@e:Stamp -> String
def stamps.lines source · line 884 · raw
@xs:List<&2, Stamp> -> String
def stamps.show source · line 891 · raw
@xs:List<&2, Stamp> -> String
def stamps.entry source · line 894 · raw
@fields:List<&2, String> -> List<&2, Stamp>
def stamps.parse source · line 901 · raw
@lines:List<&2, String> -> List<&2, Stamp>
def stamps.got source · line 908 · raw
@r:Pair(File, Result<&1, &1, Pair(U32, String), String>) -> IO(List<&2, Stamp>)
def stamps.opened source · line 919 · raw
@r:Result<&1, &1, Pair(U32, String), File> -> IO(List<&2, Stamp>)
def stamps.read source · line 927 · raw
@path:String -> IO(List<&2, Stamp>)
The recorded stamps; none when the file does not open.
def stamps.closed source · line 930 · raw
@r:Pair(File, Result<&1, &1, Pair(U32, String), Unit>) -> Run(Unit)
def stamps.write source · line 938 · raw
@+path:String -> @xs:List<&2, Stamp> -> Run(Unit)
Writes through path.tmp and a rename, so a reader sees the old file or the new one.
def Ran.ok source · line 958 · raw
@r:Ran -> Bool
def tail.of source · line 965 · raw
@r:Pair(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes, 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes) -> String
def tail source · line 971 · raw
@b:0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes -> String
The last 4096 octets of b, one Char per octet.
def run.ran source · line 976 · raw
@r:Result<&1, &1, Pair(U32, String), Pair(U32, Pair(0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes, 0x632652e3c1c0183f12728faf3870bb68/bytes.Bytes))> -> Ran
def run.argv source · line 984 · raw
@argv:List<&2, String> -> @dir:String -> IO(Maybe<&2, Ran>)
Runs argv in dir; None for a group with no command.
def run.task source · line 992 · raw
@dir:String -> @m:Maybe<&2, Task> -> IO(Maybe<&2, Ran>)
def run.ok source · line 1000 · raw
@m:Maybe<&2, Ran> -> Bool
A group succeeds; a command succeeds when it exits 0.
def run.log source · line 1007 · raw
@+x:String -> @m:Maybe<&2, Ran> -> @logs:List<&2, Log> -> List<&2, Log>
def run.job source · line 1021 · raw
@dir:String -> @m:Maybe<&2, Task> -> @+x:String -> @chan:Chan(Msg) -> IO(Unit)
def run.msg source · line 1027 · raw
@m:Maybe<&1, Msg> -> @+pool:Pool<String> -> @+logs:List<&2, Log> -> @k:(@_:Pool<String> -> @_:List<&2, Log> -> IO(Ledger)) -> IO(Ledger)
def run.recv source · line 1035 · raw
@+chan:Chan(Msg) -> @+pool:Pool<String> -> @+logs:List<&2, Log> -> @k:(@_:Pool<String> -> @_:List<&2, Log> -> IO(Ledger)) -> IO(Ledger)
Takes the next finished command, then goes on with k.
def run.drain source · line 1039 · raw
@n:Nat -> @+pool:Pool<String> -> @+logs:List<&2, Log> -> @+chan:Chan(Msg) -> IO(Ledger)
Waits for n running commands.
def Pool.busy source · line 1046 · raw
@pool:Pool<String> -> Nat
def par.case source · line 1051 · raw
@-R:Type -> @a:Step -> @wait:(@_:Unit -> R) -> @start:(@_:Unit -> R) -> @other:(@_:Unit -> R) -> R
def run.par source · line 1061 · raw
@n:Nat -> @p:List<&2, String> -> @+ts:List<&2, Task> -> @+g:List<&2, Node<String>> -> @+stale:List<&2, String> -> @+limit:Nat -> @+pool:Pool<String> -> @+logs:List<&2, Log> -> @+dir:String -> @+chan:Chan(Msg) -> IO(Ledger)
par, with each finish from a running job. Each wait finishes a node started earlier, so n = 1 + |p| is enough.
def ran.find source · line 1080 · raw
@logs:List<&2, Log> -> @+k:String -> Maybe<&2, Ran>
def outcome.of source · line 1087 · raw
@m:Maybe<&2, Status> -> @+x:String -> @r:Maybe<&2, Ran> -> @rest:List<&2, Outcome> -> List<&2, Outcome>
def outcomes source · line 1095 · raw
@p:List<&2, String> -> @+st:List<&2, Entry<String>> -> @+logs:List<&2, Log> -> List<&2, Outcome>
Each node of p that has a status, in plan order.
def String.same source · line 1103 · raw
@a:String -> @b:String -> Bool
Equal strings, as the order that build indexes them by sees them.
def build.ids source · line 1106 · raw
@m:Maybe<&2, String> -> Run(Unit)
def build.plan source · line 1113 · raw
@r:Result<&2, &2, Error<String>, List<&2, String>> -> Run(List<&2, String>)
def build.done source · line 1120 · raw
@+path:String -> @p:List<&2, String> -> @+now:List<&2, Stamp> -> @old:List<&2, Stamp> -> @l:Ledger -> Run(List<&2, Outcome>)
def build source · line 1129 · raw
@+tasks:List<&2, Task> -> @+targets:List<&2, String> -> @+dir:String -> @+path:String -> @+jobs:U32 -> Run(List<&2, Outcome>)
Plans targets, runs each stale task in dir, up to jobs at once, reuses the rest, and records stamps in path. The result is each planned node with its status and command output, in plan order.
Templates
template member source · line 51 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @xs:List<&2, K> -> @+k:K -> Bool
eq(k, x) for some x of xs.
template all_in source · line 59 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @xs:List<&2, K> -> @+ys:List<&2, K> -> Bool
Every x of xs is a member of ys.
template any_in source · line 67 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @xs:List<&2, K> -> @+ys:List<&2, K> -> Bool
Some x of xs is a member of ys.
template distinct source · line 75 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @xs:List<&2, K> -> Bool
No element occurs twice.
template deps source · line 97 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @g:List<&2, Node<K>> -> @+k:K -> Maybe<&2, List<&2, K>>
The prerequisites of the first node named k; None when no node is.
template deps.or_nil source · line 104 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @+g:List<&2, Node<K>> -> @+k:K -> List<&2, K>
template ordered.node source · line 110 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @m:Maybe<&2, List<&2, K>> -> @+done:List<&2, K> -> Bool
template ordered source · line 118 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @p:List<&2, K> -> @+g:List<&2, Node<K>> -> @+done:List<&2, K> -> Bool
Each node is defined, is not in done, and has every prerequisite in done; it then joins done.
template needed source · line 128 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @r:List<&2, K> -> @+g:List<&2, Node<K>> -> @+want:List<&2, K> -> Bool
Over the plan reversed: each node is in want, a target or a prerequisite of a later node.
template valid source · line 136 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @+g:List<&2, Node<K>> -> @+ts:List<&2, K> -> @+p:List<&2, K> -> Bool
p is a dependency order of exactly the closure of ts.
template cyc source · line 144 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @path:List<&2, K> -> @+k:K -> @+acc:List<&2, K> -> List<&2, K>
The open path from the node eq to k, nearest last, then acc.
template cycle source · line 151 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @path:List<&2, K> -> @+k:K -> Error<K>
template go source · line 195 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @fuel:Nat -> @ds:List<&2, K> -> @+g:List<&2, Node<K>> -> @+path:List<&2, K> -> @+done:List<&2, K> -> Result<&2, &2, Error<K>, List<&2, K>>
A depth-first walk of ds. path holds the open nodes, nearest first; done the finished ones, last first. Each level of path costs one unit of fuel.
template plan.check source · line 220 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @+g:List<&2, Node<K>> -> @+ts:List<&2, K> -> @r:Result<&2, &2, Error<K>, List<&2, K>> -> Result<&2, &2, Error<K>, List<&2, K>>
template plan source · line 230 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @+g:List<&2, Node<K>> -> @+ts:List<&2, K> -> Result<&2, &2, Error<K>, List<&2, K>>
The closure of ts in dependency order, each node once; or why there is none. A path never repeats a node, and each node on it is defined, so one level per node is enough fuel.
template idx source · line 237 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @xs:List<&2, K> -> 0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K)
template gidx source · line 245 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @g:List<&2, Node<K>> -> 0x55289dd95dde91bbc62b3e414066cf83/omap.OMap<K, List<&2, K>>
The prerequisites of each node; the first node with an id wins, as deps does.
template go.fast source · line 286 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @-cmp:(@_:K -> @_:K -> Cmp) -> @fuel:Nat -> @ds:List<&2, K> -> @+gi:0x55289dd95dde91bbc62b3e414066cf83/omap.OMap<K, List<&2, K>> -> @+path:List<&2, K> -> @+pi:0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K) -> @+done:List<&2, K> -> @+di:0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K) -> Result<&2, &2, Error<K>, Walk<K>>
go, with path, done, and the graph also held in ordered maps.
template any_in.fast source · line 306 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @xs:List<&2, K> -> @+s:0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K) -> Bool
template deps.fast source · line 313 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @+gi:0x55289dd95dde91bbc62b3e414066cf83/omap.OMap<K, List<&2, K>> -> @+x:K -> List<&2, K>
template plan.fast source · line 325 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @-cmp:(@_:K -> @_:K -> Cmp) -> @+g:List<&2, Node<K>> -> @+ts:List<&2, K> -> Result<&2, &2, Error<K>, List<&2, K>>
plan, in O(n log n) comparisons when cmp is a total order whose EQ agrees with eq. The walk is proved valid, so the check that plan runs is left out.
template invalidate.go source · line 338 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @p:List<&2, K> -> @+g:List<&2, Node<K>> -> @+changed:List<&2, K> -> @+acc:List<&2, K> -> List<&2, K>
template invalidate source · line 347 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @p:List<&2, K> -> @+g:List<&2, Node<K>> -> @+changed:List<&2, K> -> List<&2, K>
The nodes of p that changed or require a stale node, latest first.
template idx.if source · line 350 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @hit:Bool -> @+x:K -> @s:0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K) -> 0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K)
template invalidate.fast.go source · line 357 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @p:List<&2, K> -> @+gi:0x55289dd95dde91bbc62b3e414066cf83/omap.OMap<K, List<&2, K>> -> @+ci:0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K) -> @+acc:List<&2, K> -> @+ai:0x55289dd95dde91bbc62b3e414066cf83/omap.OSet(K) -> List<&2, K>
template invalidate.fast source · line 368 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @p:List<&2, K> -> @+g:List<&2, Node<K>> -> @+changed:List<&2, K> -> List<&2, K>
invalidate, in O(n log n) comparisons when cmp is a total order whose EQ agrees with eq.
template status source · line 374 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @st:List<&2, Entry<K>> -> @+k:K -> Maybe<&2, Status>
template ready source · line 415 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @ds:List<&2, K> -> @+st:List<&2, Entry<K>> -> Bool
Every node of ds is Built or Fresh in st.
template decide.node source · line 433 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @m:Maybe<&2, List<&2, K>> -> @stale:Bool -> @+st:List<&2, Entry<K>> -> Action
template decide.seen source · line 440 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @seen:Bool -> @+g:List<&2, Node<K>> -> @+stale:List<&2, K> -> @+st:List<&2, Entry<K>> -> @+x:K -> Action
template decide source · line 448 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @+g:List<&2, Node<K>> -> @+stale:List<&2, K> -> @+st:List<&2, Entry<K>> -> @+x:K -> Action
What to do with x: run it, mark it without a run, or pass it.
template exec source · line 486 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @p:List<&2, K> -> @+g:List<&2, Node<K>> -> @+stale:List<&2, K> -> @+st:List<&2, Entry<K>> -> @+rs:List<&2, Bool> -> List<&2, Entry<K>>
The model of a run: rs holds the result of each command, in order. Statuses are newest first.
template drop source · line 536 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @xs:List<&2, K> -> @+y:K -> List<&2, K>
xs without the nodes eq to y.
template finish source · line 558 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @pool:Pool<K> -> @e:Fin<K> -> Pool<K>
The pool after e; a finish for a node that does not run changes nothing.
template decide.par.node source · line 588 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @m:Maybe<&2, List<&2, K>> -> @+st:List<&2, Entry<K>> -> @+running:List<&2, K> -> @stale:Bool -> @room:Bool -> Step
template decide.par.seen source · line 595 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @seen:Bool -> @+g:List<&2, Node<K>> -> @+stale:List<&2, K> -> @+limit:Nat -> @+st:List<&2, Entry<K>> -> @+running:List<&2, K> -> @+x:K -> Step
template decide.par source · line 604 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @+g:List<&2, Node<K>> -> @+stale:List<&2, K> -> @+limit:Nat -> @pool:Pool<K> -> @+x:K -> Step
What to do with x in a parallel run.
template par source · line 631 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @es:List<&2, Fin<K>> -> @p:List<&2, K> -> @+g:List<&2, Node<K>> -> @+stale:List<&2, K> -> @+limit:Nat -> @+pool:Pool<K> -> Pool<K>
The model of a parallel run. Nodes start in plan order, up to limit at once; es holds the finishes, in the order they arrive. A node that must wait takes the next finish; the run stops when it must wait and no finish is left.