planner.bend relies on unsafe/foreign
raw source on the hub · import bend-kit-planner@0.5.1.1/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.2/bytes.bend as Bytes import bend-kit-hash@0.3.2.3/hash.bend as Hash import bend-kit-files@0.4.0.2/files.bend as Files import bend-kit-process@0.5.2.2/process.bend as Proc import bend-kit-collections@0.1.6.0/omap.bend as OMap import bend-kit-collections@0.1.6.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:0x10ceb446702f8ba914f62333f225a11e/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 FPool source · line 666 · raw
@-K:Data -> Data
A pool and the index of its statuses.
FPool@-K:Data -> @pool:Pool<K> -> @si:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, Status> -> FPool<K>
type Task source · line 763 · 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 935 · raw
Data
A node and the hash of its command, prerequisites, and inputs.
Stamp@node:String -> @hash:String -> Stamp
type Ran source · line 1061 · 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 1065 · raw
Data
Log@node:String -> @ran:Ran -> Log
type Outcome source · line 1069 · 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 1129 · raw
Data
A finished command, as its job reports it.
Msg@node:String -> @ran:Maybe<&2, Ran> -> Msg
type Ledger source · line 1132 · raw
Data
Ledger@pool:FPool<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> -> @_:0x10ceb446702f8ba914f62333f225a11e/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:0x10ceb446702f8ba914f62333f225a11e/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 String.same source · line 759 · raw
@a:String -> @b:String -> Bool
Equal strings, as the order that build indexes them by sees them.
def Run source · line 767 · raw
@-A:Type -> Type
def Run.pure source · line 770 · raw
@-A:Type -> @x:A -> Run(A)
def Run.fail source · line 773 · raw
@-A:Type -> @e:Pair(U32, String) -> Run(A)
def Run.next source · line 776 · raw
@-A:Type -> @-B:Type -> @r:Result<&1, &1, Pair(U32, String), A> -> @f:(@_:A -> Run(B)) -> Run(B)
def Run.bind source · line 783 · raw
@-A:Type -> @-B:Type -> @m:Run(A) -> @f:(@_:A -> Run(B)) -> Run(B)
def Run.lift source · line 786 · raw
@-A:Type -> @m:IO(A) -> Run(A)
def Task.node source · line 789 · raw
@t:Task -> Node<String>
def graph source · line 794 · raw
@ts:List<&2, Task> -> List<&2, Node<String>>
def tidx source · line 802 · raw
@ts:List<&2, Task> -> 0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, Task>
Each task by id; the first task with an id wins.
def task source · line 809 · raw
@+ti:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, Task> -> @+k:String -> Maybe<&2, Task>
def id.char source · line 812 · raw
@c:Char -> Bool
def id.chars source · line 816 · raw
@s:String -> Bool
def id.ok source · line 824 · 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 827 · raw
@ts:List<&2, Task> -> Maybe<&2, String>
def Error.show source · line 834 · raw
@e:Error<String> -> String
def Status.show source · line 845 · raw
@s:Status -> String
def text source · line 857 · raw
@s:String -> String
Each code point in decimal, so distinct strings give distinct text.
def texts source · line 864 · raw
@xs:List<&2, String> -> String
def digest.of source · line 871 · raw
@r:Pair(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes, 0x69fddc45ff45d5f1505e6d3e58528262/hash.W64) -> String
def digest source · line 876 · raw
@b:0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes -> String
def file.end source · line 879 · raw
@empty:Bool -> @f:File -> @acc:0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes -> @b:0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes -> @k:(@_:File -> @_:0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes -> IO(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes)) -> IO(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes)
def file.got source · line 888 · raw
@r:Pair(File, Result<&1, &1, Pair(U32, String), 0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes>) -> @acc:0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes -> @k:(@_:File -> @_:0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes -> IO(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes)) -> IO(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes)
def file.more source · line 899 · raw
@n:Nat -> @f:File -> @acc:0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes -> IO(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes)
The rest of f, read 1 MiB at a time, in at most n reads.
def file.opened source · line 909 · raw
@r:Result<&1, &1, Pair(U32, String), File> -> IO(String)
def file.stamp source · line 917 · raw
@path:String -> IO(String)
"m" when path does not open, else "f" and the hash of its octets.
def inputs.stamp source · line 920 · raw
@xs:List<&2, String> -> @+dir:String -> @acc:String -> IO(String)
def Task.stamp source · line 928 · raw
@t:Task -> @+dir:String -> IO(String)
The hash of the command, the prerequisites, and every input file.
def stamps.idx source · line 939 · raw
@xs:List<&2, Stamp> -> 0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, String>
Each stamp by node; the first stamp of a node wins.
def lookup source · line 946 · raw
@+xi:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, String> -> @+k:String -> Maybe<&2, String>
def stamps.now source · line 949 · raw
@p:List<&2, String> -> @+ti:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, Task> -> @+dir:String -> @acc:List<&2, Stamp> -> IO(List<&2, Stamp>)
def same source · line 958 · raw
@a:Maybe<&2, String> -> @b:Maybe<&2, String> -> Bool
def changed source · line 966 · raw
@p:List<&2, String> -> @+old:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, String> -> @+now:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, String> -> List<&2, String>
The nodes of p whose stamp now is not the recorded one.
def after.new source · line 974 · raw
@st:List<&2, Entry<String>> -> @+now:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, String> -> 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 982 · raw
@old:List<&2, Stamp> -> @+done:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, Status> -> List<&2, Stamp>
def after source · line 990 · raw
@+st:List<&2, Entry<String>> -> @+si:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, Status> -> @+now:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, String> -> @old:List<&2, Stamp> -> List<&2, Stamp>
def stamps.line source · line 993 · raw
@e:Stamp -> String
def stamps.lines source · line 998 · raw
@xs:List<&2, Stamp> -> String
def stamps.show source · line 1005 · raw
@xs:List<&2, Stamp> -> String
def stamps.entry source · line 1008 · raw
@fields:List<&2, String> -> List<&2, Stamp>
def stamps.parse source · line 1015 · raw
@lines:List<&2, String> -> List<&2, Stamp>
def stamps.got source · line 1022 · raw
@r:Pair(File, Result<&1, &1, Pair(U32, String), String>) -> IO(List<&2, Stamp>)
def stamps.opened source · line 1033 · raw
@r:Result<&1, &1, Pair(U32, String), File> -> IO(List<&2, Stamp>)
def stamps.read source · line 1041 · raw
@path:String -> IO(List<&2, Stamp>)
The recorded stamps; none when the file does not open.
def stamps.closed source · line 1044 · raw
@r:Pair(File, Result<&1, &1, Pair(U32, String), Unit>) -> Run(Unit)
def stamps.write source · line 1052 · 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 1072 · raw
@r:Ran -> Bool
def tail.of source · line 1079 · raw
@r:Pair(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes, 0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes) -> String
def tail source · line 1085 · raw
@b:0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes -> String
The last 4096 octets of b, one Char per octet.
def run.ran source · line 1090 · raw
@r:Result<&1, &1, Pair(U32, String), Pair(U32, Pair(0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes, 0x166a26e38c43ec5f8fe3323f5850e3d8/bytes.Bytes))> -> Ran
def run.argv source · line 1098 · 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 1106 · raw
@dir:String -> @m:Maybe<&2, Task> -> IO(Maybe<&2, Ran>)
def run.ok source · line 1114 · raw
@m:Maybe<&2, Ran> -> Bool
A group succeeds; a command succeeds when it exits 0.
def run.log source · line 1121 · raw
@+x:String -> @m:Maybe<&2, Ran> -> @logs:List<&2, Log> -> List<&2, Log>
def run.job source · line 1135 · raw
@dir:String -> @m:Maybe<&2, Task> -> @+x:String -> @chan:Chan(Msg) -> IO(Unit)
def run.msg source · line 1141 · raw
@m:Maybe<&1, Msg> -> @+pool:FPool<String> -> @+logs:List<&2, Log> -> @k:(@_:FPool<String> -> @_:List<&2, Log> -> IO(Ledger)) -> IO(Ledger)
def run.recv source · line 1149 · raw
@+chan:Chan(Msg) -> @+pool:FPool<String> -> @+logs:List<&2, Log> -> @k:(@_:FPool<String> -> @_:List<&2, Log> -> IO(Ledger)) -> IO(Ledger)
Takes the next finished command, then goes on with k.
def run.drain source · line 1153 · raw
@n:Nat -> @+pool:FPool<String> -> @+logs:List<&2, Log> -> @+chan:Chan(Msg) -> IO(Ledger)
Waits for n running commands.
def Pool.busy source · line 1160 · raw
@pool:FPool<String> -> Nat
def par.case source · line 1165 · raw
@-R:Type -> @a:Step -> @wait:(@_:Unit -> R) -> @start:(@_:Unit -> R) -> @other:(@_:Unit -> R) -> R
def run.par source · line 1175 · raw
@n:Nat -> @p:List<&2, String> -> @+ti:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, Task> -> @+gi:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, List<&2, String>> -> @+stale:0x10ceb446702f8ba914f62333f225a11e/omap.OSet(String) -> @+limit:Nat -> @+pool:FPool<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.idx source · line 1195 · raw
@logs:List<&2, Log> -> 0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, Ran>
What each node's command left; the newest log of a node wins.
def outcome.of source · line 1202 · raw
@m:Maybe<&2, Status> -> @+x:String -> @r:Maybe<&2, Ran> -> @rest:List<&2, Outcome> -> List<&2, Outcome>
def outcomes source · line 1210 · raw
@p:List<&2, String> -> @+si:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, Status> -> @+ri:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, Ran> -> List<&2, Outcome>
Each node of p that has a status, in plan order.
def build.ids source · line 1217 · raw
@m:Maybe<&2, String> -> Run(Unit)
def build.plan source · line 1224 · raw
@r:Result<&2, &2, Error<String>, List<&2, String>> -> Run(List<&2, String>)
def build.done source · line 1231 · raw
@+path:String -> @p:List<&2, String> -> @+now:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<String, String> -> @old:List<&2, Stamp> -> @l:Ledger -> Run(List<&2, Outcome>)
def build source · line 1240 · 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> -> 0x10ceb446702f8ba914f62333f225a11e/omap.OSet(K)
template gidx source · line 245 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @g:List<&2, Node<K>> -> 0x10ceb446702f8ba914f62333f225a11e/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:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, List<&2, K>> -> @+path:List<&2, K> -> @+pi:0x10ceb446702f8ba914f62333f225a11e/omap.OSet(K) -> @+done:List<&2, K> -> @+di:0x10ceb446702f8ba914f62333f225a11e/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:0x10ceb446702f8ba914f62333f225a11e/omap.OSet(K) -> Bool
template deps.fast source · line 313 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @+gi:0x10ceb446702f8ba914f62333f225a11e/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:0x10ceb446702f8ba914f62333f225a11e/omap.OSet(K) -> 0x10ceb446702f8ba914f62333f225a11e/omap.OSet(K)
template invalidate.fast.go source · line 357 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @p:List<&2, K> -> @+gi:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, List<&2, K>> -> @+ci:0x10ceb446702f8ba914f62333f225a11e/omap.OSet(K) -> @+acc:List<&2, K> -> @+ai:0x10ceb446702f8ba914f62333f225a11e/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.
template sidx source · line 658 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @st:List<&2, Entry<K>> -> 0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, Status>
The status of each node; the newest entry wins, as status does.
template lift source · line 669 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @pool:Pool<K> -> FPool<K>
template status.fast source · line 674 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @+si:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, Status> -> @+k:K -> Maybe<&2, Status>
template ready.fast source · line 677 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @ds:List<&2, K> -> @+si:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, Status> -> Bool
template decide.par.node.fast source · line 684 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @-cmp:(@_:K -> @_:K -> Cmp) -> @m:Maybe<&2, List<&2, K>> -> @+si:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, Status> -> @+running:List<&2, K> -> @stale:Bool -> @room:Bool -> Step
template decide.par.seen.fast source · line 691 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @-cmp:(@_:K -> @_:K -> Cmp) -> @seen:Bool -> @+gi:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, List<&2, K>> -> @+stalei:0x10ceb446702f8ba914f62333f225a11e/omap.OSet(K) -> @+limit:Nat -> @+si:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, Status> -> @+running:List<&2, K> -> @+x:K -> Step
template decide.par.fast source · line 702 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @-cmp:(@_:K -> @_:K -> Cmp) -> @+gi:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, List<&2, K>> -> @+stalei:0x10ceb446702f8ba914f62333f225a11e/omap.OSet(K) -> @+limit:Nat -> @fp:FPool<K> -> @+x:K -> Step
template apply.si source · line 707 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @a:Step -> @si:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, Status> -> @+x:K -> 0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, Status>
template apply.fast source · line 714 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @+a:Step -> @fp:FPool<K> -> @+x:K -> FPool<K>
template finish.si source · line 719 · raw
@-K:Data -> @-cmp:(@_:K -> @_:K -> Cmp) -> @run:Bool -> @si:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, Status> -> @+y:K -> @ok:Bool -> 0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, Status>
template finish.fast source · line 726 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @-cmp:(@_:K -> @_:K -> Cmp) -> @fp:FPool<K> -> @e:Fin<K> -> FPool<K>
template par.fast source · line 733 · raw
@-K:Data -> @-eq:(@_:K -> @_:K -> Bool) -> @-cmp:(@_:K -> @_:K -> Cmp) -> @es:List<&2, Fin<K>> -> @p:List<&2, K> -> @+gi:0x10ceb446702f8ba914f62333f225a11e/omap.OMap<K, List<&2, K>> -> @+stalei:0x10ceb446702f8ba914f62333f225a11e/omap.OSet(K) -> @+limit:Nat -> @+fp:FPool<K> -> FPool<K>
par, in O(n log n) comparisons when cmp is a total order whose EQ agrees with eq.