2018-03-19 21:23:04 +03:00
|
|
|
!:
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
|
|
|
:: sys/zuse/hoon
|
|
|
|
::
|
|
|
|
:: |ford: build system vane interface
|
|
|
|
::
|
|
|
|
|%
|
2018-03-16 03:21:46 +03:00
|
|
|
++ ford-api ^?
|
2018-03-15 21:48:24 +03:00
|
|
|
|%
|
|
|
|
:: |able:ford: ford's public +move interface
|
|
|
|
::
|
|
|
|
++ able ^?
|
|
|
|
|%
|
|
|
|
:: +task:able:ford: requests to ford
|
|
|
|
::
|
|
|
|
+= task
|
|
|
|
$% :: %make: perform a build, either live or once
|
|
|
|
::
|
|
|
|
$: %make
|
2018-03-16 03:21:46 +03:00
|
|
|
:: our: who our ship is (remove after cc-release)
|
|
|
|
::
|
|
|
|
our=@p
|
2018-03-15 21:48:24 +03:00
|
|
|
:: plan: the schematic to build
|
|
|
|
::
|
2018-03-16 03:21:46 +03:00
|
|
|
=schematic
|
2018-03-15 21:48:24 +03:00
|
|
|
==
|
|
|
|
:: %kill: stop a build; send on same duct as original %make request
|
|
|
|
::
|
2018-03-16 03:21:46 +03:00
|
|
|
$: %kill
|
|
|
|
:: our: who our ship is (remove after cc-release)s
|
|
|
|
::
|
|
|
|
our=@p
|
|
|
|
==
|
2018-03-15 21:48:24 +03:00
|
|
|
:: %wegh: produce memory usage information
|
|
|
|
::
|
|
|
|
[%wegh ~]
|
|
|
|
:: %wipe: clear cache
|
|
|
|
::
|
|
|
|
[%wipe ~]
|
|
|
|
==
|
|
|
|
:: +gift:able:ford: responses from ford
|
|
|
|
::
|
|
|
|
+= gift
|
|
|
|
$% :: %mass: memory usage; response to %wegh +task
|
|
|
|
::
|
|
|
|
[%mass p=mass]
|
|
|
|
:: %made: build result; response to %make +task
|
|
|
|
::
|
|
|
|
$: %made
|
|
|
|
:: date: formal date of the build
|
|
|
|
::
|
|
|
|
date=@da
|
|
|
|
:: result: result of the build; either complete build, or error
|
|
|
|
::
|
|
|
|
$= result
|
|
|
|
$% :: %complete: contains the result of the completed build
|
|
|
|
::
|
|
|
|
[%complete build-result]
|
|
|
|
:: %incomplete: couldn't finish build; contains error message
|
|
|
|
::
|
|
|
|
[%incomplete tang]
|
|
|
|
== == ==
|
|
|
|
--
|
|
|
|
:: +disc: a desk on a ship; can be used as a beak that varies with time
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
+= disc [=ship =desk]
|
|
|
|
:: +rail: a time-varying full path
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
:: This can be thought of as a +beam without a +case, which is what
|
|
|
|
:: would specify the time. :spur is flopped just like the +spur in a +beam.
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
+= rail [=disc =spur]
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +resource: time-varying dependency on a value from the urbit namespace
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
+= resource
|
2018-03-30 23:21:08 +03:00
|
|
|
$: :: vane which we are querying
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-03-30 23:21:08 +03:00
|
|
|
vane=?(%c %g)
|
|
|
|
:: type of request
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-03-30 23:21:08 +03:00
|
|
|
:: TODO: care:clay should be cleaned up in zuse as it is a general
|
|
|
|
:: type, not a clay specific one.
|
|
|
|
::
|
|
|
|
care=care:clay
|
2018-05-01 00:57:32 +03:00
|
|
|
:: path on which to depend, missing time, which will be filled in
|
2018-03-30 23:21:08 +03:00
|
|
|
::
|
|
|
|
=rail
|
2018-03-15 21:48:24 +03:00
|
|
|
==
|
|
|
|
:: +build-result: the referentially transparent result of a +build
|
|
|
|
::
|
2018-03-16 03:21:46 +03:00
|
|
|
:: A +build produces either an error or a result. A result is a tagged
|
|
|
|
:: union of the various kinds of datatypes a build can produce. The tag
|
|
|
|
:: represents the sub-type of +schematic that produced the result.
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
|
|
|
+= build-result
|
|
|
|
$% :: %error: the build produced an error whose description is :message
|
|
|
|
::
|
|
|
|
[%error message=tang]
|
2018-05-01 00:57:32 +03:00
|
|
|
:: %success: result of successful +build, tagged by +schematic sub-type
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
$: %success
|
2018-03-15 21:48:24 +03:00
|
|
|
$^ [head=build-result tail=build-result]
|
2018-04-03 03:06:31 +03:00
|
|
|
$% [%$ =cage]
|
|
|
|
[%pin date=@da =build-result]
|
|
|
|
[%alts =build-result]
|
|
|
|
[%bake =cage]
|
|
|
|
[%bunt =cage]
|
|
|
|
[%call =vase]
|
|
|
|
[%cast =cage]
|
|
|
|
[%core =vase]
|
|
|
|
[%diff =cage]
|
|
|
|
[%dude =build-result]
|
|
|
|
[%hood =scaffold]
|
|
|
|
[%join =cage]
|
|
|
|
[%mash =cage]
|
|
|
|
[%mute =cage]
|
|
|
|
[%pact =cage]
|
|
|
|
[%path =rail]
|
|
|
|
[%plan =vase]
|
|
|
|
[%reef =vase]
|
|
|
|
[%ride =vase]
|
|
|
|
[%same =build-result]
|
|
|
|
[%scry =cage]
|
|
|
|
[%slim [=type =nock]]
|
|
|
|
[%slit =type]
|
|
|
|
[%vale =cage]
|
|
|
|
[%volt =cage]
|
2018-03-15 21:48:24 +03:00
|
|
|
== == ==
|
|
|
|
::
|
|
|
|
:: +schematic: plan for building
|
|
|
|
::
|
|
|
|
++ schematic
|
|
|
|
:: If the head of the +schematic is a pair, it's an auto-cons
|
|
|
|
:: schematic. Its result will be the pair of results of its
|
|
|
|
:: sub-schematics.
|
|
|
|
::
|
|
|
|
$^ [head=schematic tail=schematic]
|
|
|
|
::
|
2018-03-21 03:37:57 +03:00
|
|
|
$% :: %$: literal value. Produces its input unchanged.
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
|
|
|
$: %$
|
|
|
|
:: literal: the value to be produced by the build
|
|
|
|
::
|
|
|
|
literal=cage
|
|
|
|
==
|
2018-03-30 04:36:09 +03:00
|
|
|
:: %pin: pins a sub-schematic to a date
|
|
|
|
::
|
|
|
|
:: There is a difference between live builds and once builds. In
|
|
|
|
:: live builds, we produce results over and over again and aren't
|
|
|
|
:: pinned to a specifc time. In once builds, we want to specify a
|
|
|
|
:: specific date, which we apply recursively to any sub-schematics
|
|
|
|
:: contained within :schematic.
|
|
|
|
::
|
2018-03-30 22:53:57 +03:00
|
|
|
:: If a build has a %pin at the top level, we consider it to be a
|
|
|
|
:: once build. Otherwise, we consider it to be a live build. We do
|
|
|
|
:: this so schematics which depend on the result of a once build can
|
|
|
|
:: be cached, giving the client explicit control over the caching
|
|
|
|
:: behaviour.
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
$: %pin
|
|
|
|
:: date: time at which to perform the build
|
|
|
|
::
|
|
|
|
date=@da
|
|
|
|
:: schematic: wrapped schematic of pinned time
|
|
|
|
::
|
|
|
|
=schematic
|
|
|
|
==
|
2018-03-15 21:48:24 +03:00
|
|
|
:: %alts: alternative build choices
|
|
|
|
::
|
|
|
|
:: Try each choice in :choices, in order; accept the first one that
|
|
|
|
:: succeeds. Note that the result inherits the dependencies of all
|
|
|
|
:: failed schematics, as well as the successful one.
|
|
|
|
::
|
|
|
|
$: %alts
|
|
|
|
:: choices: list of build options to try
|
|
|
|
::
|
|
|
|
choices=(list schematic)
|
|
|
|
==
|
|
|
|
:: %bake: run a file through a renderer
|
|
|
|
::
|
|
|
|
$: %bake
|
|
|
|
:: renderer: name of renderer; also its file path in ren/
|
|
|
|
::
|
|
|
|
renderer=term
|
|
|
|
:: query-string: the query string of the renderer's http path
|
|
|
|
::
|
|
|
|
query-string=coin
|
|
|
|
:: path-to-render: full path of file to render
|
|
|
|
::
|
|
|
|
path-to-render=rail
|
|
|
|
==
|
|
|
|
:: %bunt: produce the default value for a mark
|
|
|
|
::
|
|
|
|
$: %bunt
|
2018-03-30 04:36:09 +03:00
|
|
|
:: disc where in clay to load the mark from
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=disc
|
2018-03-15 21:48:24 +03:00
|
|
|
:: mark: name of mark; also its file path in mar/
|
|
|
|
::
|
|
|
|
mark=term
|
|
|
|
==
|
|
|
|
:: %call: call a gate on a sample
|
|
|
|
::
|
|
|
|
$: %call
|
|
|
|
:: gate: schematic whose result is a gate
|
|
|
|
::
|
|
|
|
gate=schematic
|
|
|
|
:: sample: schematic whose result will be the gate's sample
|
|
|
|
::
|
|
|
|
sample=schematic
|
|
|
|
==
|
|
|
|
:: %cast: cast the result of a schematic through a mark
|
|
|
|
::
|
|
|
|
$: %cast
|
2018-03-30 04:36:09 +03:00
|
|
|
:: disc where in clay to load the mark from
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=disc
|
2018-03-15 21:48:24 +03:00
|
|
|
:: mark: name of mark; also its file path in ren/
|
|
|
|
::
|
|
|
|
mark=term
|
|
|
|
:: input: schematic whose result will be run through the mark
|
|
|
|
::
|
|
|
|
input=schematic
|
|
|
|
==
|
|
|
|
:: %core: build a hoon program from a source file
|
|
|
|
::
|
|
|
|
$: %core
|
|
|
|
:: source-path: clay path from which to load hoon source
|
|
|
|
::
|
|
|
|
source-path=rail
|
|
|
|
==
|
2018-03-21 21:10:54 +03:00
|
|
|
:: %diff: produce marked diff from :first to :second
|
|
|
|
::
|
|
|
|
$: %diff
|
2018-03-30 04:36:09 +03:00
|
|
|
:: disc where in clay to load the mark from
|
2018-03-21 21:10:54 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=disc
|
2018-03-21 21:10:54 +03:00
|
|
|
:: old: schematic producing data to be used as diff starting point
|
|
|
|
::
|
|
|
|
start=schematic
|
|
|
|
:: new: schematic producing data to be used as diff ending point
|
|
|
|
::
|
|
|
|
end=schematic
|
|
|
|
==
|
2018-03-15 21:48:24 +03:00
|
|
|
:: %dude: wrap a failure's error message with an extra message
|
|
|
|
::
|
|
|
|
$: %dude
|
|
|
|
:: error: a trap producing an error message to wrap the original
|
|
|
|
::
|
|
|
|
error=(trap tank)
|
|
|
|
:: attempt: the schematic to try, whose error we wrap, if any
|
|
|
|
::
|
|
|
|
attempt=schematic
|
|
|
|
==
|
|
|
|
:: %hood: create a +hood from a hoon source file
|
|
|
|
::
|
|
|
|
$: %hood
|
|
|
|
:: source-path: clay path from which to load hoon source
|
|
|
|
::
|
|
|
|
source-path=rail
|
|
|
|
==
|
2018-03-21 21:10:54 +03:00
|
|
|
:: %join: merge two diffs into one diff; produces `~` if conflicts
|
|
|
|
::
|
|
|
|
$: %join
|
2018-03-30 04:36:09 +03:00
|
|
|
:: disc where in clay to load the mark from
|
2018-03-21 21:10:54 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=disc
|
2018-03-21 21:10:54 +03:00
|
|
|
:: mark: name of the mark to use for diffs; also file path in mar/
|
|
|
|
::
|
|
|
|
mark=term
|
|
|
|
:: first: schematic producing first diff
|
|
|
|
::
|
|
|
|
first=schematic
|
|
|
|
:: second: schematic producing second diff
|
|
|
|
::
|
|
|
|
second=schematic
|
|
|
|
==
|
|
|
|
:: %mash: force a merge, annotating any conflicts
|
|
|
|
::
|
|
|
|
$: %mash
|
2018-03-30 04:36:09 +03:00
|
|
|
:: disc where in clay to load the mark from
|
2018-03-21 21:10:54 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=disc
|
2018-03-21 21:10:54 +03:00
|
|
|
:: mark: name of mark used in diffs; also file path in mar/
|
|
|
|
::
|
|
|
|
mark=term
|
|
|
|
:: first: schematic producing first diff
|
|
|
|
::
|
|
|
|
first=schematic
|
|
|
|
:: second: schematic producing second diff
|
|
|
|
::
|
|
|
|
second=schematic
|
|
|
|
==
|
|
|
|
:: %mute: mutate a noun by replacing its wings with new values
|
|
|
|
::
|
|
|
|
$: %mute
|
|
|
|
:: subject: schematic producing the noun to mutate
|
|
|
|
::
|
|
|
|
subject=schematic
|
|
|
|
:: mutations: axes and schematics to produce their new contents
|
|
|
|
::
|
|
|
|
mutations=(list (pair wing schematic))
|
|
|
|
==
|
|
|
|
:: %pact: patch a marked noun by applying a diff
|
|
|
|
::
|
|
|
|
$: %pact
|
2018-03-30 04:36:09 +03:00
|
|
|
:: disc where in clay to load the mark from
|
2018-03-21 21:10:54 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=disc
|
2018-03-21 21:10:54 +03:00
|
|
|
:: mark: name of mark to use in diff; also file path in mar/
|
|
|
|
::
|
|
|
|
mark=term
|
|
|
|
:: start: schematic producing a noun to be patched
|
|
|
|
::
|
|
|
|
start=schematic
|
|
|
|
:: diff: schematic producing the diff to apply to :start
|
|
|
|
::
|
|
|
|
diff=schematic
|
|
|
|
==
|
2018-03-15 21:48:24 +03:00
|
|
|
:: %path: resolve a path with `-`s to a path with `/`s
|
|
|
|
::
|
2018-05-10 23:34:25 +03:00
|
|
|
:: Resolve +raw-path to a path containing a file, replacing
|
2018-03-15 21:48:24 +03:00
|
|
|
:: any `-`s in the path with `/`s if no file exists at the
|
|
|
|
:: original path. Produces an error if multiple files match,
|
|
|
|
:: e.g. a/b/c and a/b-c, or a/b/c and a-b/c.
|
|
|
|
::
|
|
|
|
$: %path
|
2018-05-10 23:34:25 +03:00
|
|
|
:: disc: the +disc forming the base of the path to be resolved
|
|
|
|
::
|
|
|
|
=disc
|
|
|
|
:: prefix: path prefix under which to resolve :raw-path, e.g. lib
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-10 23:34:25 +03:00
|
|
|
prefix=@tas
|
|
|
|
:: raw-path: the file path to be resolved
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-10 23:34:25 +03:00
|
|
|
raw-path=@tas
|
2018-03-15 21:48:24 +03:00
|
|
|
==
|
|
|
|
:: %plan: build a hoon program from a preprocessed source file
|
|
|
|
::
|
|
|
|
$: %plan
|
|
|
|
:: source-path: the clay path of the hoon source file
|
|
|
|
::
|
|
|
|
source-path=rail
|
|
|
|
:: query-string: the query string of the http request
|
|
|
|
::
|
|
|
|
query-string=coin
|
|
|
|
:: scaffold: preprocessed hoon source and imports
|
|
|
|
::
|
|
|
|
=scaffold
|
|
|
|
==
|
|
|
|
:: %reef: produce a hoon+zuse kernel. used internally for caching
|
|
|
|
::
|
2018-05-15 02:19:56 +03:00
|
|
|
$: %reef
|
|
|
|
:: disc: location of sys/hoon/hoon and sys/zuse/hoon
|
|
|
|
::
|
|
|
|
=disc
|
|
|
|
==
|
2018-03-15 21:48:24 +03:00
|
|
|
:: %ride: eval hoon as formula with result of a schematic as subject
|
|
|
|
::
|
|
|
|
$: %ride
|
|
|
|
:: formula: a hoon to be evaluated against a subject
|
|
|
|
::
|
|
|
|
formula=hoon
|
|
|
|
:: subject: a schematic whose result will be used as subject
|
|
|
|
::
|
|
|
|
subject=schematic
|
|
|
|
==
|
2018-03-30 22:53:57 +03:00
|
|
|
:: %same: the identity function
|
|
|
|
::
|
|
|
|
:: Functionally used to "unpin" a build for caching reasons. If you
|
|
|
|
:: run a %pin build, it is treated as a once build and is therefore
|
|
|
|
:: not cached. Wrapping the %pin schematic in a %same schematic
|
|
|
|
:: converts it to a live build, which will be cached due to live
|
|
|
|
:: build subscription semantics.
|
|
|
|
::
|
|
|
|
$: %same
|
|
|
|
:: schematic that we evaluate to
|
|
|
|
::
|
|
|
|
=schematic
|
|
|
|
==
|
2018-03-15 21:48:24 +03:00
|
|
|
:: %scry: lookup a value from the urbit namespace
|
|
|
|
::
|
|
|
|
$: %scry
|
2018-05-01 00:57:32 +03:00
|
|
|
:: resource: a namespace request, with unspecified time
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: Schematics can only be resolved when specifying a time,
|
|
|
|
:: which will convert this +resource into a +scry-request.
|
|
|
|
::
|
|
|
|
=resource
|
2018-03-15 21:48:24 +03:00
|
|
|
==
|
|
|
|
:: %slim: compile a hoon against a subject type
|
|
|
|
::
|
|
|
|
$: %slim
|
|
|
|
:: compile-time subject type for the :formula
|
2018-03-21 03:37:57 +03:00
|
|
|
::
|
2018-03-15 21:48:24 +03:00
|
|
|
subject-type=type
|
|
|
|
:: formula: a +hoon to be compiled to (pair type nock)
|
|
|
|
::
|
|
|
|
formula=hoon
|
|
|
|
==
|
|
|
|
:: %slit: get type of gate product
|
|
|
|
::
|
|
|
|
$: %slit
|
|
|
|
:: gate: a vase containing a gate
|
|
|
|
::
|
|
|
|
gate=vase
|
|
|
|
:: sample: a vase containing the :gate's sample
|
|
|
|
::
|
|
|
|
sample=vase
|
|
|
|
==
|
|
|
|
:: %vale: coerce a noun to a mark, validated
|
|
|
|
::
|
|
|
|
$: %vale
|
2018-03-30 04:36:09 +03:00
|
|
|
:: disc where in clay to load the mark from
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=disc
|
2018-03-15 21:48:24 +03:00
|
|
|
:: mark: name of mark to use; also file path in mar/
|
|
|
|
::
|
|
|
|
mark=term
|
|
|
|
:: input: the noun to be converted using the mark
|
|
|
|
::
|
|
|
|
input=*
|
|
|
|
==
|
|
|
|
:: %volt: coerce a noun to a mark, unsafe
|
|
|
|
::
|
|
|
|
$: %volt
|
2018-03-30 04:36:09 +03:00
|
|
|
:: disc where in clay to load the mark from
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=disc
|
2018-03-15 21:48:24 +03:00
|
|
|
:: mark: name of mark to use; also file path in mar/
|
|
|
|
::
|
|
|
|
mark=term
|
|
|
|
:: input: the noun to be converted using the mark
|
|
|
|
::
|
|
|
|
input=*
|
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: +scaffold: program construction in progress
|
|
|
|
::
|
|
|
|
:: A source file with all its imports and requirements, which will be
|
|
|
|
:: built and combined into one final product.
|
|
|
|
::
|
|
|
|
+= scaffold
|
|
|
|
$: :: zuse-version: the kelvin version of the standard library
|
|
|
|
::
|
|
|
|
zuse-version=@ud
|
|
|
|
:: structures: files from %/sur which are included
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
structures=(list cable)
|
2018-03-15 21:48:24 +03:00
|
|
|
:: libraries: files from %/lib which are included
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
libraries=(list cable)
|
2018-03-15 21:48:24 +03:00
|
|
|
:: cranes: a list of resources to transform and include
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
cranes=(list crane)
|
2018-03-15 21:48:24 +03:00
|
|
|
:: sources: hoon sources, either parsed or on the filesystem
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
sources=(list brick)
|
2018-03-15 21:48:24 +03:00
|
|
|
==
|
|
|
|
:: +cable: a reference to something on the filesystem
|
|
|
|
::
|
|
|
|
+= cable
|
2018-05-12 00:42:23 +03:00
|
|
|
$: :: expose-internal-symbols: expose internal faces to subject
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-12 00:42:23 +03:00
|
|
|
:: If %.y, we don't wrap a face around this hoon when we put it in
|
|
|
|
:: the subject, which exposes its internal symbols.
|
|
|
|
::
|
|
|
|
expose-internal-symbols=?
|
2018-03-15 21:48:24 +03:00
|
|
|
:: file-path: location in clay
|
|
|
|
::
|
|
|
|
file-path=term
|
|
|
|
:: remote-location: if not `~`, remote location of file
|
|
|
|
::
|
|
|
|
remote-location=(unit (pair case ship))
|
|
|
|
==
|
|
|
|
:: +brick: hoon code, either directly specified or referencing clay
|
|
|
|
::
|
|
|
|
+= brick
|
|
|
|
$% $: :: %direct: inline parsed hoon
|
|
|
|
::
|
|
|
|
%direct
|
|
|
|
source=hoon
|
|
|
|
==
|
|
|
|
$: :: %indirect: reference to a hoon file in clay
|
|
|
|
::
|
|
|
|
%indirect
|
|
|
|
location=beam
|
|
|
|
== ==
|
|
|
|
:: +truss: late-bound path
|
|
|
|
::
|
|
|
|
:: TODO: the +tyke data structure should be rethought, possibly as part
|
|
|
|
:: of this effort since it is actually a `(list (unit hoon))`, when it
|
|
|
|
:: only represents @tas. It should be a structure which explicitly
|
|
|
|
:: represents a path with holes that need to be filled in.
|
|
|
|
::
|
|
|
|
+= truss
|
2018-03-30 04:36:09 +03:00
|
|
|
$: pre=(unit tyke)
|
|
|
|
pof=(unit [p=@ud q=tyke])
|
2018-03-15 21:48:24 +03:00
|
|
|
==
|
|
|
|
:: +crane: parsed rune used to include and transform resources
|
|
|
|
::
|
|
|
|
:: Cranes lifting cranes lifting cranes!
|
|
|
|
::
|
|
|
|
:: A recursive tree of Ford directives that specifies instructions for
|
|
|
|
:: including and transforming resources from the Urbit namespace.
|
|
|
|
::
|
|
|
|
+= crane
|
|
|
|
$% $: :: %fssg: `/~` hoon literal
|
|
|
|
::
|
|
|
|
:: `/~ <hoon>` produces a crane that evaluates arbitrary hoon.
|
|
|
|
::
|
|
|
|
%fssg
|
|
|
|
=hoon
|
|
|
|
==
|
|
|
|
$: :: %fsbc: `/$` process query string
|
|
|
|
::
|
|
|
|
:: `/$` will call a gate with the query string supplied to this
|
|
|
|
:: build. If no query string, this errors.
|
|
|
|
::
|
|
|
|
%fsbc
|
|
|
|
=hoon
|
|
|
|
==
|
|
|
|
$: :: %fsbr: `/|` first of many options that succeeds
|
|
|
|
::
|
|
|
|
:: `/|` takes a series of cranes and produces the first one
|
|
|
|
:: (left-to-right) that succeeds. If none succeed, it produces
|
|
|
|
:: stack traces from all of its arguments.
|
|
|
|
::
|
|
|
|
%fsbr
|
|
|
|
:: choices: cranes to try
|
|
|
|
::
|
|
|
|
choices=(list crane)
|
|
|
|
==
|
|
|
|
$: :: %fsts: `/=` wrap a face around a crane
|
|
|
|
::
|
|
|
|
:: /= runs a crane (usually produced by another ford rune), takes
|
|
|
|
:: the result of that crane, and wraps a face around it.
|
|
|
|
::
|
|
|
|
%fsts
|
|
|
|
:: face: face to apply
|
|
|
|
::
|
|
|
|
face=term
|
|
|
|
:: crane: internal build step
|
|
|
|
::
|
|
|
|
=crane
|
|
|
|
==
|
|
|
|
$: :: %fsdt: `/.` null-terminated list
|
|
|
|
::
|
|
|
|
:: Produce a null-terminated list from a sequence of cranes,
|
|
|
|
:: terminated by a `==`.
|
|
|
|
::
|
|
|
|
%fsdt
|
|
|
|
:: items: cranes to evaluate
|
|
|
|
::
|
|
|
|
items=(list crane)
|
|
|
|
==
|
|
|
|
$: :: %fscm: `/,` switch by path
|
|
|
|
::
|
|
|
|
:: `/,` is a switch statement, which picks a branch to evaluate
|
|
|
|
:: based on whether the current path matches the path in the
|
|
|
|
:: switch statement. Takes a sequence of pairs of (path, crane)
|
|
|
|
:: terminated by a `==`.
|
|
|
|
::
|
|
|
|
%fscm
|
|
|
|
:: cases: produces evaluated crane of first +spur match
|
|
|
|
::
|
|
|
|
cases=(list (pair spur crane))
|
|
|
|
==
|
|
|
|
$: :: %fscn: `/%` propagate extra arguments into renderers
|
|
|
|
::
|
|
|
|
:: `/%` will forward extra arguments (usually from Eyre) on to
|
|
|
|
:: any renderer in :crane. Without this, renderers that use `/$`
|
|
|
|
:: to read the extra arguments will crash.
|
|
|
|
::
|
|
|
|
%fscn
|
|
|
|
=crane
|
|
|
|
==
|
|
|
|
$: :: %fspm: `/&` pass through a series of marks
|
|
|
|
::
|
|
|
|
:: `/&` passes a crane through multiple marks, right-to-left.
|
|
|
|
::
|
|
|
|
%fspm
|
|
|
|
:: marks: marks to apply to :crane, in reverse order
|
|
|
|
::
|
|
|
|
marks=(list mark)
|
|
|
|
=crane
|
|
|
|
==
|
|
|
|
$: :: %fscb: `/_` run a crane on each file in the current directory
|
|
|
|
::
|
|
|
|
:: `/_` takes a crane as an argument. It produces a new crane
|
|
|
|
:: representing the result of mapping the supplied crane over the
|
|
|
|
:: list of files in the current directory. The keys in the
|
|
|
|
:: resulting map are the basenames of the files in the directory,
|
|
|
|
:: and each value is the result of running that crane on the
|
|
|
|
:: contents of the file.
|
2018-03-21 21:10:54 +03:00
|
|
|
::
|
2018-03-15 21:48:24 +03:00
|
|
|
%fscb
|
|
|
|
=crane
|
|
|
|
==
|
|
|
|
$: :: %fssm: `/;` operate on
|
|
|
|
::
|
|
|
|
:: `/;` takes a hoon and a crane. The hoon should evaluate to a
|
|
|
|
:: gate, which is then called with the result of the crane as its
|
|
|
|
:: sample.
|
|
|
|
::
|
|
|
|
%fssm
|
|
|
|
=hoon
|
|
|
|
=crane
|
|
|
|
==
|
|
|
|
$: :: %fscl: `/:` evaluate at path
|
|
|
|
::
|
|
|
|
:: `/:` takes a path and a +crane, and evaluates the crane with
|
|
|
|
:: the current path set to the supplied path.
|
|
|
|
::
|
|
|
|
%fscl
|
|
|
|
:: path: late bound path to be resolved relative to current beak
|
|
|
|
::
|
|
|
|
:: This becomes current path of :crane
|
|
|
|
::
|
|
|
|
path=truss
|
|
|
|
=crane
|
|
|
|
==
|
|
|
|
$: :: %fskt: `/^` cast
|
|
|
|
::
|
|
|
|
:: `/^` takes a +mold and a +crane, and casts the result of the
|
|
|
|
:: crane to the mold.
|
|
|
|
::
|
|
|
|
%fskt
|
|
|
|
:: mold: evaluates to a mold to be applied to :crane
|
|
|
|
::
|
|
|
|
mold=hoon
|
|
|
|
=crane
|
|
|
|
==
|
|
|
|
$: :: %fszp: `/!mark/` evaluate as hoon, then pass through mark
|
|
|
|
::
|
|
|
|
%fszp
|
|
|
|
=mark
|
|
|
|
==
|
|
|
|
$: :: %fszy: `/mark/` passes current path through :mark
|
|
|
|
::
|
|
|
|
%fszy
|
|
|
|
=mark
|
|
|
|
== ==
|
|
|
|
--
|
|
|
|
--
|
|
|
|
::
|
|
|
|
:: sys/ford/hoon
|
2018-05-08 02:12:07 +03:00
|
|
|
:: pit: a +vase of the hoon+zuse kernel, which is a deeply nested core
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-08 01:59:39 +03:00
|
|
|
|= pit=vase
|
2018-03-16 03:21:46 +03:00
|
|
|
::
|
|
|
|
=, ford-api
|
|
|
|
:: ford internal data structures
|
|
|
|
::
|
|
|
|
=> =~
|
|
|
|
=, ford-api :: TODO remove once in vane
|
|
|
|
|%
|
|
|
|
:: +move: arvo moves that ford can emit
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
+= move
|
2018-03-16 03:21:46 +03:00
|
|
|
::
|
|
|
|
$: :: duct: request identifier
|
|
|
|
::
|
|
|
|
=duct
|
2018-03-21 03:37:57 +03:00
|
|
|
:: card: move contents; either a +note or a +gift:able
|
2018-03-16 03:21:46 +03:00
|
|
|
::
|
|
|
|
card=(wind note gift:able)
|
|
|
|
==
|
|
|
|
:: +note: private request from ford to another vane
|
|
|
|
::
|
2018-03-21 01:39:22 +03:00
|
|
|
+= note
|
2018-03-16 03:21:46 +03:00
|
|
|
$% :: %c: to clay
|
|
|
|
::
|
|
|
|
$: %c
|
|
|
|
:: %warp: internal (intra-ship) file request
|
|
|
|
::
|
|
|
|
$% $: %warp
|
|
|
|
:: sock: pair of requesting ship, requestee ship
|
|
|
|
::
|
|
|
|
=sock
|
|
|
|
:: riff: clay request contents
|
|
|
|
::
|
|
|
|
riff=riff:clay
|
|
|
|
== == ==
|
|
|
|
:: %f: to ford itself
|
|
|
|
::
|
|
|
|
$: %f
|
|
|
|
:: %make: perform a build
|
|
|
|
::
|
|
|
|
$% $: %make
|
|
|
|
:: schematic: the schematic to build
|
|
|
|
::
|
|
|
|
=schematic
|
|
|
|
== == ==
|
|
|
|
:: %g: to gall
|
|
|
|
::
|
|
|
|
$: %g
|
|
|
|
:: %unto: full transmission
|
|
|
|
::
|
|
|
|
:: TODO: document more fully
|
|
|
|
::
|
|
|
|
$% $: %deal
|
|
|
|
:: sock: pair of requesting ship, requestee ship
|
|
|
|
::
|
|
|
|
=sock
|
|
|
|
:: cush: gall request contents
|
|
|
|
::
|
|
|
|
cush=cush:gall
|
|
|
|
== == == ==
|
2018-03-21 01:39:22 +03:00
|
|
|
:: +sign: private response from another vane to ford
|
|
|
|
::
|
|
|
|
+= sign
|
|
|
|
$% :: %c: from clay
|
|
|
|
::
|
|
|
|
$: %c
|
2018-03-22 23:30:44 +03:00
|
|
|
$% :: %writ: internal (intra-ship) file response
|
|
|
|
::
|
|
|
|
$: %writ
|
2018-03-21 01:39:22 +03:00
|
|
|
:: riot: response contents
|
|
|
|
::
|
|
|
|
riot=riot:clay
|
2018-03-22 23:30:44 +03:00
|
|
|
==
|
|
|
|
:: %wris: response to %mult; many changed files
|
|
|
|
::
|
|
|
|
$: %wris
|
|
|
|
:: case: case of the new files
|
|
|
|
::
|
2018-05-10 21:18:52 +03:00
|
|
|
:: %wris can only return dates to us.
|
|
|
|
::
|
|
|
|
case=[%da p=@da]
|
2018-03-22 23:30:44 +03:00
|
|
|
:: care-paths: the +care:clay and +path of each file
|
|
|
|
::
|
|
|
|
care-paths=(set [care=care:clay =path])
|
2018-03-21 01:39:22 +03:00
|
|
|
== == == ==
|
2018-03-16 03:21:46 +03:00
|
|
|
--
|
2018-03-21 01:39:22 +03:00
|
|
|
::
|
2018-03-16 03:21:46 +03:00
|
|
|
=, ford-api :: TODO remove once in vane
|
|
|
|
::
|
2018-03-15 21:48:24 +03:00
|
|
|
|%
|
|
|
|
::
|
|
|
|
:: +axle: overall ford state
|
|
|
|
::
|
|
|
|
+= axle
|
|
|
|
$: :: date: date at which ford's state was updated to this data structure
|
|
|
|
::
|
|
|
|
date=%~2018.3.14
|
|
|
|
:: state-by-ship: storage for all the @p's this ford has been
|
|
|
|
::
|
|
|
|
:: Once the cc-release boot sequence lands, we can remove this
|
|
|
|
:: mapping, since an arvo will not change @p identities. until
|
|
|
|
:: then, we need to support a ship booting as a comet before
|
|
|
|
:: becoming its adult identity.
|
|
|
|
::
|
|
|
|
state-by-ship=(map ship ford-state)
|
|
|
|
==
|
|
|
|
:: +ford-state: all state that ford maintains for a @p ship identity
|
|
|
|
::
|
|
|
|
+= ford-state
|
|
|
|
$: :: results: all stored build results
|
|
|
|
::
|
|
|
|
:: Ford generally stores the result for all the most recently
|
|
|
|
:: completed live builds, unless it's been asked to wipe its cache.
|
|
|
|
::
|
|
|
|
results=(map build cache-line)
|
2018-04-26 23:53:16 +03:00
|
|
|
:: builds: registry of all attempted builds
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-04-27 02:58:03 +03:00
|
|
|
builds=build-registry
|
2018-03-15 21:48:24 +03:00
|
|
|
:: components: bidirectional linkages between sub-builds and clients
|
|
|
|
::
|
|
|
|
:: The first of the two jugs maps from a build to its sub-builds.
|
|
|
|
:: The second of the two jugs maps from a build to its client builds.
|
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
components=build-dag
|
2018-04-24 02:17:20 +03:00
|
|
|
:: provisional-components: expected linkage we can't prove yet
|
|
|
|
::
|
|
|
|
:: During the +gather step, we promote builds, but our promotion
|
|
|
|
:: decisions may be wrong. We record our predictions here so we
|
|
|
|
:: can undo them.
|
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
provisional-components=build-dag
|
2018-03-22 04:27:25 +03:00
|
|
|
:: rebuilds: bidirectional links between old and new identical builds
|
2018-03-17 02:17:59 +03:00
|
|
|
::
|
|
|
|
:: Old and new build must have the same schematic and result.
|
|
|
|
:: This can form a chain, like build<-->build<-->build.
|
|
|
|
::
|
|
|
|
$= rebuilds
|
|
|
|
$: :: new: map from old build to new build
|
|
|
|
::
|
|
|
|
new=(map build build)
|
|
|
|
:: old: map from new build to old build
|
|
|
|
::
|
|
|
|
old=(map build build)
|
|
|
|
==
|
2018-05-01 00:57:32 +03:00
|
|
|
:: blocks: map from +resource to all builds waiting for its retrieval
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
blocks=(jug scry-request build)
|
2018-04-12 03:54:32 +03:00
|
|
|
:: next-builds: builds to perform in the next iteration
|
|
|
|
::
|
|
|
|
next-builds=(set build)
|
2018-05-01 00:57:32 +03:00
|
|
|
:: candidate-builds: builds which might go into next-builds
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
|
|
|
candidate-builds=(list build)
|
2018-04-12 03:54:32 +03:00
|
|
|
:: blocked builds: mappings between blocked and blocking builds
|
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
blocked-builds=build-dag
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
|
|
|
:: build request tracking
|
|
|
|
::
|
2018-03-22 04:27:25 +03:00
|
|
|
:: listeners: external requests for a build
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: Listeners get copied from the root build to every sub-build to
|
|
|
|
:: facilitate quickly checking which listeners are attached to a leaf
|
|
|
|
:: build.
|
|
|
|
::
|
2018-03-22 04:27:25 +03:00
|
|
|
listeners=(jug build listener)
|
2018-05-01 00:57:32 +03:00
|
|
|
:: root-listeners: listeners attached only to root builds
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
root-listeners=(jug build listener)
|
|
|
|
:: builds-by-listener: reverse lookup for :root-listeners
|
|
|
|
::
|
|
|
|
:: A duct can only be attached to one root build, and it is either
|
|
|
|
:: live or once. :builds-by-listener can be used to look up a +build
|
|
|
|
:: for a +duct, or to look up whether a duct is live or once.
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
builds-by-listener=(map duct [=build live=?])
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
|
|
|
:: update tracking
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: resources-by-disc: live clay resources
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: Used for looking up which +resource's rely on a particular
|
2018-03-30 04:36:09 +03:00
|
|
|
:: +disc, so that we can send a new Clay subscription with all
|
|
|
|
:: the resources we care about within that disc.
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
resources-by-disc=(jug disc resource)
|
2018-03-30 04:36:09 +03:00
|
|
|
:: latest-by-disc: latest formal date of a completed live build on disc
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: Updated each time we complete a build of a +resource,
|
2018-03-30 04:36:09 +03:00
|
|
|
:: if the build's formal date is later than the stored value.
|
|
|
|
::
|
|
|
|
latest-by-disc=(map disc @da)
|
|
|
|
:: clay-subscriptions: ducts we'll use to cancel existing clay requests
|
|
|
|
::
|
|
|
|
clay-subscriptions=(set disc)
|
2018-05-01 00:57:32 +03:00
|
|
|
:: resource-updates: all clay updates we need to know about
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: resource-updates stores all Clay changes at dates that
|
2018-03-15 21:48:24 +03:00
|
|
|
:: Ford needs to track because Ford is tracking attempted builds with
|
2018-03-30 04:36:09 +03:00
|
|
|
:: that formal date.
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
resource-updates=(jug @da resource)
|
2018-03-15 21:48:24 +03:00
|
|
|
==
|
2018-04-27 02:58:03 +03:00
|
|
|
:: +build-registry: a registry of all attempted builds
|
2018-04-26 23:53:16 +03:00
|
|
|
::
|
2018-04-27 02:58:03 +03:00
|
|
|
+= build-registry
|
2018-04-26 23:53:16 +03:00
|
|
|
$: :: builds-by-schematic: all attempted builds, sorted by time
|
|
|
|
::
|
|
|
|
:: For each schematic we've attempted to build at any time,
|
|
|
|
:: list the formal dates of all build attempts, sorted newest first.
|
|
|
|
::
|
|
|
|
by-schematic=(map schematic (list @da))
|
|
|
|
:: builds-by-date: all attempted builds, grouped by time
|
|
|
|
::
|
|
|
|
by-date=(jug @da schematic)
|
|
|
|
==
|
2018-04-26 02:56:38 +03:00
|
|
|
:: +build-dag: a directed acyclic graph of builds
|
|
|
|
::
|
|
|
|
+= build-dag
|
|
|
|
$: :: sub-builds: jug from a build to its sub-builds
|
|
|
|
::
|
|
|
|
sub-builds=(jug build build)
|
|
|
|
:: client-builds: jug from a build to its client builds
|
|
|
|
::
|
|
|
|
client-builds=(jug build build)
|
|
|
|
==
|
2018-03-15 21:48:24 +03:00
|
|
|
:: +build: a referentially transparent request for a build.
|
|
|
|
::
|
|
|
|
:: Each unique +build will always produce the same +build-result
|
|
|
|
:: when run (if it completes). A live build consists of a sequence of
|
|
|
|
:: instances of +build with the same :plan and increasing :date.
|
|
|
|
::
|
|
|
|
+= build
|
|
|
|
$: :: date: the formal date of this build; unrelated to time of execution
|
|
|
|
::
|
|
|
|
date=@da
|
2018-03-16 03:21:46 +03:00
|
|
|
:: schematic: the schematic that determines how to run this build
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-03-16 03:21:46 +03:00
|
|
|
=schematic
|
2018-03-15 21:48:24 +03:00
|
|
|
==
|
|
|
|
:: +cache-line: a record of our result of running a +build
|
|
|
|
::
|
|
|
|
:: Proof that a build has been run. Might include the result if Ford is
|
|
|
|
:: caching it. If Ford wiped the result from its cache, the result will
|
|
|
|
:: be replaced with a tombstone so Ford still knows the build has been
|
|
|
|
:: run before. Otherwise, contains the last accessed time of the result,
|
|
|
|
:: for use in cache reclamation.
|
|
|
|
::
|
|
|
|
+= cache-line
|
2018-05-01 00:57:32 +03:00
|
|
|
$% :: %value: the result of running a +build, and its last access time
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
$: %value
|
2018-03-15 21:48:24 +03:00
|
|
|
:: last-accessed: the last time this result was accessed
|
|
|
|
::
|
|
|
|
:: Updated every time this result is used in another build or
|
|
|
|
:: requested in a build request.
|
2018-03-21 21:10:54 +03:00
|
|
|
::
|
2018-03-15 21:48:24 +03:00
|
|
|
last-accessed=@da
|
2018-03-16 12:34:40 +03:00
|
|
|
:: build-result: the referentially transparent result of a +build
|
2018-03-15 21:48:24 +03:00
|
|
|
::
|
2018-03-16 12:34:40 +03:00
|
|
|
=build-result
|
2018-03-15 21:48:24 +03:00
|
|
|
==
|
|
|
|
:: %tombstone: marker that this build has been run and its result wiped
|
|
|
|
::
|
|
|
|
[%tombstone ~]
|
|
|
|
==
|
2018-03-22 04:27:25 +03:00
|
|
|
:: +listener: either a :live :duct or a once :duct
|
|
|
|
::
|
|
|
|
+= listener
|
|
|
|
$: :: duct: where to send a response
|
|
|
|
::
|
|
|
|
=duct
|
|
|
|
:: live: whether :duct had requested a live build
|
|
|
|
::
|
|
|
|
live=?
|
|
|
|
==
|
2018-04-05 03:11:21 +03:00
|
|
|
:: +scry-request: parsed arguments to a scry operation
|
|
|
|
::
|
|
|
|
+= scry-request
|
|
|
|
$: :: vane: the vane from which to make the request
|
|
|
|
::
|
|
|
|
:: TODO: use +vane here
|
|
|
|
::
|
|
|
|
vane=?(%c %g)
|
|
|
|
:: care: type of request
|
|
|
|
::
|
|
|
|
care=care:clay
|
|
|
|
:: beam: request path
|
|
|
|
::
|
|
|
|
=beam
|
|
|
|
==
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +build-receipt: result of running +make
|
|
|
|
::
|
|
|
|
:: A +build-receipt contains all information necessary to perform the
|
|
|
|
:: effects and state mutations indicated by a call to +make. If :build
|
|
|
|
:: succeeded, :result will be %build-result; otherwise, it will be %blocks.
|
|
|
|
::
|
|
|
|
:: After +make runs on a batch of builds, the resulting +build-receipt's are
|
|
|
|
:: applied one at a time.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
+= build-receipt
|
2018-04-12 03:54:32 +03:00
|
|
|
$: :: build: the build we worked on
|
|
|
|
::
|
|
|
|
=build
|
|
|
|
:: result: the outcome of this build
|
|
|
|
::
|
|
|
|
$= result
|
|
|
|
$% :: %build-result: the build produced a result
|
|
|
|
::
|
|
|
|
$: %build-result
|
|
|
|
=build-result
|
|
|
|
==
|
2018-05-01 00:57:32 +03:00
|
|
|
:: %blocks: the build blocked on the following builds or resource
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
$: %blocks
|
|
|
|
:: builds: builds that :build blocked on
|
|
|
|
::
|
|
|
|
builds=(list build)
|
2018-05-08 00:31:24 +03:00
|
|
|
:: scry-blocked: namespace request that :build blocked on
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
scry-blocked=(unit scry-request)
|
2018-04-12 03:54:32 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
:: sub-builds: subbuilds of :build
|
|
|
|
::
|
|
|
|
:: While running +make on :build, we need to keep track of any
|
|
|
|
:: sub-builds that we try to access so we can keep track of
|
|
|
|
:: component linkages and cache access times.
|
|
|
|
::
|
|
|
|
sub-builds=(list build)
|
|
|
|
==
|
2018-03-21 01:39:22 +03:00
|
|
|
:: +vane: short names for vanes
|
|
|
|
::
|
|
|
|
:: TODO: move to zuse
|
|
|
|
::
|
|
|
|
+= vane ?(%a %b %c %d %e %f %g)
|
2018-03-20 20:30:39 +03:00
|
|
|
--
|
2018-03-20 22:01:49 +03:00
|
|
|
=, format
|
2018-03-20 20:30:39 +03:00
|
|
|
|%
|
2018-05-10 23:34:25 +03:00
|
|
|
:: +tear: split a +term into segments delimited by `-`
|
|
|
|
::
|
|
|
|
++ tear
|
|
|
|
|= a=term
|
|
|
|
^- (list term)
|
|
|
|
:: sym-no-heps: a parser for terms with no heps and a leading letter
|
|
|
|
::
|
|
|
|
=/ sym-no-heps (cook crip ;~(plug low (star ;~(pose low nud))))
|
|
|
|
::
|
|
|
|
(fall (rush a (most hep sym-no-heps)) /[a])
|
|
|
|
:: +segments: TODO rename
|
|
|
|
::
|
|
|
|
++ segments
|
|
|
|
|= path-part=@tas
|
|
|
|
^- (list path)
|
|
|
|
::
|
|
|
|
=/ join |=([a=@tas b=@tas] (crip "{(trip a)}-{(trip b)}"))
|
|
|
|
::
|
|
|
|
=/ torn=(list @tas) (tear path-part)
|
|
|
|
::
|
|
|
|
|- ^- (list (list @tas))
|
|
|
|
::
|
|
|
|
?< ?=(~ torn)
|
|
|
|
::
|
|
|
|
?: ?=([@ ~] torn)
|
|
|
|
~[torn]
|
|
|
|
::
|
|
|
|
%- zing
|
|
|
|
%+ turn $(torn t.torn)
|
|
|
|
|= s=(list @tas)
|
|
|
|
^- (list (list @tas))
|
|
|
|
::
|
|
|
|
?> ?=(^ s)
|
|
|
|
~[[i.torn s] [(join i.torn i.s) t.s]]
|
2018-04-18 00:14:13 +03:00
|
|
|
:: +build-to-tape: convert :build to a printable format
|
2018-04-06 00:12:57 +03:00
|
|
|
::
|
2018-04-18 00:14:13 +03:00
|
|
|
++ build-to-tape
|
2018-04-06 00:12:57 +03:00
|
|
|
|= =build
|
2018-04-18 00:14:13 +03:00
|
|
|
^- tape
|
2018-04-06 00:12:57 +03:00
|
|
|
::
|
2018-04-18 00:14:13 +03:00
|
|
|
=/ enclose |=(tape "[{+<}]")
|
|
|
|
=/ date=@da date.build
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =schematic schematic.build
|
2018-04-06 00:12:57 +03:00
|
|
|
::
|
2018-04-18 00:14:13 +03:00
|
|
|
%- enclose
|
|
|
|
%+ welp (trip (scot %da date))
|
|
|
|
%+ welp " "
|
2018-04-06 00:12:57 +03:00
|
|
|
::
|
2018-04-18 00:14:13 +03:00
|
|
|
?+ -.schematic
|
2018-04-24 02:17:20 +03:00
|
|
|
:(welp "[" (trip -.schematic) " {<`@uvI`(mug schematic)>}]")
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
|
|
|
%$
|
|
|
|
"literal"
|
|
|
|
::
|
|
|
|
^
|
|
|
|
%- enclose
|
|
|
|
;:(welp $(build [date head.schematic]) " " $(build [date tail.schematic]))
|
|
|
|
::
|
|
|
|
%scry
|
2018-05-01 00:57:32 +03:00
|
|
|
(spud (en-beam (extract-beam resource.schematic ~)))
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
|
|
|
:: %slim
|
|
|
|
:: "slim {<subject-type.schematic>} {<formula.schematic>}"
|
2018-04-06 00:12:57 +03:00
|
|
|
==
|
2018-03-20 20:30:39 +03:00
|
|
|
:: +unify-jugs: make a new jug, unifying sets for all keys
|
|
|
|
::
|
|
|
|
++ unify-jugs
|
|
|
|
|* [a=(jug) b=(jug)]
|
|
|
|
^+ a
|
|
|
|
::
|
|
|
|
=/ tapped ~(tap by b)
|
|
|
|
::
|
|
|
|
|- ^+ a
|
|
|
|
?~ tapped a
|
|
|
|
::
|
|
|
|
=/ key p.i.tapped
|
|
|
|
=/ vals ~(tap in q.i.tapped)
|
|
|
|
::
|
|
|
|
=. a
|
|
|
|
|- ^+ a
|
|
|
|
?~ vals a
|
|
|
|
::
|
|
|
|
$(vals t.vals, a (~(put ju a) key i.vals))
|
|
|
|
::
|
|
|
|
$(tapped t.tapped)
|
2018-05-08 00:31:24 +03:00
|
|
|
:: +scry-request-to-path: encode a +scry-request in a +wire
|
2018-03-21 01:39:22 +03:00
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
++ scry-request-to-path
|
|
|
|
|= =scry-request
|
2018-04-05 03:11:21 +03:00
|
|
|
^- path
|
2018-05-08 00:31:24 +03:00
|
|
|
=/ =term (cat 3 [vane care]:scry-request)
|
|
|
|
[term (en-beam beam.scry-request)]
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +path-to-resource: decode a +resource from a +wire
|
2018-03-21 01:39:22 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
++ path-to-resource
|
2018-04-05 03:11:21 +03:00
|
|
|
|= =path
|
2018-05-01 00:57:32 +03:00
|
|
|
^- (unit resource)
|
2018-04-05 03:11:21 +03:00
|
|
|
::
|
|
|
|
=/ scry-request=(unit scry-request) (path-to-scry-request path)
|
|
|
|
?~ scry-request
|
|
|
|
~
|
|
|
|
=+ [vane care bem]=u.scry-request
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =beam bem
|
|
|
|
=/ =rail [disc=[p.beam q.beam] spur=s.beam]
|
2018-04-05 03:11:21 +03:00
|
|
|
`[vane care rail]
|
|
|
|
:: +path-to-scry-request: parse :path to a :scry-request
|
|
|
|
::
|
|
|
|
++ path-to-scry-request
|
|
|
|
|= =path
|
|
|
|
^- (unit scry-request)
|
|
|
|
::
|
|
|
|
?. ?=([@ @ *] path)
|
|
|
|
~
|
|
|
|
:: parse :path's components into :vane, :care, and :rail
|
|
|
|
::
|
|
|
|
=/ vane=(unit ?(%c %g)) ((soft ?(%c %g)) (end 3 1 i.path))
|
|
|
|
?~ vane
|
|
|
|
~
|
|
|
|
=/ care=(unit care:clay) ((soft care:clay) (rsh 3 1 i.path))
|
|
|
|
?~ care
|
|
|
|
~
|
|
|
|
=/ rest=(unit ^path) ((soft ^path) t.path)
|
|
|
|
?~ rest
|
|
|
|
~
|
|
|
|
=/ beam (de-beam u.rest)
|
|
|
|
?~ beam
|
|
|
|
~
|
|
|
|
::
|
|
|
|
`[u.vane u.care u.beam]
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +extract-beam: obtain a +beam from a +resource
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: Fills case with [%ud 0] for live resources if :date is `~`.
|
|
|
|
:: For once resources, ignore :date.
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
|
|
|
++ extract-beam
|
2018-05-01 00:57:32 +03:00
|
|
|
|= [=resource date=(unit @da)] ^- beam
|
2018-03-30 23:21:08 +03:00
|
|
|
::
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =case ?~(date [%ud 0] [%da u.date])
|
2018-03-30 23:21:08 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=, rail.resource
|
2018-03-30 23:21:08 +03:00
|
|
|
[[ship.disc desk.disc case] spur]
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +extract-disc: obtain a +disc from a +resource
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
|
|
|
++ extract-disc
|
2018-05-01 00:57:32 +03:00
|
|
|
|= =resource ^- disc
|
|
|
|
disc.rail.resource
|
2018-03-30 04:38:38 +03:00
|
|
|
:: +get-sub-schematics: find any schematics contained within :schematic
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
|
|
|
++ get-sub-schematics
|
|
|
|
|= =schematic
|
|
|
|
^- (list ^schematic)
|
|
|
|
?- -.schematic
|
|
|
|
^ ~[head.schematic tail.schematic]
|
|
|
|
%$ ~
|
|
|
|
%pin ~[schematic.schematic]
|
|
|
|
%alts choices.schematic
|
|
|
|
%bake ~
|
|
|
|
%bunt ~
|
|
|
|
%call ~[gate.schematic sample.schematic]
|
|
|
|
%cast ~[input.schematic]
|
|
|
|
%core ~
|
|
|
|
%diff ~[start.schematic end.schematic]
|
|
|
|
%dude ~[attempt.schematic]
|
|
|
|
%hood ~
|
|
|
|
%join ~[first.schematic second.schematic]
|
|
|
|
%mash ~[first.schematic second.schematic]
|
|
|
|
%mute [subject.schematic (turn mutations.schematic tail)]
|
|
|
|
%pact ~[start.schematic diff.schematic]
|
|
|
|
%path ~
|
|
|
|
%plan ~
|
|
|
|
%reef ~
|
|
|
|
%ride ~[subject.schematic]
|
2018-03-30 22:53:57 +03:00
|
|
|
%same ~[schematic.schematic]
|
2018-03-30 04:36:09 +03:00
|
|
|
%scry ~
|
|
|
|
%slim ~
|
|
|
|
%slit ~
|
|
|
|
%vale ~
|
|
|
|
%volt ~
|
|
|
|
==
|
2018-04-03 03:06:31 +03:00
|
|
|
:: +result-to-cage
|
|
|
|
::
|
|
|
|
:: Maybe we should return vases instead of cages.
|
|
|
|
::
|
|
|
|
++ result-to-cage
|
|
|
|
|= result=build-result
|
|
|
|
^- cage
|
|
|
|
?: ?=(%error -.result)
|
|
|
|
[%tang !>(message.result)]
|
|
|
|
?- -.+.result
|
|
|
|
^ [%noun (slop q:$(result head.result) q:$(result tail.result))]
|
|
|
|
%$ cage.result
|
|
|
|
%pin $(result build-result.result)
|
|
|
|
%alts $(result build-result.result)
|
|
|
|
%bake cage.result
|
|
|
|
%bunt cage.result
|
|
|
|
%call [%noun vase.result]
|
|
|
|
%cast cage.result
|
|
|
|
%core [%noun vase.result]
|
|
|
|
%diff cage.result
|
|
|
|
%dude $(result build-result.result)
|
|
|
|
%hood [%noun !>(scaffold.result)]
|
|
|
|
%join cage.result
|
|
|
|
%mash cage.result
|
|
|
|
%mute cage.result
|
|
|
|
%pact cage.result
|
|
|
|
%path [%noun !>(rail.result)]
|
|
|
|
%plan [%noun vase.result]
|
|
|
|
%reef [%noun vase.result]
|
|
|
|
%ride [%noun vase.result]
|
|
|
|
%same $(result build-result.result)
|
|
|
|
%scry cage.result
|
|
|
|
%slim [%noun !>([type nock]:result)]
|
|
|
|
%slit [%noun !>(type.result)]
|
|
|
|
%vale cage.result
|
|
|
|
%volt cage.result
|
|
|
|
==
|
2018-03-30 04:36:09 +03:00
|
|
|
:: +date-from-schematic: finds the latest pin date from this schematic tree.
|
|
|
|
::
|
|
|
|
++ date-from-schematic
|
2018-03-30 22:53:57 +03:00
|
|
|
|= =schematic
|
2018-03-30 04:36:09 +03:00
|
|
|
^- @da
|
|
|
|
=+ children=(get-sub-schematics schematic)
|
|
|
|
=/ dates (turn children date-from-schematic)
|
|
|
|
=+ children-latest=(roll dates max)
|
|
|
|
?. ?=(%pin -.schematic)
|
|
|
|
children-latest
|
|
|
|
(max date.schematic children-latest)
|
|
|
|
:: +is-schematic-live:
|
|
|
|
::
|
2018-03-30 22:53:57 +03:00
|
|
|
:: A schematic is live if it is not pinned.
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
|
|
|
++ is-schematic-live
|
2018-03-30 22:53:57 +03:00
|
|
|
|= =schematic
|
2018-03-30 04:36:09 +03:00
|
|
|
^- ?
|
2018-03-30 22:53:57 +03:00
|
|
|
!?=(%pin -.schematic)
|
2018-03-30 04:36:09 +03:00
|
|
|
:: +is-listener-live: helper function for loops
|
|
|
|
::
|
|
|
|
++ is-listener-live |=(=listener live.listener)
|
2018-04-26 23:53:16 +03:00
|
|
|
:: +by-schematic: door for manipulating :by-schematic.builds.ford-state
|
2018-03-19 22:23:43 +03:00
|
|
|
::
|
2018-03-21 21:10:54 +03:00
|
|
|
:: The :dates list for each key in :builds is sorted in reverse
|
|
|
|
:: chronological order. These operations access and mutate keys and values
|
|
|
|
:: of :builds and maintain that sort order.
|
|
|
|
::
|
2018-03-19 22:23:43 +03:00
|
|
|
++ by-schematic
|
|
|
|
|_ builds=(map schematic (list @da))
|
|
|
|
:: +put: add a +build to :builds
|
|
|
|
::
|
2018-03-21 21:10:54 +03:00
|
|
|
:: If :build already exists in :builds, this is a no-op.
|
|
|
|
:: Otherwise, replace the value at the key :schematic.build
|
|
|
|
:: with a new :dates list that contains :date.build.
|
2018-03-19 23:41:42 +03:00
|
|
|
::
|
2018-03-19 22:23:43 +03:00
|
|
|
++ put
|
|
|
|
|= =build
|
|
|
|
^+ builds
|
|
|
|
%+ ~(put by builds) schematic.build
|
|
|
|
::
|
|
|
|
=/ dates (fall (~(get by builds) schematic.build) ~)
|
2018-03-19 23:41:42 +03:00
|
|
|
?^ (find [date.build]~ dates)
|
|
|
|
dates
|
|
|
|
(sort [date.build dates] gte)
|
2018-03-19 22:23:43 +03:00
|
|
|
:: +del: remove a +build from :builds
|
|
|
|
::
|
2018-03-21 21:10:54 +03:00
|
|
|
:: Removes :build from :builds by replacing the value at
|
|
|
|
:: the key :schematic.build with a new :dates list with
|
|
|
|
:: :date.build omitted. If the resulting :dates list is
|
|
|
|
:: empty, then remove the key-value pair from :builds.
|
|
|
|
::
|
2018-03-19 22:23:43 +03:00
|
|
|
++ del
|
|
|
|
|= =build
|
|
|
|
^+ builds
|
|
|
|
=. builds %+ ~(put by builds) schematic.build
|
|
|
|
::
|
2018-03-22 04:27:25 +03:00
|
|
|
~| build+build
|
2018-03-19 22:23:43 +03:00
|
|
|
=/ dates (~(got by builds) schematic.build)
|
2018-03-19 23:41:42 +03:00
|
|
|
=/ date-index (need (find [date.build]~ dates))
|
|
|
|
(oust [date-index 1] dates)
|
2018-03-19 22:23:43 +03:00
|
|
|
:: if :builds has an empty entry for :build, delete it
|
|
|
|
::
|
|
|
|
=? builds
|
2018-03-19 23:41:42 +03:00
|
|
|
=(~ (~(got by builds) schematic.build))
|
2018-03-19 22:23:43 +03:00
|
|
|
(~(del by builds) schematic.build)
|
|
|
|
::
|
|
|
|
builds
|
2018-03-22 04:27:25 +03:00
|
|
|
:: +find-previous: find the most recent older build with :schematic.build
|
|
|
|
::
|
|
|
|
++ find-previous
|
|
|
|
|= =build
|
|
|
|
^- (unit ^build)
|
|
|
|
::
|
|
|
|
=/ dates=(list @da) (fall (~(get by builds) schematic.build) ~)
|
|
|
|
::
|
|
|
|
|- ^- (unit ^build)
|
|
|
|
?~ dates ~
|
|
|
|
::
|
|
|
|
?: (lth i.dates date.build)
|
|
|
|
`[i.dates schematic.build]
|
|
|
|
$(dates t.dates)
|
2018-03-23 05:17:00 +03:00
|
|
|
:: +find-next: find the earliest build of :schematic.build later than :build
|
|
|
|
::
|
|
|
|
++ find-next
|
|
|
|
|= =build
|
|
|
|
^- (unit ^build)
|
|
|
|
::
|
|
|
|
=/ dates=(list @da) (flop (fall (~(get by builds) schematic.build) ~))
|
|
|
|
::
|
|
|
|
|- ^- (unit ^build)
|
|
|
|
?~ dates ~
|
|
|
|
::
|
|
|
|
?: (gth i.dates date.build)
|
|
|
|
`[i.dates schematic.build]
|
|
|
|
$(dates t.dates)
|
2018-03-19 22:23:43 +03:00
|
|
|
--
|
2018-04-26 23:53:16 +03:00
|
|
|
:: +by-builds: door for manipulating :builds.state
|
|
|
|
::
|
|
|
|
++ by-builds
|
2018-04-27 02:58:03 +03:00
|
|
|
|_ builds=build-registry
|
2018-04-26 23:53:16 +03:00
|
|
|
:: +put: add a +build
|
|
|
|
::
|
|
|
|
++ put
|
|
|
|
|= =build
|
|
|
|
^+ builds
|
|
|
|
::
|
|
|
|
%_ builds
|
|
|
|
by-date
|
|
|
|
(~(put ju by-date.builds) date.build schematic.build)
|
|
|
|
::
|
|
|
|
by-schematic
|
|
|
|
(~(put by-schematic by-schematic.builds) build)
|
|
|
|
==
|
|
|
|
:: +del: remove a build
|
|
|
|
::
|
|
|
|
++ del
|
|
|
|
|= =build
|
|
|
|
^+ builds
|
|
|
|
::
|
|
|
|
%_ builds
|
|
|
|
by-date
|
|
|
|
(~(del ju by-date.builds) date.build schematic.build)
|
|
|
|
::
|
|
|
|
by-schematic
|
|
|
|
(~(del by-schematic by-schematic.builds) build)
|
|
|
|
==
|
|
|
|
--
|
2018-04-26 02:56:38 +03:00
|
|
|
:: +by-build-dag: door for manipulating a :build-dag
|
|
|
|
::
|
|
|
|
++ by-build-dag
|
|
|
|
|_ dag=build-dag
|
|
|
|
:: +get-subs: produce a list of sub-builds.
|
|
|
|
::
|
|
|
|
++ get-subs
|
|
|
|
|= =build
|
|
|
|
^- (list ^build)
|
|
|
|
=- ~(tap in (fall - ~))
|
|
|
|
(~(get by sub-builds.dag) build)
|
|
|
|
:: +get-clients: produce a list of client-builds.
|
|
|
|
::
|
|
|
|
++ get-clients
|
|
|
|
|= =build
|
|
|
|
^- (list ^build)
|
|
|
|
=- ~(tap in (fall - ~))
|
|
|
|
(~(get by client-builds.dag) build)
|
|
|
|
::
|
|
|
|
:: +put: add a linkage between a :client and a :sub +build
|
|
|
|
::
|
|
|
|
++ put
|
|
|
|
|= [client=build sub=build]
|
|
|
|
^+ dag
|
|
|
|
%_ dag
|
|
|
|
sub-builds (~(put ju sub-builds.dag) client sub)
|
|
|
|
client-builds (~(put ju client-builds.dag) sub client)
|
|
|
|
==
|
|
|
|
:: +del: delete a linkage between a :client and a :sub +build
|
|
|
|
::
|
|
|
|
++ del
|
|
|
|
|= [client=build sub=build]
|
|
|
|
^+ dag
|
|
|
|
%_ dag
|
|
|
|
sub-builds (~(del ju sub-builds.dag) client sub)
|
|
|
|
client-builds (~(del ju client-builds.dag) sub client)
|
|
|
|
==
|
|
|
|
:: +del-build: remove all linkages containing :build
|
|
|
|
::
|
|
|
|
++ del-build
|
|
|
|
|= =build
|
|
|
|
^+ dag
|
|
|
|
::
|
|
|
|
%_ dag
|
|
|
|
:: remove the mapping from :build to its sub-builds
|
|
|
|
::
|
|
|
|
sub-builds
|
|
|
|
(~(del by sub-builds.dag) build)
|
|
|
|
:: for each +build in :kids, remove :build from its clients
|
|
|
|
::
|
|
|
|
client-builds
|
|
|
|
%+ roll ~(tap in (~(get ju sub-builds.dag) build))
|
|
|
|
|= [kid=^build clients=_client-builds.dag]
|
|
|
|
(~(del ju clients) kid build)
|
|
|
|
==
|
|
|
|
--
|
2018-05-12 00:42:23 +03:00
|
|
|
:: +parse-scaffold: produces a parser for a hoon file with +crane instances
|
|
|
|
::
|
|
|
|
:: Ford parses a superset of hoon which contains additional runes to
|
|
|
|
:: represent +crane s. This parses to a +scaffold.
|
|
|
|
::
|
|
|
|
:: src-beam: +beam of the source file we're parsing
|
|
|
|
++ parse-scaffold
|
|
|
|
|= src-beam=beam
|
|
|
|
::
|
|
|
|
=/ hoon-parser (vang & (en-beam src-beam))
|
|
|
|
|^ ::
|
|
|
|
%+ cook |=(a=scaffold a)
|
|
|
|
::
|
|
|
|
%+ ifix [gay gay]
|
|
|
|
;~ plug
|
|
|
|
::
|
2018-05-12 01:31:24 +03:00
|
|
|
:: parses the zuse version, eg "/? 309"
|
2018-05-12 00:56:50 +03:00
|
|
|
;~ pose
|
|
|
|
(ifix [;~(plug fas wut gap) gap] dem)
|
|
|
|
(easy zuse)
|
|
|
|
==
|
2018-05-12 00:42:23 +03:00
|
|
|
::
|
|
|
|
:: pareses the structures, eg "/- types"
|
|
|
|
;~ pose
|
|
|
|
(ifix [;~(plug fas hep gap) gap] (most ;~(plug com gaw) cable))
|
|
|
|
(easy ~)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: parses the libraries, eg "/+ lib1, lib2"
|
|
|
|
;~ pose
|
|
|
|
(ifix [;~(plug fas lus gap) gap] (most ;~(plug com gaw) cable))
|
|
|
|
(easy ~)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: todo: the rest of the horns
|
2018-05-14 21:32:03 +03:00
|
|
|
(star ;~(sfix crane gap))
|
2018-05-12 00:42:23 +03:00
|
|
|
::
|
|
|
|
(most gap brick)
|
|
|
|
==
|
2018-05-12 01:31:24 +03:00
|
|
|
:: +beam: parses a hood path and converts it to a beam
|
|
|
|
::
|
|
|
|
++ beam
|
|
|
|
%+ sear de-beam
|
|
|
|
;~ pfix
|
|
|
|
fas
|
|
|
|
(sear plex (stag %clsg poor)):hoon-parser
|
|
|
|
==
|
2018-05-12 00:42:23 +03:00
|
|
|
:: +brick: parses a +^brick, a direct or indirect piece of hoon code
|
|
|
|
::
|
|
|
|
++ brick
|
|
|
|
;~ pose
|
2018-05-12 01:31:24 +03:00
|
|
|
(stag %indirect ;~(pfix fas fas gap beam))
|
2018-05-12 00:42:23 +03:00
|
|
|
(stag %direct tall:hoon-parser)
|
|
|
|
==
|
|
|
|
:: +cable: parses a +^cable, a reference to something on the filesystem
|
|
|
|
::
|
|
|
|
++ cable
|
|
|
|
%+ cook |=(a=^cable a)
|
|
|
|
;~ pose
|
|
|
|
(stag %& ;~(pfix tar local-or-remote-reference))
|
|
|
|
(stag %| local-or-remote-reference)
|
|
|
|
==
|
2018-05-14 21:32:03 +03:00
|
|
|
:: +crane: all runes that start with / which aren't /?, /-, /+ or //.
|
|
|
|
::
|
|
|
|
++ crane
|
|
|
|
=< apex
|
|
|
|
:: whether we allow tall form
|
|
|
|
=| allow-tall-form=?
|
|
|
|
::
|
|
|
|
|%
|
|
|
|
++ apex
|
|
|
|
%+ knee *^crane |. ~+
|
|
|
|
;~ pfix fas
|
|
|
|
;~ pose
|
|
|
|
:: `/~` hoon literal
|
|
|
|
(stag %fssg ;~(pfix sig hoon))
|
|
|
|
:: `/$` process query string
|
|
|
|
(stag %fsbc ;~(pfix buc hoon))
|
|
|
|
:: `/|` first of many options that succeeds
|
|
|
|
(stag %fsbr ;~(pfix bar parse-alts))
|
|
|
|
:: `/=` wrap a face around a crane
|
|
|
|
(stag %fsts ;~(pfix tis parse-face))
|
|
|
|
:: `/.` null terminated list
|
|
|
|
(stag %fsdt ;~(pfix dot parse-list))
|
2018-05-15 03:07:00 +03:00
|
|
|
:: `/,` switch by path
|
|
|
|
(stag %fscm ;~(pfix com parse-switch))
|
|
|
|
:: `/%` propagate extra arguments into renderers
|
|
|
|
(stag %fscn ;~(pfix cen subcrane))
|
|
|
|
:: `/&` pass through a series of mark
|
|
|
|
(stag %fspm ;~(pfix pam parse-pipe))
|
|
|
|
:: `/_` run a crane on each file in the current directory
|
|
|
|
(stag %fscb ;~(pfix cab subcrane))
|
|
|
|
:: `/;` passes date through a gate
|
|
|
|
(stag %fssm ;~(pfix sem parse-gate))
|
|
|
|
:: `/:` evaluate at path
|
|
|
|
(stag %fscl ;~(pfix col parse-at-path))
|
|
|
|
:: `/^` cast
|
|
|
|
(stag %fskt ;~(pfix ket parse-cast))
|
|
|
|
:: `/!mark/ evaluate as hoon, then pass through mark
|
|
|
|
(stag %fszp ;~(pfix zap ;~(sfix sym fas)))
|
|
|
|
:: `/mark/` passes current path through :mark
|
|
|
|
(stag %fszy ;~(sfix sym fas))
|
2018-05-14 21:32:03 +03:00
|
|
|
==
|
|
|
|
==
|
2018-05-15 03:07:00 +03:00
|
|
|
:: +parse-alts: parse a set of alternatives
|
2018-05-14 21:32:03 +03:00
|
|
|
::
|
|
|
|
++ parse-alts
|
|
|
|
%+ wide-or-tall
|
|
|
|
(ifix [pel per] (most ace subcrane))
|
|
|
|
;~(sfix (star subcrane) gap duz)
|
|
|
|
:: +parse-face: parse a face around a subcrane
|
|
|
|
::
|
|
|
|
++ parse-face
|
|
|
|
%+ wide-or-tall
|
|
|
|
;~(plug sym ;~(pfix tis subcrane))
|
|
|
|
;~(pfix gap ;~(plug sym subcrane))
|
|
|
|
:: +parse-list: parse a null terminated list of cranes
|
|
|
|
::
|
|
|
|
++ parse-list
|
|
|
|
%+ wide-or-tall
|
|
|
|
fail
|
|
|
|
;~(sfix (star subcrane) gap duz)
|
2018-05-15 03:07:00 +03:00
|
|
|
:: +parse-switch: parses a list of [path crane]
|
|
|
|
::
|
|
|
|
++ parse-switch
|
|
|
|
%+ wide-or-tall
|
|
|
|
fail
|
|
|
|
=- ;~(sfix (star -) gap duz)
|
|
|
|
;~(pfix gap fas ;~(plug static-path subcrane))
|
|
|
|
:: +parse-pipe: parses a pipe of mark conversions
|
|
|
|
::
|
|
|
|
++ parse-pipe
|
|
|
|
%+ wide-or-tall
|
|
|
|
;~(plug (plus ;~(sfix sym pam)) subcrane)
|
|
|
|
=+ (cook |=(a=term [a ~]) sym)
|
|
|
|
;~(pfix gap ;~(plug - subcrane))
|
|
|
|
:: +parse-gate: parses a gate applied to a crane
|
|
|
|
::
|
|
|
|
++ parse-gate
|
|
|
|
%+ wide-or-tall
|
|
|
|
;~(plug ;~(sfix wide:hoon-parser sem) subcrane)
|
|
|
|
;~(pfix gap ;~(plug tall:hoon-parser subcrane))
|
|
|
|
:: +parse-at-path: parses a late bound bath
|
|
|
|
::
|
|
|
|
++ parse-at-path
|
|
|
|
%+ wide-or-tall
|
|
|
|
;~(plug ;~(sfix late-bound-path col) subcrane)
|
|
|
|
;~(pfix gap ;~(plug late-bound-path subcrane))
|
|
|
|
:: +parse-cast: parses a mold and then the subcrane to apply that mold to
|
|
|
|
::
|
|
|
|
++ parse-cast
|
|
|
|
%+ wide-or-tall
|
|
|
|
;~(plug ;~(sfix wide:hoon-parser ket) subcrane)
|
|
|
|
;~(pfix gap ;~(plug tall:hoon-parser subcrane))
|
2018-05-14 21:32:03 +03:00
|
|
|
:: +crane: parses a subcrane
|
|
|
|
::
|
|
|
|
++ subcrane
|
|
|
|
%+ wide-or-tall
|
|
|
|
apex(allow-tall-form |)
|
|
|
|
;~(pfix gap apex)
|
|
|
|
:: +wide-or-tall: parses tall form hoon if :allow-tall-form is %.y
|
|
|
|
::
|
|
|
|
++ wide-or-tall
|
|
|
|
|* [wide=rule tall=rule]
|
|
|
|
?. allow-tall-form wide
|
|
|
|
;~(pose wide tall)
|
2018-05-15 03:07:00 +03:00
|
|
|
:: +hoon: parses hoon as an argument to a crane
|
2018-05-14 21:32:03 +03:00
|
|
|
::
|
|
|
|
++ hoon
|
|
|
|
%+ wide-or-tall
|
|
|
|
(ifix [sel ser] (stag %cltr (most ace wide:hoon-parser)))
|
|
|
|
;~(pfix gap tall:hoon-parser)
|
|
|
|
--
|
2018-05-12 00:42:23 +03:00
|
|
|
:: +local-or-remote-reference: the type used in +cable
|
|
|
|
::
|
|
|
|
++ local-or-remote-reference
|
|
|
|
;~ plug
|
|
|
|
sym
|
|
|
|
:: todo: ignoring :remote-location syntax for now as it is weird.
|
|
|
|
(easy ~)
|
|
|
|
==
|
2018-05-15 03:07:00 +03:00
|
|
|
:: +static-path: parses a path
|
|
|
|
::
|
|
|
|
++ static-path
|
|
|
|
(sear plex (stag %clsg (more fas hasp))):hoon-parser
|
|
|
|
:: +late-bound-path: a path whose time varies
|
|
|
|
::
|
|
|
|
++ late-bound-path
|
|
|
|
;~ pfix fas
|
|
|
|
%+ cook |=(a/truss a)
|
|
|
|
=> hoon-parser
|
|
|
|
;~ plug
|
|
|
|
(stag ~ gash)
|
|
|
|
;~(pose (stag ~ ;~(pfix cen porc)) (easy ~))
|
|
|
|
==
|
|
|
|
==
|
2018-05-12 00:42:23 +03:00
|
|
|
--
|
2018-03-21 01:39:22 +03:00
|
|
|
:: +per-event: per-event core
|
2018-03-16 03:21:46 +03:00
|
|
|
::
|
2018-03-21 01:39:22 +03:00
|
|
|
++ per-event
|
2018-03-22 04:27:25 +03:00
|
|
|
:: moves: the moves to be sent out at the end of this event, reversed
|
2018-03-16 12:34:40 +03:00
|
|
|
::
|
2018-03-22 04:27:25 +03:00
|
|
|
=| moves=(list move)
|
2018-05-01 00:57:32 +03:00
|
|
|
:: dirty-discs: discs whose resources have changed during this event
|
2018-03-22 04:27:25 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=| dirty-discs=(set disc)
|
2018-03-21 04:20:11 +03:00
|
|
|
:: scry-results: responses to scry's to handle in this event
|
|
|
|
::
|
|
|
|
:: If a value is `~`, the requested resource is not available.
|
|
|
|
:: Otherwise, the value will contain a +cage.
|
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
=| scry-results=(map scry-request (unit cage))
|
2018-03-30 04:36:09 +03:00
|
|
|
:: the +per-event gate; each event will have a different sample
|
|
|
|
::
|
|
|
|
:: Not a `|_` because of the `=/`s at the beginning.
|
|
|
|
:: Produces a core containing four public arms:
|
|
|
|
:: +start-build, +rebuild, +unblock, and +cancel.
|
|
|
|
::
|
|
|
|
|= [[our=@p =duct now=@da scry=sley] state=ford-state]
|
|
|
|
:: original-clay-subscriptions: outstanding clay subscriptions at event start
|
2018-03-16 12:34:40 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=/ original-clay-subscriptions clay-subscriptions.state
|
2018-05-01 00:57:32 +03:00
|
|
|
:: original-resources-by-disc: :resources-by-disc.state at event start
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=/ original-resources-by-disc resources-by-disc.state
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
|
|
|
|%
|
2018-03-16 12:34:40 +03:00
|
|
|
:: |entry-points: externally fired arms
|
|
|
|
::
|
|
|
|
::+| entry-points
|
|
|
|
::
|
|
|
|
:: +start-build: perform a fresh +build, either live or once
|
2018-03-16 03:21:46 +03:00
|
|
|
::
|
2018-03-16 04:38:33 +03:00
|
|
|
++ start-build
|
2018-03-30 04:36:09 +03:00
|
|
|
|= =schematic
|
2018-03-16 12:34:40 +03:00
|
|
|
^- [(list move) ford-state]
|
|
|
|
::
|
2018-03-22 04:27:25 +03:00
|
|
|
=< finalize
|
2018-03-16 04:38:33 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
|^ =+ live=(is-schematic-live schematic)
|
|
|
|
?: live
|
|
|
|
start-live-build
|
|
|
|
start-once-build
|
2018-03-16 13:44:48 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
++ start-live-build
|
|
|
|
^+ this
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =build [now schematic]
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
=. state (associate-build build duct %.y)
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
(execute-loop (sy build ~))
|
2018-03-16 13:44:48 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
++ start-once-build
|
|
|
|
^+ this
|
|
|
|
=/ pin-date=@da (date-from-schematic schematic)
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =build [pin-date schematic]
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
=. state (associate-build build duct %.n)
|
|
|
|
::
|
|
|
|
(execute-loop (sy build ~))
|
|
|
|
:: +associate-build: associate +listener with :build in :state
|
|
|
|
::
|
|
|
|
++ associate-build
|
|
|
|
|= [=build duct=^duct live=?]
|
|
|
|
^+ state
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
%_ state
|
|
|
|
listeners
|
|
|
|
(~(put ju listeners.state) build [duct live])
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
builds-by-listener
|
|
|
|
(~(put by builds-by-listener.state) duct [build live])
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
root-listeners
|
|
|
|
(~(put ju root-listeners.state) build [duct live])
|
2018-04-26 23:53:16 +03:00
|
|
|
==
|
2018-03-16 13:44:48 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
--
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +rebuild: rebuild any live builds based on +resource updates
|
2018-03-16 12:34:40 +03:00
|
|
|
::
|
2018-03-22 23:30:44 +03:00
|
|
|
++ rebuild
|
2018-05-10 21:18:52 +03:00
|
|
|
|= [ship=@p desk=@tas case=[%da p=@da] care-paths=(set [care=care:clay =path])]
|
2018-03-22 23:30:44 +03:00
|
|
|
^- [(list move) ford-state]
|
|
|
|
::
|
|
|
|
=< finalize
|
|
|
|
::
|
2018-05-10 21:18:52 +03:00
|
|
|
=/ date=@da p.case
|
2018-05-04 02:17:09 +03:00
|
|
|
::
|
2018-05-10 21:18:52 +03:00
|
|
|
=/ =disc [ship desk]
|
2018-03-30 04:36:09 +03:00
|
|
|
:: delete the now-dead clay subscription
|
2018-03-22 23:30:44 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=. clay-subscriptions.state (~(del in clay-subscriptions.state) disc)
|
2018-03-22 23:30:44 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=/ resources=(list resource)
|
2018-03-30 04:36:09 +03:00
|
|
|
%+ turn ~(tap in care-paths)
|
2018-05-01 00:57:32 +03:00
|
|
|
|= [care=care:clay =path] ^- resource
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-03-30 23:21:08 +03:00
|
|
|
[%c care rail=[disc spur=(flop path)]]
|
2018-05-01 00:57:32 +03:00
|
|
|
:: store changed resources persistently in case rebuilds finish later
|
2018-03-22 23:30:44 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=. resource-updates.state
|
|
|
|
%+ roll resources
|
|
|
|
|= [=resource resource-updates=_resource-updates.state]
|
2018-03-22 23:30:44 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
(~(put ju resource-updates) date resource)
|
|
|
|
:: rebuild resource builds at the new date
|
2018-03-22 23:30:44 +03:00
|
|
|
::
|
2018-04-18 00:14:13 +03:00
|
|
|
%- execute-loop
|
2018-04-12 03:54:32 +03:00
|
|
|
%- sy
|
2018-05-01 00:57:32 +03:00
|
|
|
%+ turn resources
|
|
|
|
|=(=resource `build`[date [%scry resource]])
|
|
|
|
:: +unblock: continue builds that had blocked on :resource
|
2018-03-21 21:10:54 +03:00
|
|
|
::
|
2018-03-21 01:39:22 +03:00
|
|
|
++ unblock
|
2018-05-08 00:31:24 +03:00
|
|
|
|= [=scry-request scry-result=(unit cage)]
|
2018-03-21 01:39:22 +03:00
|
|
|
^- [(list move) ford-state]
|
|
|
|
::
|
2018-03-22 04:27:25 +03:00
|
|
|
=< finalize
|
2018-03-21 21:10:54 +03:00
|
|
|
:: place :scry-result in :scry-results.per-event
|
|
|
|
::
|
|
|
|
:: We don't want to call the actual +scry function again,
|
|
|
|
:: because we already tried that in a previous event and it
|
|
|
|
:: had no synchronous answer. This +unblock call is a result
|
|
|
|
:: of the response to the asynchronous request we made to
|
|
|
|
:: retrieve that resource from another vane.
|
|
|
|
::
|
|
|
|
:: Instead, we'll intercept any calls to +scry by looking up
|
|
|
|
:: the arguments in :scry-results.per-event. This is ok because
|
|
|
|
:: in this function we attempt to run every +build that had
|
|
|
|
:: blocked on the resource, so the information is guaranteed
|
|
|
|
:: to be used during this event before it goes out of scope.
|
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
=. scry-results (~(put by scry-results) scry-request scry-result)
|
2018-04-12 03:54:32 +03:00
|
|
|
:: find all the :blocked-builds to continue
|
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
=/ blocked-builds (~(get ju blocks.state) scry-request)
|
2018-03-21 03:37:57 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
(execute-loop blocked-builds)
|
2018-05-01 20:55:05 +03:00
|
|
|
:: +cancel: cancel a build
|
|
|
|
::
|
|
|
|
:: When called on a live build, removes all tracking related to the live
|
|
|
|
:: build, and no more %made moves will be sent for that build.
|
|
|
|
::
|
|
|
|
:: When called on a once build, removes all tracking related to the once
|
|
|
|
:: build, and that build will never be completed or have a %made sent.
|
|
|
|
::
|
|
|
|
:: When called on a build that isn't registered in :state, such as a
|
|
|
|
:: completed once build, or a build that has already been canceled,
|
|
|
|
:: prints and no-ops.
|
2018-03-21 03:37:57 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
++ cancel ^+ [moves state]
|
|
|
|
::
|
|
|
|
=< finalize
|
|
|
|
::
|
|
|
|
=/ build-and-live (~(get by builds-by-listener.state) duct)
|
|
|
|
::
|
|
|
|
?~ build-and-live
|
|
|
|
~&(no-build-for-duct+duct this)
|
|
|
|
::
|
|
|
|
=+ [build live]=u.build-and-live
|
2018-04-24 22:57:19 +03:00
|
|
|
:: old-rebuilds and listeners don't interact well.
|
|
|
|
::
|
|
|
|
:: Have two ducts listening to the same build, causing a promotion.
|
|
|
|
:: The new build has an old build. Both ducts by :builds-by-listener
|
|
|
|
:: point to th new build. The new build has an old build and thus
|
|
|
|
:: never gets cleaned up.
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=. state (remove-listener-from-build [duct live] build)
|
|
|
|
::
|
|
|
|
(cleanup build)
|
|
|
|
:: +remove-listener-from-build: recursively remove listener from (sub)builds
|
|
|
|
::
|
|
|
|
++ remove-listener-from-build
|
|
|
|
|= [=listener =build]
|
|
|
|
^+ state
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=? state (~(has ju root-listeners.state) build listener)
|
2018-04-24 02:17:20 +03:00
|
|
|
%_ state
|
|
|
|
builds-by-listener
|
|
|
|
(~(del by builds-by-listener.state) duct.listener)
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
root-listeners
|
|
|
|
(~(del ju root-listeners.state) build listener)
|
2018-04-24 02:17:20 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
=/ original-build build
|
|
|
|
=/ builds=(list ^build) ~[build]
|
|
|
|
::
|
|
|
|
|- ^+ state
|
|
|
|
?~ builds
|
|
|
|
state
|
|
|
|
::
|
|
|
|
=. build i.builds
|
|
|
|
:: are there any clients with this listener?
|
|
|
|
::
|
|
|
|
=/ clients-with-listener=?
|
|
|
|
%+ lien
|
2018-05-01 01:15:25 +03:00
|
|
|
%~ tap in
|
2018-04-24 02:17:20 +03:00
|
|
|
=/ clients=(set ^build)
|
|
|
|
(fall (~(get by client-builds.components.state) build) ~)
|
|
|
|
%- ~(uni in clients)
|
|
|
|
(fall (~(get by client-builds.provisional-components.state) build) ~)
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
|= client=^build
|
|
|
|
(~(has ju listeners.state) client listener)
|
|
|
|
:: when there are clients, don't remove the listener from this build
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
?: clients-with-listener
|
|
|
|
$(builds t.builds)
|
|
|
|
::
|
|
|
|
=. listeners.state
|
|
|
|
(~(del ju listeners.state) build listener)
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
=/ sub-builds (~(get-subs by-build-dag components.state) build)
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
|
|
|
=/ provisional-sub-builds
|
2018-04-26 02:56:38 +03:00
|
|
|
(~(get-subs by-build-dag provisional-components.state) build)
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
|
|
|
=/ new-builds=(list ^build)
|
|
|
|
?: =(build original-build) ~
|
2018-04-26 23:53:16 +03:00
|
|
|
(drop (~(find-next by-schematic by-schematic.builds.state) build))
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
$(builds :(welp t.builds sub-builds provisional-sub-builds new-builds))
|
2018-03-16 12:34:40 +03:00
|
|
|
:: |construction: arms for performing builds
|
|
|
|
::
|
|
|
|
::+| construction
|
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
:: +execute-loop: +execute repeatedly until there's no more work to do
|
|
|
|
::
|
|
|
|
:: TODO: This implementation is for simplicity. In the longer term, we'd
|
|
|
|
:: like to just perform a single run through +execute and set a Behn timer
|
|
|
|
:: to wake us up immediately. This has the advantage that Ford stops hard
|
|
|
|
:: blocking the main Urbit event loop, letting other work be done.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
++ execute-loop
|
|
|
|
|= builds=(set build)
|
|
|
|
^+ ..execute
|
|
|
|
::
|
|
|
|
=. ..execute (execute builds)
|
|
|
|
::
|
2018-04-18 00:14:13 +03:00
|
|
|
?: ?& ?=(~ next-builds.state)
|
|
|
|
?=(~ candidate-builds.state)
|
|
|
|
==
|
2018-04-12 03:54:32 +03:00
|
|
|
..execute
|
|
|
|
::
|
|
|
|
$(builds ~)
|
2018-03-21 21:10:54 +03:00
|
|
|
:: +execute: main recursive construction algorithm
|
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
:: Performs the three step build process: First, figure out which builds
|
|
|
|
:: we're going to run this loop through the ford algorithm. Second, run
|
2018-05-01 00:57:32 +03:00
|
|
|
:: the gathered builds, possibly in parallel. Third, apply the +build-receipt
|
2018-04-26 02:56:38 +03:00
|
|
|
:: algorithms to the ford state.
|
2018-03-21 21:10:54 +03:00
|
|
|
::
|
2018-03-16 04:38:33 +03:00
|
|
|
++ execute
|
2018-04-12 03:54:32 +03:00
|
|
|
|= builds=(set build)
|
|
|
|
^+ ..execute
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
|^ ^+ ..execute
|
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
=. ..execute (gather builds)
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=^ build-receipts ..execute run-builds
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
(reduce build-receipts)
|
2018-04-26 23:53:16 +03:00
|
|
|
:: +gather: collect builds to be run in a batch
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
:: The +gather phase is the first of the three parts of +execute. In
|
|
|
|
:: +gather, we look through each item in :candidate-builds.state. If we
|
|
|
|
:: should run the candidate build this cycle through the +execute loop,
|
|
|
|
:: we place it in :next-builds.state. +gather runs until it has no more
|
|
|
|
:: candidates.
|
2018-03-23 08:25:53 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
++ gather
|
|
|
|
|= builds=(set build)
|
2018-04-24 02:17:20 +03:00
|
|
|
^+ ..execute
|
2018-04-26 23:53:16 +03:00
|
|
|
:: add builds that were triggered by incoming event to the candidate list
|
2018-03-16 13:44:48 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
=. candidate-builds.state
|
|
|
|
(weld candidate-builds.state ~(tap in builds))
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
|^ ::
|
|
|
|
?~ candidate-builds.state
|
|
|
|
..execute
|
|
|
|
::
|
|
|
|
=/ next i.candidate-builds.state
|
|
|
|
=> .(candidate-builds.state t.candidate-builds.state)
|
|
|
|
::
|
|
|
|
$(..execute (gather-build next))
|
|
|
|
:: +gather-build: looks at a single candidate build
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
:: This gate inspects a single build. It might move it to :next-builds,
|
2018-05-08 01:04:54 +03:00
|
|
|
:: or promote it using an old build. It also might add this build's
|
2018-04-26 23:53:16 +03:00
|
|
|
:: sub-builds to :candidate-builds.
|
2018-03-22 04:27:25 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
++ gather-build
|
|
|
|
|= =build
|
|
|
|
^+ ..execute
|
|
|
|
:: if we already have a result for this build, don't rerun the build
|
|
|
|
::
|
|
|
|
=^ current-result results.state (access-cache build)
|
2018-05-01 00:57:32 +03:00
|
|
|
?: ?=([~ %value *] current-result)
|
2018-04-26 23:53:16 +03:00
|
|
|
..execute
|
|
|
|
:: place :build in :builds.state if it isn't already there
|
|
|
|
::
|
|
|
|
=. builds.state (~(put by-builds builds.state) build)
|
|
|
|
:: old-build: most recent previous build with :schematic.build
|
|
|
|
::
|
|
|
|
=/ old-build=(unit ^build)
|
|
|
|
(~(find-previous by-schematic by-schematic.builds.state) build)
|
|
|
|
:: if no previous builds exist, we need to run :build
|
|
|
|
::
|
|
|
|
?~ old-build
|
|
|
|
(add-build-to-next build)
|
|
|
|
:: copy :old-build's live listeners
|
|
|
|
::
|
|
|
|
=. state (copy-old-live-listeners u.old-build build)
|
2018-05-01 00:57:32 +03:00
|
|
|
:: if any resources have changed, we need to rebuild :build
|
2018-04-26 23:53:16 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
?: (resources-changed build)
|
2018-04-26 23:53:16 +03:00
|
|
|
(add-build-to-next build)
|
|
|
|
:: if we don't have :u.old-build's result cached, we need to run :build
|
|
|
|
::
|
|
|
|
=^ old-cache-line results.state (access-cache u.old-build)
|
|
|
|
?~ old-cache-line
|
|
|
|
(add-build-to-next build)
|
|
|
|
:: if :u.old-build's result has been wiped, we need to run :build
|
|
|
|
::
|
|
|
|
?: ?=(%tombstone -.u.old-cache-line)
|
|
|
|
(add-build-to-next build)
|
|
|
|
:: if any ancestors are pinned, we must rerun
|
|
|
|
::
|
|
|
|
:: We can't cleanly promote a once build to a live build because we
|
2018-05-01 00:57:32 +03:00
|
|
|
:: didn't register its resources in the live tracking system.
|
2018-04-26 23:53:16 +03:00
|
|
|
::
|
|
|
|
?: (has-pinned-client u.old-build)
|
|
|
|
(add-build-to-next build)
|
|
|
|
:: old-subs: sub-builds of :u.old-build
|
|
|
|
::
|
|
|
|
=/ old-subs (~(get-subs by-build-dag components.state) u.old-build)
|
|
|
|
::
|
|
|
|
=/ new-subs (turn old-subs |=(^build +<(date date.build)))
|
|
|
|
:: if all subs are in old.rebuilds.state, promote ourselves
|
|
|
|
::
|
|
|
|
?: (levy new-subs ~(has by old.rebuilds.state))
|
|
|
|
(on-all-subs-are-rebuilds u.old-build build new-subs)
|
|
|
|
::
|
|
|
|
=. state (record-sub-builds-as-provisional build new-subs)
|
|
|
|
:: all new-subs have results, some are not rebuilds
|
|
|
|
::
|
|
|
|
:: We rerun :build because these non-rebuild results might be different,
|
|
|
|
:: possibly giving :build a different result.
|
|
|
|
::
|
|
|
|
=/ uncached-new-subs (skip new-subs is-build-cached)
|
|
|
|
?~ uncached-new-subs
|
|
|
|
(add-build-to-next build)
|
|
|
|
:: otherwise, not all new subs have results and we shouldn't be run
|
|
|
|
::
|
|
|
|
(on-not-all-subs-have-results build uncached-new-subs)
|
|
|
|
:: +add-build-to-next: run this build during the +make phase
|
2018-04-25 00:44:41 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
++ add-build-to-next
|
|
|
|
|= =build
|
2018-04-25 00:44:41 +03:00
|
|
|
..execute(next-builds.state (~(put in next-builds.state) build))
|
2018-04-26 23:53:16 +03:00
|
|
|
:: +on-all-subs-are-rebuilds: promote when all sub-builds are rebuilds
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
:: When all subs are rebuilds, we promote :old and add builds
|
|
|
|
:: unblocked by this promotion to our :candidate-builds.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
++ on-all-subs-are-rebuilds
|
|
|
|
|= [old=build new=build new-subs=(list build)]
|
|
|
|
^+ ..execute
|
2018-04-24 02:17:20 +03:00
|
|
|
:: link all :new-subs to :build in :components.state
|
|
|
|
::
|
|
|
|
=. state
|
|
|
|
%+ roll new-subs
|
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
|= [new-sub=build state=_state]
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
state(components (~(put by-build-dag components.state) new new-sub))
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
=^ wiped-rebuild ..execute (promote-build old date.new)
|
2018-04-18 00:14:13 +03:00
|
|
|
=? next-builds.state
|
|
|
|
?=(^ wiped-rebuild)
|
|
|
|
(~(put in next-builds.state) u.wiped-rebuild)
|
2018-03-23 05:17:00 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
=^ unblocked-clients state (mark-as-done new)
|
2018-04-18 00:14:13 +03:00
|
|
|
=. candidate-builds.state
|
|
|
|
(welp unblocked-clients candidate-builds.state)
|
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
..execute
|
2018-04-26 23:53:16 +03:00
|
|
|
:: +on-not-all-subs-have-results: this build can't be run at this time
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
:: When all our sub builds don't have results, we can't add :build to
|
|
|
|
:: :next-builds.state. Instead, put all the remaining uncached new
|
|
|
|
:: subs into :candidate-builds.state.
|
2018-04-25 00:44:41 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
:: If all of our sub-builds finish immediately (i.e. promoted) when
|
|
|
|
:: they pass through +gather-internal, they will add :build back to
|
|
|
|
:: :candidate-builds.state and we will run again before +execute runs
|
|
|
|
:: +make.
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
++ on-not-all-subs-have-results
|
|
|
|
|= [=build uncached-new-subs=(list build)]
|
|
|
|
^+ ..execute
|
|
|
|
::
|
|
|
|
=. blocked-builds.state
|
|
|
|
%+ roll uncached-new-subs
|
|
|
|
|= [new-sub=^build blocked-builds=_blocked-builds.state]
|
|
|
|
::
|
|
|
|
(~(put by-build-dag blocked-builds) build new-sub)
|
|
|
|
::
|
|
|
|
%_ ..execute
|
|
|
|
candidate-builds.state
|
|
|
|
:(welp uncached-new-subs candidate-builds.state)
|
|
|
|
==
|
|
|
|
:: +copy-old-live-listeners: copies each live listener from :old to :new
|
2018-04-26 02:56:38 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
++ copy-old-live-listeners
|
|
|
|
|= [old=build new=build]
|
|
|
|
^+ state
|
|
|
|
::
|
|
|
|
=/ old-live-listeners=(list listener)
|
|
|
|
=- (skim - is-listener-live)
|
|
|
|
=- ~(tap in `(set listener)`(fall - ~))
|
|
|
|
(~(get by listeners.state) old)
|
|
|
|
::
|
|
|
|
%+ roll old-live-listeners
|
|
|
|
|= [=listener state=_state]
|
|
|
|
::
|
|
|
|
state(listeners (~(put ju listeners.state) new listener))
|
|
|
|
:: +record-sub-builds-as-provisional:
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
:: When we can't directly promote ourselves, we're going to rerun
|
|
|
|
:: our build. It's possible that the sub-builds are different, in
|
|
|
|
:: which case we'll need to clean up the current sub-build dependency.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
++ record-sub-builds-as-provisional
|
|
|
|
|= [=build new-subs=(list build)]
|
|
|
|
^+ state
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
%_ state
|
|
|
|
provisional-components
|
|
|
|
%+ roll new-subs
|
|
|
|
|= [new-sub=^build provisional-components=_provisional-components.state]
|
|
|
|
::
|
|
|
|
(~(put by-build-dag provisional-components) build new-sub)
|
|
|
|
==
|
|
|
|
--
|
2018-04-12 03:54:32 +03:00
|
|
|
:: +promote-build: promote result of :build to newer :date
|
|
|
|
::
|
2018-04-28 01:32:06 +03:00
|
|
|
:: Also performs relevant accounting, and possibly sends %made moves.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
++ promote-build
|
|
|
|
|= [old-build=build date=@da]
|
|
|
|
^- [(unit build) _..execute]
|
2018-04-28 01:32:06 +03:00
|
|
|
:: grab the previous result, freshening the cache
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
=^ old-cache-line results.state (access-cache old-build)
|
2018-04-28 01:32:06 +03:00
|
|
|
:: we can only promote a cached result, not missing or a %tombstone
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
?> ?=([~ %value *] old-cache-line)
|
2018-04-28 01:32:06 +03:00
|
|
|
:: :new-build is :old-build at :date; promotion destination
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-28 01:32:06 +03:00
|
|
|
=/ new-build=build old-build(date date)
|
|
|
|
:: copy the old result to :new-build
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
=. results.state (~(put by results.state) new-build u.old-cache-line)
|
2018-04-28 01:32:06 +03:00
|
|
|
:: link :old-build and :new-build persistently
|
|
|
|
::
|
|
|
|
:: We store identical rebuilds persistently so that we know we don't
|
|
|
|
:: have to promote or rerun clients of the new rebuild.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
=. rebuilds.state (link-rebuilds old-build new-build)
|
2018-04-28 01:32:06 +03:00
|
|
|
:: if this is the newest %scry on :disc, update :latest-by-disc.state
|
|
|
|
::
|
|
|
|
:: :latest-by-disc.state is used to create Clay subscriptions. This
|
|
|
|
:: promoted build may now be the latest time for this :disc.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
=? latest-by-disc.state
|
|
|
|
?& ?=(%scry -.schematic.old-build)
|
2018-05-01 00:57:32 +03:00
|
|
|
=/ disc (extract-disc resource.schematic.old-build)
|
2018-04-28 01:32:06 +03:00
|
|
|
~| [disc+disc latest-by-disc+latest-by-disc.state]
|
2018-04-24 02:17:20 +03:00
|
|
|
(gth date (~(got by latest-by-disc.state) disc))
|
|
|
|
==
|
2018-05-01 00:57:32 +03:00
|
|
|
=/ disc (extract-disc resource.schematic.old-build)
|
2018-04-24 02:17:20 +03:00
|
|
|
(~(put by latest-by-disc.state) disc date)
|
2018-04-28 01:32:06 +03:00
|
|
|
:: sanity check that +promote-build was called on a registered build
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
?> (~(has ju by-date.builds.state) date.new-build schematic.new-build)
|
2018-04-28 01:32:06 +03:00
|
|
|
:: mirror linkages between :old-build and subs to :new-build and subs
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
|
|
|
=. components.state
|
2018-04-26 02:56:38 +03:00
|
|
|
%+ roll (~(get-subs by-build-dag components.state) old-build)
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
|
|
|
|= [old-sub=build components=_components.state]
|
|
|
|
::
|
|
|
|
=/ new-sub=build old-sub(date date)
|
2018-04-26 02:56:38 +03:00
|
|
|
(~(put by-build-dag components) new-build new-sub)
|
2018-04-24 02:17:20 +03:00
|
|
|
:: promoted builds are no longer provisional
|
|
|
|
::
|
|
|
|
=. provisional-components.state
|
2018-04-26 02:56:38 +03:00
|
|
|
%+ roll (~(get-subs by-build-dag provisional-components.state) new-build)
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
|
|
|
|= [old-sub=build provisional-components=_provisional-components.state]
|
|
|
|
::
|
|
|
|
=/ new-sub=build old-sub(date date)
|
2018-04-26 02:56:38 +03:00
|
|
|
(~(del by-build-dag provisional-components) new-build new-sub)
|
2018-04-28 01:32:06 +03:00
|
|
|
:: send %made moves for the previously established live listeners
|
|
|
|
::
|
|
|
|
:: We only want to send %made moves for live listeners which were
|
|
|
|
:: already on :new-build. We don't want to send %made moves for
|
|
|
|
:: listeners that we copy from :old-build because :new-build has the
|
|
|
|
:: same result as :old-build; therefore, we would be sending a
|
|
|
|
:: duplicate %made.
|
2018-04-24 22:57:19 +03:00
|
|
|
::
|
|
|
|
=. ..execute (send-mades new-build (root-live-listeners new-build))
|
2018-04-28 01:32:06 +03:00
|
|
|
:: move live listeners from :old-build to :new-build
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
2018-04-28 01:32:06 +03:00
|
|
|
:: When we promote a build, we advance the live listeners from
|
|
|
|
:: :old-build to :new-build. Live listeners should be attached to the
|
|
|
|
:: most recent completed build for a given schematic.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-28 01:32:06 +03:00
|
|
|
=. state (advance-live-listeners old-build new-build)
|
|
|
|
:: send %made moves for once listeners and delete them
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-28 01:32:06 +03:00
|
|
|
:: If we have once listeners, we can send %made moves for them and
|
|
|
|
:: then no longer track them.
|
|
|
|
::
|
|
|
|
=. ..execute (send-mades new-build (root-once-listeners new-build))
|
2018-04-12 03:54:32 +03:00
|
|
|
=. state (delete-root-once-listeners new-build)
|
2018-04-28 01:32:06 +03:00
|
|
|
:: send %made moves for future builds
|
|
|
|
::
|
|
|
|
:: We may have future results queued, waiting on this build to send a
|
|
|
|
:: %made. Now that we've sent current %made moves, we can send future
|
|
|
|
:: ones, as we need to send these in chronological order by formal
|
|
|
|
:: date.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-28 01:32:06 +03:00
|
|
|
=^ wiped-rebuild ..execute (send-future-mades new-build)
|
|
|
|
:: :old-build might no longer be tracked by anything
|
2018-04-24 22:57:19 +03:00
|
|
|
::
|
|
|
|
=. ..execute (cleanup old-build)
|
|
|
|
::
|
2018-04-28 01:32:06 +03:00
|
|
|
[wiped-rebuild ..execute]
|
2018-04-12 03:54:32 +03:00
|
|
|
:: +send-future-mades: send %made moves for future rebuilds
|
|
|
|
::
|
|
|
|
:: If a future rebuild has been wiped, then produce it along with
|
|
|
|
:: a modified `..execute` core.
|
|
|
|
::
|
|
|
|
++ send-future-mades
|
|
|
|
|= =build
|
|
|
|
^- [(unit ^build) _..execute]
|
|
|
|
::
|
|
|
|
=^ result results.state (access-cache build)
|
2018-03-23 05:17:00 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
=/ next (~(find-next by-schematic by-schematic.builds.state) build)
|
2018-03-31 02:55:43 +03:00
|
|
|
?~ next
|
|
|
|
:: no future build
|
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
[~ ..execute]
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
|
|
|
=^ next-result results.state (access-cache u.next)
|
|
|
|
?~ next-result
|
|
|
|
:: unfinished future build
|
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
[~ ..execute]
|
|
|
|
:: if :next's result hasn't been wiped
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
?: ?& ?=(%value -.u.next-result)
|
2018-04-25 00:44:41 +03:00
|
|
|
!(has-pinned-client u.next)
|
|
|
|
==
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
2018-04-28 01:32:06 +03:00
|
|
|
=. state (advance-live-listeners build u.next)
|
2018-04-12 03:54:32 +03:00
|
|
|
=. ..execute (cleanup build)
|
|
|
|
:: if the result has changed, send %made moves for live listeners
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
=? ..execute
|
2018-05-01 00:57:32 +03:00
|
|
|
?& ?=([~ %value *] result)
|
2018-04-12 03:54:32 +03:00
|
|
|
!=(build-result.u.result build-result.u.next-result)
|
|
|
|
==
|
|
|
|
(send-mades u.next (root-live-listeners u.next))
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
|
|
|
$(build u.next)
|
2018-04-12 03:54:32 +03:00
|
|
|
:: if :next has been wiped, produce it
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
[`u.next ..execute]
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +run-builds: run the builds and produce +build-receipts
|
2018-04-26 23:53:16 +03:00
|
|
|
::
|
|
|
|
:: Runs the builds and cleans up the build lists afterwards.
|
|
|
|
::
|
|
|
|
:: TODO: When the vere interpreter has a parallel variant of +turn, use
|
|
|
|
:: that as each build might take a while and there are no data
|
|
|
|
:: dependencies between builds here.
|
|
|
|
::
|
|
|
|
++ run-builds
|
2018-05-01 00:57:32 +03:00
|
|
|
^- [(list build-receipt) _..execute]
|
2018-04-26 23:53:16 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=/ build-receipts=(list build-receipt)
|
2018-04-26 23:53:16 +03:00
|
|
|
(turn ~(tap in next-builds.state) make)
|
|
|
|
::
|
|
|
|
=. next-builds.state ~
|
2018-05-01 00:57:32 +03:00
|
|
|
[build-receipts ..execute]
|
|
|
|
:: reduce: apply +build-receipts produce from the +make phase.
|
2018-04-26 02:56:38 +03:00
|
|
|
::
|
|
|
|
:: +gather produces builds to run make on. +make produces
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +build-receipts. It is in +reduce where we take these +build-receipts and
|
2018-04-26 02:56:38 +03:00
|
|
|
:: apply them to ..execute.
|
2018-03-23 08:25:53 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
++ reduce
|
2018-05-01 00:57:32 +03:00
|
|
|
|= build-receipts=(list build-receipt)
|
2018-04-12 03:54:32 +03:00
|
|
|
^+ ..execute
|
2018-05-16 00:44:48 +03:00
|
|
|
:: sort :build-receipts so blocks are processed before completions
|
|
|
|
::
|
|
|
|
:: It's possible for a build to block on a sub-build that was run
|
|
|
|
:: in the same batch. If that's the case, make sure we register
|
|
|
|
:: that the build blocked on the sub-build before registering the
|
|
|
|
:: completion of the sub-build. This way, when we do register the
|
|
|
|
:: completion of the sub-build, we will know which builds are blocked
|
|
|
|
:: on the sub-build, so we can enqueue those blocked clients to be
|
|
|
|
:: rerun.
|
|
|
|
::
|
|
|
|
=. build-receipts
|
|
|
|
%+ sort build-receipts
|
|
|
|
|= [a=build-receipt b=build-receipt]
|
|
|
|
^- ?
|
|
|
|
?=(%blocks -.result.a)
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
|^ ^+ ..execute
|
2018-05-01 00:57:32 +03:00
|
|
|
?~ build-receipts ..execute
|
2018-04-26 02:56:38 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=. ..execute (apply-build-receipt i.build-receipts)
|
|
|
|
$(build-receipts t.build-receipts)
|
|
|
|
:: +apply-build-receipt: applies a single state diff to ..execute
|
2018-03-23 05:17:00 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
++ apply-build-receipt
|
|
|
|
|= made=build-receipt
|
|
|
|
:: update live resource tracking if the build is a live %scry
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
=? ..execute
|
|
|
|
?& ?=(%scry -.schematic.build.made)
|
|
|
|
(is-build-live build.made)
|
|
|
|
==
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
(do-live-scry-accounting build.made resource.schematic.build.made)
|
2018-04-26 02:56:38 +03:00
|
|
|
:: process :sub-builds.made
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-27 02:58:03 +03:00
|
|
|
=. state (track-sub-builds build.made sub-builds.made)
|
2018-04-26 02:56:38 +03:00
|
|
|
::
|
|
|
|
?- -.result.made
|
|
|
|
%build-result
|
|
|
|
(apply-build-result made)
|
|
|
|
::
|
|
|
|
%blocks
|
|
|
|
(apply-blocks build.made result.made sub-builds.made)
|
2018-04-12 03:54:32 +03:00
|
|
|
==
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +do-live-scry-accounting: updates tracking for a live %scry build
|
2018-04-27 02:58:03 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
++ do-live-scry-accounting
|
|
|
|
|= [=build =resource]
|
2018-04-27 02:58:03 +03:00
|
|
|
^+ ..execute
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =disc (extract-disc resource)
|
2018-04-27 02:58:03 +03:00
|
|
|
::
|
|
|
|
%_ ..execute
|
2018-05-01 00:57:32 +03:00
|
|
|
:: link :disc to :resource
|
2018-04-27 02:58:03 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
resources-by-disc.state
|
|
|
|
(~(put ju resources-by-disc.state) [disc resource])
|
2018-04-27 02:58:03 +03:00
|
|
|
:: mark :disc as dirty
|
|
|
|
::
|
|
|
|
dirty-discs
|
|
|
|
(~(put in dirty-discs) disc)
|
|
|
|
:: update :latest-by-disc.state if :date.build is later
|
|
|
|
::
|
|
|
|
latest-by-disc.state
|
|
|
|
=/ latest-date (~(get by latest-by-disc.state) disc)
|
|
|
|
::
|
|
|
|
?: ?& ?=(^ latest-date)
|
|
|
|
(lte date.build u.latest-date)
|
|
|
|
==
|
|
|
|
latest-by-disc.state
|
|
|
|
::
|
|
|
|
(~(put by latest-by-disc.state) disc date.build)
|
|
|
|
==
|
|
|
|
:: +track-sub-builds:
|
|
|
|
::
|
|
|
|
:: For every sub-build discovered while running :build, we have to make
|
|
|
|
:: sure that we track that sub-build and that it is associated with the
|
|
|
|
:: right listeners.
|
|
|
|
::
|
|
|
|
++ track-sub-builds
|
|
|
|
|= [=build sub-builds=(list build)]
|
|
|
|
^+ state
|
|
|
|
%+ roll sub-builds
|
|
|
|
|= [sub-build=^build accumulator=_state]
|
|
|
|
=. state accumulator
|
|
|
|
:: freshen cache for sub-build
|
|
|
|
::
|
|
|
|
=. results.state +:(access-cache sub-build)
|
|
|
|
::
|
|
|
|
%_ state
|
|
|
|
builds
|
|
|
|
(~(put by-builds builds.state) sub-build)
|
|
|
|
::
|
|
|
|
components
|
|
|
|
(~(put by-build-dag components.state) build sub-build)
|
|
|
|
::
|
|
|
|
listeners
|
|
|
|
::
|
|
|
|
=/ unified-listeners
|
|
|
|
%- ~(uni in (fall (~(get by listeners.state) sub-build) ~))
|
|
|
|
(fall (~(get by listeners.state) build) ~)
|
|
|
|
:: don't put a key with an empty value
|
|
|
|
::
|
|
|
|
?~ unified-listeners
|
|
|
|
listeners.state
|
|
|
|
::
|
|
|
|
(~(put by listeners.state) sub-build unified-listeners)
|
|
|
|
==
|
2018-04-28 00:09:18 +03:00
|
|
|
::
|
|
|
|
:: +| apply-build-result
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +apply-build-result: apply a %build-result +build-receipt to ..execute
|
2018-04-26 02:56:38 +03:00
|
|
|
::
|
|
|
|
:: Our build produced an actual result.
|
2018-03-23 08:25:53 +03:00
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
++ apply-build-result
|
|
|
|
|= $: =build
|
|
|
|
$: %build-result
|
|
|
|
=build-result
|
|
|
|
==
|
|
|
|
sub-builds=(list build)
|
|
|
|
==
|
|
|
|
^+ ..execute
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
?> (~(has ju by-date.builds.state) date.build schematic.build)
|
2018-04-26 02:56:38 +03:00
|
|
|
:: record the result returned from the build
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
=. results.state
|
2018-04-26 02:56:38 +03:00
|
|
|
%+ ~(put by results.state) build
|
2018-05-01 00:57:32 +03:00
|
|
|
[%value last-accessed=now build-result]
|
2018-04-26 02:56:38 +03:00
|
|
|
:: queue clients we can run now that we have this build result
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
=^ unblocked-clients state (mark-as-done build)
|
2018-04-18 00:14:13 +03:00
|
|
|
=. next-builds.state (~(gas in next-builds.state) unblocked-clients)
|
2018-04-28 00:09:18 +03:00
|
|
|
:: :previous-build: last build of :schematic.build before :build if any
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
=/ previous-build
|
2018-04-26 23:53:16 +03:00
|
|
|
(~(find-previous by-schematic by-schematic.builds.state) build)
|
2018-04-28 00:09:18 +03:00
|
|
|
:: :previous-result: result of :previous-build if any
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
=^ previous-result results.state
|
|
|
|
?~ previous-build
|
|
|
|
[~ results.state]
|
|
|
|
(access-cache u.previous-build)
|
2018-04-28 00:09:18 +03:00
|
|
|
:: promote live listeners if we can
|
|
|
|
::
|
|
|
|
:: When we have a :previous-build with a :previous-result, and the
|
|
|
|
:: previous-build isn't a descendant of a %pin schematic, we need to
|
2018-04-28 01:32:06 +03:00
|
|
|
:: advance live listeners because this is now the most recent build.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-25 00:44:41 +03:00
|
|
|
=? state
|
|
|
|
?& ?=(^ previous-build)
|
|
|
|
?=(^ previous-result)
|
2018-04-28 00:09:18 +03:00
|
|
|
:: TODO: double check on the tests for this. it seems wrong,
|
|
|
|
:: as a build could have an unpinned client and a pinned
|
|
|
|
:: client
|
2018-04-25 00:44:41 +03:00
|
|
|
!(has-pinned-client u.previous-build)
|
|
|
|
==
|
2018-04-28 01:32:06 +03:00
|
|
|
(advance-live-listeners u.previous-build build)
|
2018-04-28 00:09:18 +03:00
|
|
|
:: send results to once listeners and delete them
|
|
|
|
::
|
|
|
|
:: Once listeners are deleted as soon as their %made has been sent
|
|
|
|
:: because they don't maintain a subscription to the build.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
=. ..execute (send-mades build (root-once-listeners build))
|
|
|
|
=. state (delete-root-once-listeners build)
|
2018-04-28 00:09:18 +03:00
|
|
|
:: does :build have the same result as :u.previous-build?
|
|
|
|
::
|
|
|
|
:: We consider a result the same if we have a :previous-build which
|
2018-05-01 00:57:32 +03:00
|
|
|
:: has a real %value, the current :build-result is the same, and
|
2018-04-28 00:09:18 +03:00
|
|
|
:: the :previous-build doesn't have a pinned client. We can't
|
|
|
|
:: promote pinned builds, so we always consider the result to be
|
|
|
|
:: different.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
=/ same-result=?
|
2018-04-25 00:44:41 +03:00
|
|
|
?& ?=(^ previous-build)
|
|
|
|
!(has-pinned-client u.previous-build)
|
2018-05-01 00:57:32 +03:00
|
|
|
?=([~ %value *] previous-result)
|
2018-04-26 02:56:38 +03:00
|
|
|
=(build-result build-result.u.previous-result)
|
2018-04-12 03:54:32 +03:00
|
|
|
==
|
2018-04-28 00:09:18 +03:00
|
|
|
:: if we have the same result, link the rebuilds
|
|
|
|
::
|
|
|
|
:: We store identical rebuilds persistently so that we know we don't
|
|
|
|
:: have to promote or rerun clients of the new rebuild.
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
=? rebuilds.state
|
|
|
|
same-result
|
|
|
|
::
|
|
|
|
?> ?=(^ previous-build)
|
2018-04-26 02:56:38 +03:00
|
|
|
(link-rebuilds u.previous-build build)
|
2018-04-28 00:09:18 +03:00
|
|
|
:: if the result has changed, inform all live listeners
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
=? ..execute
|
|
|
|
!same-result
|
2018-04-26 02:56:38 +03:00
|
|
|
(send-mades build (root-live-listeners build))
|
2018-04-28 00:09:18 +03:00
|
|
|
:: if the result has changed, rerun all old clients
|
|
|
|
::
|
|
|
|
:: When we have a previous result which isn't the same, we need to
|
|
|
|
:: rerun old clients at the current time. Since those clients have
|
|
|
|
:: sub-builds with new results, the results of clients might also be
|
|
|
|
:: different.
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
|
|
|
=? state
|
|
|
|
&(!same-result ?=(^ previous-build))
|
2018-04-28 00:09:18 +03:00
|
|
|
(enqueue-client-rebuilds build u.previous-build)
|
|
|
|
:: clean up provisional builds
|
|
|
|
::
|
|
|
|
=. state (unlink-used-provisional-builds build sub-builds)
|
|
|
|
=. ..execute (cleanup-orphaned-provisional-builds build)
|
|
|
|
:: if we had a previous build, clean it up
|
|
|
|
::
|
|
|
|
=? ..execute
|
|
|
|
?=(^ previous-build)
|
|
|
|
(cleanup u.previous-build)
|
|
|
|
:: clean up our current build
|
|
|
|
::
|
2018-04-28 01:32:06 +03:00
|
|
|
:: If :build was a once build, now that we've sent its %made moves, we
|
2018-04-28 00:09:18 +03:00
|
|
|
:: can delete it.
|
|
|
|
::
|
|
|
|
=. ..execute (cleanup build)
|
|
|
|
:: now that we've handled :build, check any future builds
|
|
|
|
::
|
|
|
|
:: We may have future results queued, waiting on this build to send
|
2018-04-28 01:32:06 +03:00
|
|
|
:: a %made. Now that we've sent current %made moves, we can send
|
|
|
|
:: future ones, as we need to send these in chronological order by
|
|
|
|
:: formal date.
|
2018-04-28 00:09:18 +03:00
|
|
|
::
|
|
|
|
=^ wiped-rebuild ..execute (send-future-mades build)
|
|
|
|
?~ wiped-rebuild
|
|
|
|
..execute
|
|
|
|
:: if a future-build's result was wiped from the cache, rebuild it.
|
|
|
|
::
|
|
|
|
=. next-builds.state (~(put in next-builds.state) u.wiped-rebuild)
|
|
|
|
::
|
|
|
|
..execute
|
|
|
|
:: +enqueue-client-rebuilds: rerun old clients, updated to current time
|
|
|
|
::
|
|
|
|
++ enqueue-client-rebuilds
|
|
|
|
|= [=build previous-build=build]
|
|
|
|
^+ state
|
|
|
|
::
|
|
|
|
=/ clients-to-rebuild=(list ^build)
|
|
|
|
%+ turn
|
|
|
|
%+ weld
|
|
|
|
(~(get-clients by-build-dag components.state) previous-build)
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
=/ older-build (~(get by old.rebuilds.state) previous-build)
|
|
|
|
?~ older-build
|
|
|
|
~
|
|
|
|
::
|
|
|
|
(~(get-clients by-build-dag components.state) u.older-build)
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
|= old-client=^build
|
|
|
|
old-client(date date.build)
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
%+ roll clients-to-rebuild
|
|
|
|
|= [client=^build state=_state]
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
%_ state
|
|
|
|
::
|
|
|
|
next-builds
|
|
|
|
(~(put in next-builds.state) client)
|
|
|
|
::
|
|
|
|
provisional-components
|
|
|
|
(~(put by-build-dag provisional-components.state) client build)
|
|
|
|
::
|
|
|
|
builds
|
|
|
|
(~(put by-builds builds.state) client)
|
|
|
|
==
|
|
|
|
:: +unlink-used-provisional-builds:
|
|
|
|
::
|
|
|
|
:: The first step in provisional build cleanup is to remove
|
|
|
|
:: sub-builds which were actually depended on from the provisional
|
|
|
|
:: build set because they're no longer provisional.
|
|
|
|
::
|
|
|
|
++ unlink-used-provisional-builds
|
|
|
|
|= [=build sub-builds=(list build)]
|
|
|
|
^+ state
|
|
|
|
::
|
|
|
|
%_ state
|
|
|
|
provisional-components
|
2018-04-26 02:56:38 +03:00
|
|
|
%+ roll sub-builds
|
|
|
|
|= $: sub-build=^build
|
2018-04-24 02:17:20 +03:00
|
|
|
provisional-components=_provisional-components.state
|
|
|
|
==
|
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
(~(del by-build-dag provisional-components) build sub-build)
|
2018-04-28 00:09:18 +03:00
|
|
|
==
|
|
|
|
:: +cleanup-orphaned-provisional-builds: delete extraneous sub-builds
|
|
|
|
::
|
|
|
|
:: Any builds left in :provisional-components.state for our build
|
|
|
|
:: are orphaned builds. However, these builds may have other
|
|
|
|
:: listeners and we don't want to delete those.
|
|
|
|
::
|
|
|
|
++ cleanup-orphaned-provisional-builds
|
|
|
|
|= =build
|
|
|
|
^+ ..execute
|
|
|
|
::
|
|
|
|
%+ roll
|
|
|
|
(~(get-subs by-build-dag provisional-components.state) build)
|
|
|
|
::
|
|
|
|
|= [sub-build=^build accumulator=_..execute]
|
|
|
|
=. ..execute accumulator
|
|
|
|
:: calculate the listeners to remove
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
:: Orphaned sub-builds have a set of listeners attached to them.
|
|
|
|
:: We want to find the listeners which shouldn't be there and
|
|
|
|
:: remove them.
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
=/ provisional-client-listeners=(set listener)
|
|
|
|
(fall (~(get by listeners.state) build) ~)
|
|
|
|
:: unify listener sets of all provisional client builds of :sub-build
|
|
|
|
::
|
|
|
|
=/ all-other-client-listeners=(set listener)
|
2018-04-24 02:17:20 +03:00
|
|
|
%+ roll
|
2018-05-01 01:15:25 +03:00
|
|
|
%~ tap in
|
2018-04-28 00:09:18 +03:00
|
|
|
:: omit :build; it's all *other* client listeners
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
=- (~(del in -) build)
|
|
|
|
=- (fall - ~)
|
|
|
|
(~(get by client-builds.provisional-components.state) sub-build)
|
|
|
|
|= [build=^build listeners=(set listener)]
|
2018-04-26 02:56:38 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
%- ~(uni in listeners)
|
|
|
|
(fall (~(get by listeners.state) build) ~)
|
2018-05-10 00:00:09 +03:00
|
|
|
:: remove the orphaned build from provisional builds
|
|
|
|
::
|
|
|
|
=. provisional-components.state
|
|
|
|
(~(del by-build-dag provisional-components.state) build sub-build)
|
2018-04-28 00:09:18 +03:00
|
|
|
:: orphaned-listeners: the clients we actually have to remove
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
:: The clients that are actually orphaned are the ones which are
|
|
|
|
:: in :provisional-client-listeners, but not
|
|
|
|
:: :all-other-client-listeners.
|
2018-04-26 02:56:38 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
=/ orphaned-listeners
|
|
|
|
(~(dif in provisional-client-listeners) all-other-client-listeners)
|
|
|
|
:: remove orphaned listeners from :sub-build
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-05-10 00:00:09 +03:00
|
|
|
:: We need to do this after we've removed :sub-build from
|
|
|
|
:: :provisional-components.state because otherwise that provisional
|
|
|
|
:: client link will prevent the listener from being removed.
|
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
=. state
|
|
|
|
%+ roll ~(tap in orphaned-listeners)
|
|
|
|
|= [=listener accumulator=_state]
|
|
|
|
=. state accumulator
|
|
|
|
::
|
|
|
|
(remove-listener-from-build listener sub-build)
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
(cleanup sub-build)
|
|
|
|
::
|
|
|
|
:: +| apply-blocks
|
2018-04-26 02:56:38 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +apply-blocks: apply a %blocks +build-receipt to ..execute
|
2018-04-26 02:56:38 +03:00
|
|
|
::
|
|
|
|
:: :build blocked. Record information about what builds it blocked on
|
|
|
|
:: and try those blocked builds as candidates in the next pass.
|
2018-03-23 08:25:53 +03:00
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
++ apply-blocks
|
|
|
|
|= $: =build
|
|
|
|
$: %blocks
|
|
|
|
blocks=(list build)
|
2018-05-08 00:31:24 +03:00
|
|
|
scry-blocked=(unit scry-request)
|
2018-04-26 02:56:38 +03:00
|
|
|
==
|
|
|
|
sub-builds=(list build)
|
|
|
|
==
|
|
|
|
^+ ..execute
|
|
|
|
:: if we scryed, send clay a request for the path we blocked on reading
|
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
=? moves
|
2018-04-26 02:56:38 +03:00
|
|
|
?=(^ scry-blocked)
|
2018-04-12 03:54:32 +03:00
|
|
|
:: TODO: handle other vanes
|
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
?> ?=(%c vane.u.scry-blocked)
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
[(clay-request-for-scry-request date.build u.scry-blocked) moves]
|
2018-05-01 00:57:32 +03:00
|
|
|
:: register resource block in :blocks.state
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
=? blocks.state
|
2018-04-26 02:56:38 +03:00
|
|
|
?=(^ scry-blocked)
|
2018-05-08 00:31:24 +03:00
|
|
|
(~(put ju blocks.state) u.scry-blocked build)
|
2018-04-12 03:54:32 +03:00
|
|
|
:: register blocks on sub-builds in :blocked-builds.state
|
|
|
|
::
|
2018-04-28 00:09:18 +03:00
|
|
|
=. state (register-sub-build-blocks build blocks)
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
..execute
|
2018-05-08 00:31:24 +03:00
|
|
|
:: +clay-request-for-scry-request: new move to request blocked resource
|
2018-04-28 00:09:18 +03:00
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
++ clay-request-for-scry-request
|
|
|
|
|= [date=@da =scry-request]
|
2018-04-28 00:09:18 +03:00
|
|
|
^- move
|
|
|
|
::
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =wire
|
2018-05-08 00:31:24 +03:00
|
|
|
(welp /(scot %p our)/scry-request (scry-request-to-path scry-request))
|
2018-04-28 00:09:18 +03:00
|
|
|
::
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =note
|
2018-05-08 00:31:24 +03:00
|
|
|
=/ =disc [p q]:beam.scry-request
|
2018-04-28 00:09:18 +03:00
|
|
|
:* %c %warp sock=[our their=ship.disc] desk.disc
|
2018-05-08 00:31:24 +03:00
|
|
|
`[%sing care.scry-request case=[%da date] (flop s.beam.scry-request)]
|
2018-04-28 00:09:18 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
[duct=~ [%pass wire note]]
|
|
|
|
:: +register-sub-build-blocks: book-keeping on blocked builds
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: When we receive a %blocks +build-receipt, we need to register that
|
2018-04-28 00:09:18 +03:00
|
|
|
:: :build is blocked on each item in :blocks, along with queuing
|
|
|
|
:: each block as a candidate build.
|
|
|
|
::
|
|
|
|
++ register-sub-build-blocks
|
|
|
|
|= [=build blocks=(list build)]
|
|
|
|
^+ state
|
|
|
|
::
|
|
|
|
%+ roll blocks
|
|
|
|
|= [block=^build state=_state]
|
2018-05-16 00:44:48 +03:00
|
|
|
:: we must run +apply-build-receipt on :build.made before :block
|
2018-04-28 00:09:18 +03:00
|
|
|
::
|
2018-05-16 00:44:48 +03:00
|
|
|
?< (~(has by results.state) block)
|
2018-04-28 00:09:18 +03:00
|
|
|
::
|
|
|
|
%_ state
|
|
|
|
blocked-builds
|
|
|
|
(~(put by-build-dag blocked-builds.state) build block)
|
|
|
|
::
|
|
|
|
candidate-builds
|
|
|
|
[block candidate-builds.state]
|
|
|
|
==
|
2018-04-26 02:56:38 +03:00
|
|
|
--
|
2018-05-01 00:57:32 +03:00
|
|
|
:: +resources-changed: did resources change since :previous-build?
|
2018-03-23 05:17:00 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
++ resources-changed
|
2018-04-12 03:54:32 +03:00
|
|
|
|= =build
|
|
|
|
^- ?
|
2018-03-30 04:36:09 +03:00
|
|
|
?. ?=(%scry -.schematic.build)
|
|
|
|
|
|
2018-03-23 05:17:00 +03:00
|
|
|
::
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =resource resource.schematic.build
|
2018-03-23 05:17:00 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
?. ?=(%c -.resource)
|
2018-03-30 04:36:09 +03:00
|
|
|
|
|
2018-03-23 05:17:00 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=/ updates (fall (~(get by resource-updates.state) date.build) ~)
|
2018-03-23 05:17:00 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
(~(has in updates) resource)
|
2018-03-23 05:17:00 +03:00
|
|
|
:: +link-rebuilds: link old and new same build in :rebuilds.state
|
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
++ link-rebuilds
|
|
|
|
|= [old-build=build new-build=build]
|
|
|
|
^+ rebuilds.state
|
2018-03-22 04:27:25 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
%_ rebuilds.state
|
|
|
|
old (~(put by old.rebuilds.state) new-build old-build)
|
|
|
|
new (~(put by new.rebuilds.state) old-build new-build)
|
2018-03-23 05:17:00 +03:00
|
|
|
==
|
2018-04-12 03:54:32 +03:00
|
|
|
:: +delete-root-once-listeners: remove once listeners on :build from :state
|
2018-03-23 05:17:00 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
++ delete-root-once-listeners
|
|
|
|
|= =build
|
|
|
|
^+ state
|
2018-03-22 04:27:25 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
%+ roll (root-once-listeners build)
|
|
|
|
|= [=listener accumulator=_state]
|
|
|
|
=. state accumulator
|
|
|
|
(remove-listener-from-build listener build)
|
2018-03-23 05:17:00 +03:00
|
|
|
--
|
2018-03-21 21:10:54 +03:00
|
|
|
:: +make: attempt to perform :build, non-recursively
|
|
|
|
::
|
|
|
|
:: Registers component linkages between :build and its sub-builds.
|
|
|
|
:: Attempts to perform +scry if necessary. Does not directly enqueue
|
|
|
|
:: any moves.
|
2018-03-16 04:38:33 +03:00
|
|
|
::
|
|
|
|
++ make
|
|
|
|
|= =build
|
2018-05-01 00:57:32 +03:00
|
|
|
^- build-receipt
|
2018-04-12 03:54:32 +03:00
|
|
|
:: accessed-builds: builds accessed/depended on during this run.
|
|
|
|
::
|
|
|
|
=| accessed-builds=(list ^build)
|
2018-03-21 21:10:54 +03:00
|
|
|
:: dispatch based on the kind of +schematic in :build
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
::
|
|
|
|
|^ =, schematic.build
|
|
|
|
::
|
|
|
|
?- -.schematic.build
|
2018-03-21 01:39:22 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
^ (make-autocons [head tail])
|
2018-03-21 01:39:22 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
%$ (make-literal literal)
|
2018-03-21 01:39:22 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
%pin (make-pin date schematic)
|
|
|
|
%alts (make-alts choices)
|
2018-03-21 01:39:22 +03:00
|
|
|
%bake !!
|
|
|
|
%bunt !!
|
2018-05-16 01:02:17 +03:00
|
|
|
%call (make-call gate sample)
|
2018-03-21 01:39:22 +03:00
|
|
|
%cast !!
|
2018-05-16 01:02:17 +03:00
|
|
|
%core (make-core source-path)
|
2018-03-21 21:10:54 +03:00
|
|
|
%diff !!
|
2018-05-16 01:02:17 +03:00
|
|
|
%dude (make-dude error attempt)
|
|
|
|
%hood (make-hood source-path)
|
2018-03-21 21:10:54 +03:00
|
|
|
%join !!
|
|
|
|
%mash !!
|
|
|
|
%mute !!
|
|
|
|
%pact !!
|
2018-05-16 01:02:17 +03:00
|
|
|
%path (make-path disc prefix raw-path)
|
|
|
|
%plan (make-plan source-path query-string scaffold)
|
|
|
|
%reef (make-reef disc)
|
|
|
|
%ride (make-ride formula subject)
|
|
|
|
%same (make-same schematic)
|
|
|
|
%scry (make-scry resource)
|
|
|
|
%slim (make-slim subject-type formula)
|
|
|
|
%slit (make-slit gate sample)
|
2018-03-21 01:39:22 +03:00
|
|
|
%vale !!
|
|
|
|
%volt !!
|
|
|
|
==
|
2018-03-30 04:36:09 +03:00
|
|
|
:: |schematic-handlers:make: implementation of the schematics
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
:: All of these produce a value of the same type as +make itself.
|
|
|
|
::
|
|
|
|
:: +| schematic-handlers
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-autocons
|
2018-03-30 04:36:09 +03:00
|
|
|
|= [head=schematic tail=schematic]
|
2018-05-01 00:57:32 +03:00
|
|
|
^- build-receipt
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
2018-05-08 01:04:54 +03:00
|
|
|
=/ head-build=^build [date.build head]
|
|
|
|
=/ tail-build=^build [date.build tail]
|
|
|
|
=^ head-result accessed-builds (depend-on head-build)
|
|
|
|
=^ tail-result accessed-builds (depend-on tail-build)
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=| blocks=(list ^build)
|
2018-05-08 01:04:54 +03:00
|
|
|
=? blocks ?=(~ head-result) [head-build blocks]
|
|
|
|
=? blocks ?=(~ tail-result) [tail-build blocks]
|
2018-03-20 04:03:18 +03:00
|
|
|
:: if either build blocked, we're not done
|
|
|
|
::
|
|
|
|
?^ blocks
|
|
|
|
::
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks blocks ~] accessed-builds]
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
|
|
|
?< ?=(~ head-result)
|
|
|
|
?< ?=(~ tail-result)
|
|
|
|
::
|
2018-05-10 00:00:09 +03:00
|
|
|
=- [build [%build-result -] accessed-builds]
|
2018-05-01 00:57:32 +03:00
|
|
|
`build-result`[%success u.head-result u.tail-result]
|
2018-03-20 22:01:49 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-literal
|
2018-03-30 04:36:09 +03:00
|
|
|
|= =cage
|
2018-05-01 00:57:32 +03:00
|
|
|
^- build-receipt
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%build-result %success %$ cage] accessed-builds]
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-pin
|
2018-03-30 04:36:09 +03:00
|
|
|
|= [date=@da =schematic]
|
2018-05-01 00:57:32 +03:00
|
|
|
^- build-receipt
|
2018-05-08 01:04:54 +03:00
|
|
|
:: pinned-sub: sub-build with the %pin date as formal date
|
|
|
|
::
|
|
|
|
=/ pinned-sub=^build [date schematic]
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-08 01:04:54 +03:00
|
|
|
=^ result accessed-builds (depend-on pinned-sub)
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
|
|
|
?~ result
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks ~[pinned-sub] ~] accessed-builds]
|
|
|
|
[build [%build-result %success %pin date u.result] accessed-builds]
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-alts
|
2018-04-24 02:17:20 +03:00
|
|
|
|= choices=(list schematic)
|
2018-05-01 00:57:32 +03:00
|
|
|
^- build-receipt
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
|
|
|
?~ choices
|
2018-05-16 02:02:01 +03:00
|
|
|
(return-error [leaf+"%alts: all options failed"]~)
|
|
|
|
::
|
2018-05-08 01:04:54 +03:00
|
|
|
=/ choice=^build [date.build i.choices]
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-05-08 01:04:54 +03:00
|
|
|
=^ result accessed-builds (depend-on choice)
|
2018-04-24 02:17:20 +03:00
|
|
|
?~ result
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks ~[choice] ~] accessed-builds]
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
|
|
|
?: ?=([%error *] u.result)
|
|
|
|
$(choices t.choices)
|
|
|
|
::
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%build-result %success %alts u.result] accessed-builds]
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-call
|
2018-05-08 21:10:58 +03:00
|
|
|
|= [gate=schematic sample=schematic]
|
|
|
|
^- build-receipt
|
|
|
|
::
|
|
|
|
=/ gate-build=^build [date.build gate]
|
|
|
|
=^ gate-result accessed-builds (depend-on gate-build)
|
|
|
|
::
|
|
|
|
=/ sample-build=^build [date.build sample]
|
|
|
|
=^ sample-result accessed-builds (depend-on sample-build)
|
|
|
|
::
|
|
|
|
=| blocks=(list ^build)
|
|
|
|
=? blocks ?=(~ gate-result) [[date.build gate] blocks]
|
|
|
|
=? blocks ?=(~ sample-result) [[date.build sample] blocks]
|
|
|
|
?^ blocks
|
|
|
|
::
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks blocks ~] accessed-builds]
|
2018-05-08 21:10:58 +03:00
|
|
|
::
|
|
|
|
?< ?=(~ gate-result)
|
|
|
|
?< ?=(~ sample-result)
|
|
|
|
::
|
|
|
|
=/ gate-vase=vase q:(result-to-cage u.gate-result)
|
|
|
|
=/ sample-vase=vase q:(result-to-cage u.sample-result)
|
|
|
|
::
|
|
|
|
:: run %slit to get the resulting type of calculating the gate
|
|
|
|
::
|
|
|
|
=/ slit-schematic=schematic [%slit gate-vase sample-vase]
|
|
|
|
=/ slit-build=^build [date.build slit-schematic]
|
|
|
|
=^ slit-result accessed-builds (depend-on slit-build)
|
|
|
|
?~ slit-result
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks [date.build slit-schematic]~ ~] accessed-builds]
|
2018-05-08 21:10:58 +03:00
|
|
|
::
|
2018-05-16 02:02:01 +03:00
|
|
|
?. ?=([~ %success %slit *] slit-result)
|
|
|
|
(wrap-error slit-result)
|
2018-05-08 21:10:58 +03:00
|
|
|
::
|
|
|
|
:: How much duplication is there going to be here between +call and
|
|
|
|
:: +ride? Right now, we're just !! on scrys, but for reals we want it to
|
|
|
|
:: do the same handling.
|
|
|
|
?> &(?=(^ q.gate-vase) ?=(^ +.q.gate-vase))
|
|
|
|
=/ val
|
|
|
|
(mong [q.gate-vase q.sample-vase] intercepted-scry)
|
|
|
|
::
|
|
|
|
?- -.val
|
|
|
|
%0
|
|
|
|
:* build
|
|
|
|
[%build-result %success %call [type.u.slit-result p.val]]
|
|
|
|
accessed-builds
|
|
|
|
==
|
|
|
|
::
|
|
|
|
%1
|
|
|
|
=/ blocked-paths=(list path) ((hard (list path)) p.val)
|
|
|
|
(blocked-paths-to-receipt %call blocked-paths)
|
|
|
|
::
|
|
|
|
%2
|
2018-05-16 02:02:01 +03:00
|
|
|
(return-error [[%leaf "ford: %call failed:"] p.val])
|
2018-05-08 21:10:58 +03:00
|
|
|
==
|
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-core
|
2018-05-11 22:55:44 +03:00
|
|
|
|= source-path=rail
|
|
|
|
^- build-receipt
|
|
|
|
:: convert file at :source-path to a +scaffold
|
|
|
|
::
|
|
|
|
=/ hood-build=^build [date.build [%hood source-path]]
|
|
|
|
::
|
|
|
|
=^ hood-result accessed-builds (depend-on hood-build)
|
|
|
|
?~ hood-result
|
|
|
|
[build [%blocks [hood-build]~ ~] accessed-builds]
|
|
|
|
::
|
|
|
|
?: ?=(%error -.u.hood-result)
|
2018-05-16 02:02:01 +03:00
|
|
|
(wrap-error hood-result)
|
2018-05-11 22:55:44 +03:00
|
|
|
:: build the +scaffold into a program
|
|
|
|
::
|
|
|
|
?> ?=([%success %hood *] u.hood-result)
|
|
|
|
::
|
|
|
|
=/ plan-build=^build
|
|
|
|
[date.build [%plan source-path `coin`[%many ~] scaffold.u.hood-result]]
|
|
|
|
::
|
|
|
|
=^ plan-result accessed-builds (depend-on plan-build)
|
|
|
|
?~ plan-result
|
|
|
|
[build [%blocks [plan-build]~ ~] accessed-builds]
|
|
|
|
::
|
|
|
|
?: ?=(%error -.u.plan-result)
|
2018-05-16 02:02:01 +03:00
|
|
|
(wrap-error plan-result)
|
2018-05-11 22:55:44 +03:00
|
|
|
::
|
|
|
|
?> ?=([%success %plan *] u.plan-result)
|
|
|
|
[build [%build-result %success %core vase.u.plan-result] accessed-builds]
|
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-dude
|
2018-05-11 01:18:12 +03:00
|
|
|
|= [error=(trap tank) attempt=schematic]
|
|
|
|
^- build-receipt
|
|
|
|
::
|
|
|
|
=/ attempt-build=^build [date.build attempt]
|
|
|
|
=^ attempt-result accessed-builds (depend-on attempt-build)
|
|
|
|
?~ attempt-result
|
|
|
|
::
|
|
|
|
[build [%blocks ~[[date.build attempt]] ~] accessed-builds]
|
|
|
|
::
|
|
|
|
?. ?=([%error *] u.attempt-result)
|
|
|
|
[build [%build-result %success %dude u.attempt-result] accessed-builds]
|
|
|
|
::
|
2018-05-16 02:02:01 +03:00
|
|
|
(return-error [$:error message.u.attempt-result])
|
2018-05-11 01:18:12 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-hood
|
2018-05-11 03:13:09 +03:00
|
|
|
|= source-path=rail
|
|
|
|
^- build-receipt
|
|
|
|
::
|
|
|
|
=/ scry-build=^build [date.build [%scry [%c %x source-path]]]
|
|
|
|
=^ scry-result accessed-builds (depend-on scry-build)
|
|
|
|
?~ scry-result
|
|
|
|
::
|
|
|
|
[build [%blocks ~[scry-build] ~] accessed-builds]
|
|
|
|
::
|
2018-05-16 02:02:01 +03:00
|
|
|
?: ?=([~ %error *] scry-result)
|
|
|
|
(wrap-error scry-result)
|
2018-05-15 20:42:45 +03:00
|
|
|
=+ as-cage=(result-to-cage u.scry-result)
|
|
|
|
:: hoon files must be atoms to parse
|
2018-05-11 03:13:09 +03:00
|
|
|
::
|
2018-05-15 20:42:45 +03:00
|
|
|
?. ?=(@ q.q.as-cage)
|
2018-05-16 02:02:01 +03:00
|
|
|
(return-error [%leaf "ford: %hood: file not an atom"]~)
|
2018-05-15 20:42:45 +03:00
|
|
|
::
|
|
|
|
=* src-beam [[ship.disc desk.disc [%ud 0]] spur]:source-path
|
|
|
|
=/ parsed
|
|
|
|
((full (parse-scaffold src-beam)) [1 1] (trip q.q.as-cage))
|
2018-05-11 03:13:09 +03:00
|
|
|
::
|
2018-05-15 20:42:45 +03:00
|
|
|
?~ q.parsed
|
2018-05-16 02:02:01 +03:00
|
|
|
(return-error [%leaf "syntax error: {<p.p.parsed>} {<q.p.parsed>}"]~)
|
2018-05-11 03:13:09 +03:00
|
|
|
::
|
2018-05-15 20:42:45 +03:00
|
|
|
[build [%build-result %success %hood p.u.q.parsed] accessed-builds]
|
2018-05-11 03:13:09 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-path
|
|
|
|
|= [disc=^disc prefix=@tas raw-path=@tas]
|
2018-05-10 23:34:25 +03:00
|
|
|
^- build-receipt
|
|
|
|
:: possible-spurs: flopped paths to which :raw-path could resolve
|
|
|
|
::
|
|
|
|
=/ possible-spurs=(list spur) (turn (segments raw-path) flop)
|
|
|
|
:: sub-builds: scry builds to check each path in :possible-paths
|
|
|
|
::
|
|
|
|
=/ sub-builds=(list ^build)
|
|
|
|
%+ turn possible-spurs
|
|
|
|
|= possible-spur=spur
|
|
|
|
^- ^build
|
|
|
|
:: full-spur: wrap :possible-spur with :prefix and /hoon suffix
|
|
|
|
::
|
|
|
|
=/ full-spur=spur :(welp /hoon possible-spur /[prefix])
|
|
|
|
::
|
|
|
|
[date.build [%scry %c %x `rail`[disc full-spur]]]
|
|
|
|
:: results: accumulator for results of sub-builds
|
|
|
|
::
|
|
|
|
=| results=(list [kid=^build result=(unit build-result)])
|
|
|
|
:: depend on all the sub-builds and collect their results
|
|
|
|
::
|
|
|
|
=/ subs-results
|
|
|
|
|- ^+ [results accessed-builds]
|
|
|
|
?~ sub-builds [results accessed-builds]
|
|
|
|
::
|
|
|
|
=/ kid=^build i.sub-builds
|
|
|
|
::
|
|
|
|
=^ result accessed-builds (depend-on kid)
|
|
|
|
=. results [[kid result] results]
|
|
|
|
::
|
|
|
|
$(sub-builds t.sub-builds)
|
|
|
|
:: apply mutations from depending on sub-builds
|
|
|
|
::
|
|
|
|
=: results -.subs-results
|
|
|
|
accessed-builds +.subs-results
|
|
|
|
==
|
|
|
|
:: split :results into completed :mades and incomplete :blocks
|
|
|
|
::
|
|
|
|
=+ split-results=(skid results |=([* r=(unit build-result)] ?=(^ r)))
|
|
|
|
::
|
|
|
|
=/ mades=_results -.split-results
|
|
|
|
=/ blocks=_results +.split-results
|
|
|
|
:: if any builds blocked, produce them all in %blocks
|
|
|
|
::
|
|
|
|
?^ blocks
|
|
|
|
[build [%blocks (turn `_results`blocks head) ~] accessed-builds]
|
|
|
|
:: matches: builds that completed with a successful result
|
|
|
|
::
|
|
|
|
=/ matches=_results
|
|
|
|
%+ skim mades
|
|
|
|
|= [* r=(unit build-result)]
|
|
|
|
::
|
|
|
|
?=([~ %success *] r)
|
|
|
|
:: if no matches, error out
|
|
|
|
::
|
|
|
|
?~ matches
|
|
|
|
=/ =beam
|
|
|
|
[[ship.disc desk.disc [%da date.build]] /hoon/[raw-path]/[prefix]]
|
|
|
|
::
|
2018-05-16 02:02:01 +03:00
|
|
|
(return-error [%leaf "%path: no matches for {<(en-beam beam)>}"]~)
|
2018-05-10 23:34:25 +03:00
|
|
|
:: if exactly one path matches, succeed with the matching path
|
|
|
|
::
|
|
|
|
?: ?=([* ~] matches)
|
|
|
|
=* kid kid.i.matches
|
|
|
|
?> ?=(%scry -.schematic.kid)
|
|
|
|
::
|
|
|
|
:* build
|
|
|
|
[%build-result %success %path rail.resource.schematic.kid]
|
|
|
|
accessed-builds
|
|
|
|
==
|
|
|
|
:: multiple paths matched; error out
|
|
|
|
::
|
2018-05-16 02:02:01 +03:00
|
|
|
%- return-error
|
2018-05-10 23:34:25 +03:00
|
|
|
::
|
2018-05-16 02:02:01 +03:00
|
|
|
:- [%leaf "multiple matches for %path: "]
|
|
|
|
:: tmi; cast :matches back to +list
|
|
|
|
::
|
|
|
|
%+ roll `_results`matches
|
|
|
|
|= [[kid=^build result=(unit build-result)] message=tang]
|
|
|
|
^- tang
|
|
|
|
::
|
|
|
|
?> ?=(%scry -.schematic.kid)
|
|
|
|
:: beam: reconstruct request from :kid's schematic and date
|
|
|
|
::
|
|
|
|
=/ =beam
|
|
|
|
:* [ship.disc desk.disc [%da date.kid]]
|
|
|
|
spur.rail.resource.schematic.kid
|
|
|
|
==
|
|
|
|
::
|
|
|
|
[[%leaf "{<(en-beam beam)>}"] message]
|
2018-05-10 23:34:25 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-plan
|
2018-05-09 02:54:29 +03:00
|
|
|
|= [source-path=rail query-string=coin =scaffold]
|
|
|
|
^- build-receipt
|
|
|
|
:: TODO: support cranes
|
|
|
|
:: TODO: support query-string
|
|
|
|
:: TODO: support source-path
|
|
|
|
:: TODO: support indirect hoons
|
|
|
|
::
|
|
|
|
=/ hoon-stack=(list hoon)
|
|
|
|
%+ turn sources.scaffold
|
|
|
|
|= =brick ?>(?=(%direct -.brick) source.brick)
|
|
|
|
:: combine hoons into one: =~(hoon1 hoon2 ...)
|
|
|
|
:: TODO: why flop?
|
|
|
|
::
|
|
|
|
=/ combined-hoon=hoon [%tssg (flop hoon-stack)]
|
|
|
|
:: compile :combined-hoon against the kernel subject
|
|
|
|
::
|
2018-05-15 02:19:56 +03:00
|
|
|
=/ compile=^build
|
|
|
|
[date.build [%ride combined-hoon [%reef disc.source-path]]]
|
2018-05-09 02:54:29 +03:00
|
|
|
::
|
|
|
|
=^ compiled accessed-builds (depend-on compile)
|
|
|
|
:: compilation blocked; produce block on sub-build
|
|
|
|
::
|
|
|
|
?~ compiled
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks ~[compile] ~] accessed-builds]
|
2018-05-09 02:54:29 +03:00
|
|
|
:: compilation failed; error out
|
|
|
|
::
|
2018-05-16 02:02:01 +03:00
|
|
|
?: ?=([~ %error *] compiled)
|
|
|
|
(wrap-error compiled)
|
2018-05-09 02:54:29 +03:00
|
|
|
:: compilation succeeded: produce resulting :vase
|
|
|
|
::
|
|
|
|
=/ =vase q:(result-to-cage u.compiled)
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%build-result %success %plan vase] accessed-builds]
|
2018-05-09 02:54:29 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-reef
|
2018-05-15 02:19:56 +03:00
|
|
|
|= =disc
|
2018-05-08 02:12:07 +03:00
|
|
|
^- build-receipt
|
2018-05-15 02:19:56 +03:00
|
|
|
:: short-circuit to :pit if asked for current %home desk
|
|
|
|
::
|
|
|
|
:: This avoids needing to recompile the kernel if we're asked
|
|
|
|
:: for the kernel we're already running. Note that this fails
|
|
|
|
:: referential transparency if |autoload is turned off.
|
|
|
|
::
|
|
|
|
?: ?& =(disc [our %home])
|
|
|
|
:: is :date.build the latest commit on the %home desk?
|
|
|
|
::
|
|
|
|
?| =(now date.build)
|
|
|
|
::
|
|
|
|
=/ =beam [[our %home [%da date.build]] /hoon/hoon/sys]
|
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
.= (scry [%143 %noun] ~ %cw beam)
|
|
|
|
(scry [%143 %noun] ~ %cw beam(r [%da now]))
|
2018-05-15 02:19:56 +03:00
|
|
|
== ==
|
|
|
|
::
|
|
|
|
[build [%build-result %success %reef pit] accessed-builds]
|
|
|
|
::
|
|
|
|
=/ hoon-scry
|
|
|
|
[date.build [%scry %c %x [disc /hoon/hoon/sys]]]
|
|
|
|
::
|
|
|
|
=^ hoon-scry-result accessed-builds (depend-on hoon-scry)
|
|
|
|
::
|
|
|
|
=/ arvo-scry
|
|
|
|
[date.build [%scry %c %x [disc /hoon/arvo/sys]]]
|
|
|
|
::
|
|
|
|
=^ arvo-scry-result accessed-builds (depend-on arvo-scry)
|
|
|
|
::
|
|
|
|
=/ zuse-scry
|
|
|
|
[date.build [%scry %c %x [disc /hoon/zuse/sys]]]
|
|
|
|
::
|
|
|
|
=^ zuse-scry-result accessed-builds (depend-on zuse-scry)
|
|
|
|
::
|
|
|
|
=| blocks=(list ^build)
|
|
|
|
=? blocks ?=(~ hoon-scry-result) [hoon-scry blocks]
|
|
|
|
=? blocks ?=(~ arvo-scry-result) [arvo-scry blocks]
|
|
|
|
=? blocks ?=(~ zuse-scry-result) [zuse-scry blocks]
|
|
|
|
::
|
|
|
|
?^ blocks
|
|
|
|
[build [%blocks blocks ~] accessed-builds]
|
|
|
|
::
|
|
|
|
?. ?=([~ %success %scry *] hoon-scry-result)
|
2018-05-16 02:02:01 +03:00
|
|
|
(wrap-error hoon-scry-result)
|
2018-05-15 02:19:56 +03:00
|
|
|
::
|
|
|
|
?. ?=([~ %success %scry *] arvo-scry-result)
|
2018-05-16 02:02:01 +03:00
|
|
|
(wrap-error arvo-scry-result)
|
2018-05-15 02:19:56 +03:00
|
|
|
::
|
|
|
|
?. ?=([~ %success %scry *] zuse-scry-result)
|
2018-05-16 02:02:01 +03:00
|
|
|
(wrap-error zuse-scry-result)
|
2018-05-15 02:19:56 +03:00
|
|
|
:: omit case from path to prevent cache misses
|
|
|
|
::
|
|
|
|
=/ hoon-path=path
|
|
|
|
/(scot %p ship.disc)/(scot %tas desk.disc)/hoon/hoon/sys
|
|
|
|
=/ hoon-hoon=hoon (rain hoon-path ;;(@t q.q.cage.u.hoon-scry-result))
|
|
|
|
::
|
|
|
|
=/ arvo-path=path
|
|
|
|
/(scot %p ship.disc)/(scot %tas desk.disc)/hoon/arvo/sys
|
|
|
|
=/ arvo-hoon=hoon (rain arvo-path ;;(@t q.q.cage.u.arvo-scry-result))
|
|
|
|
::
|
|
|
|
=/ zuse-path=path
|
|
|
|
/(scot %p ship.disc)/(scot %tas desk.disc)/hoon/zuse/sys
|
|
|
|
=/ zuse-hoon=hoon (rain zuse-path ;;(@t q.q.cage.u.zuse-scry-result))
|
|
|
|
::
|
|
|
|
=/ zuse-build=^build
|
|
|
|
:* date.build
|
|
|
|
%ride zuse-hoon
|
|
|
|
%ride arvo-hoon
|
|
|
|
%ride hoon-hoon
|
|
|
|
[%$ %noun !>(~)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
=^ zuse-build-result accessed-builds (depend-on zuse-build)
|
|
|
|
?~ zuse-build-result
|
|
|
|
[build [%blocks [zuse-build]~ ~] accessed-builds]
|
|
|
|
::
|
|
|
|
?. ?=([~ %success %ride *] zuse-build-result)
|
2018-05-16 02:02:01 +03:00
|
|
|
(wrap-error zuse-build-result)
|
2018-05-15 02:19:56 +03:00
|
|
|
::
|
|
|
|
:+ build
|
|
|
|
[%build-result %success %reef vase.u.zuse-build-result]
|
|
|
|
accessed-builds
|
2018-05-08 02:12:07 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-ride
|
2018-04-03 02:17:27 +03:00
|
|
|
|= [formula=hoon =schematic]
|
2018-05-01 00:57:32 +03:00
|
|
|
^- build-receipt
|
2018-04-03 02:17:27 +03:00
|
|
|
::
|
2018-05-08 01:04:54 +03:00
|
|
|
=^ result accessed-builds (depend-on [date.build schematic])
|
2018-04-03 02:17:27 +03:00
|
|
|
?~ result
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks [date.build schematic]~ ~] accessed-builds]
|
2018-04-05 03:11:21 +03:00
|
|
|
::
|
|
|
|
=* subject u.result
|
|
|
|
=* subject-cage (result-to-cage subject)
|
|
|
|
=/ slim-schematic=^schematic [%slim p.q.subject-cage formula]
|
2018-05-08 01:04:54 +03:00
|
|
|
=^ slim-result accessed-builds (depend-on [date.build slim-schematic])
|
2018-04-05 03:11:21 +03:00
|
|
|
?~ slim-result
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks [date.build slim-schematic]~ ~] accessed-builds]
|
2018-04-05 03:11:21 +03:00
|
|
|
::
|
2018-05-16 02:02:01 +03:00
|
|
|
?. ?=([~ %success %slim *] slim-result)
|
|
|
|
(wrap-error slim-result)
|
2018-04-05 03:11:21 +03:00
|
|
|
::
|
|
|
|
=/ val
|
2018-04-06 00:12:57 +03:00
|
|
|
(mock [q.q.subject-cage nock.u.slim-result] intercepted-scry)
|
2018-04-05 03:11:21 +03:00
|
|
|
:: val is a toon, which might be a list of blocks.
|
|
|
|
::
|
|
|
|
?- -.val
|
|
|
|
::
|
|
|
|
%0
|
2018-04-24 02:17:20 +03:00
|
|
|
:* build
|
2018-05-01 00:57:32 +03:00
|
|
|
[%build-result %success %ride [type.u.slim-result p.val]]
|
2018-04-24 02:17:20 +03:00
|
|
|
accessed-builds
|
|
|
|
==
|
2018-04-05 03:11:21 +03:00
|
|
|
::
|
|
|
|
%1
|
2018-04-06 00:12:57 +03:00
|
|
|
=/ blocked-paths=(list path) ((hard (list path)) p.val)
|
2018-05-08 21:10:58 +03:00
|
|
|
(blocked-paths-to-receipt %ride blocked-paths)
|
2018-04-05 03:11:21 +03:00
|
|
|
::
|
|
|
|
%2
|
2018-05-16 02:02:01 +03:00
|
|
|
(return-error [[%leaf "ford: %ride failed:"] p.val])
|
2018-04-05 03:11:21 +03:00
|
|
|
==
|
2018-04-03 02:17:27 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-same
|
2018-03-30 22:53:57 +03:00
|
|
|
|= =schematic
|
2018-05-01 00:57:32 +03:00
|
|
|
^- build-receipt
|
2018-03-30 22:53:57 +03:00
|
|
|
::
|
2018-05-08 01:04:54 +03:00
|
|
|
=^ result accessed-builds (depend-on [date.build schematic])
|
2018-03-30 22:53:57 +03:00
|
|
|
::
|
|
|
|
?~ result
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks [date.build schematic]~ ~] accessed-builds]
|
|
|
|
[build [%build-result %success %same u.result] accessed-builds]
|
2018-03-30 22:53:57 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-scry
|
2018-04-12 03:54:32 +03:00
|
|
|
:: TODO: All accesses to :state which matter happens in this function;
|
|
|
|
:: those calculations need to be lifted out of +make into +execute.
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
|= =resource
|
|
|
|
^- build-receipt
|
2018-03-23 05:17:00 +03:00
|
|
|
:: construct a full +beam to make the scry request
|
|
|
|
::
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =beam (extract-beam resource `date.build)
|
2018-05-08 00:31:24 +03:00
|
|
|
::
|
|
|
|
=/ =scry-request [vane.resource care.resource beam]
|
2018-03-23 05:17:00 +03:00
|
|
|
:: perform scry operation if we don't already know the result
|
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
:: Look up :scry-request in :scry-results.per-event to avoid
|
2018-03-23 05:17:00 +03:00
|
|
|
:: rerunning a previously blocked +scry.
|
|
|
|
::
|
|
|
|
=/ scry-response
|
2018-05-08 00:31:24 +03:00
|
|
|
?: (~(has by scry-results) scry-request)
|
|
|
|
(~(get by scry-results) scry-request)
|
2018-05-16 01:02:17 +03:00
|
|
|
(scry [%143 %noun] ~ `@tas`(cat 3 [vane care]:resource) beam)
|
2018-03-23 05:17:00 +03:00
|
|
|
:: scry blocked
|
|
|
|
::
|
|
|
|
?~ scry-response
|
2018-05-08 00:31:24 +03:00
|
|
|
:: :build blocked on :scry-request
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
|
|
|
:: Enqueue a request +move to fetch the blocked resource.
|
|
|
|
:: Link :block and :build in :blocks.state so we know
|
|
|
|
:: which build to rerun in a later event when we +unblock
|
2018-05-01 00:57:32 +03:00
|
|
|
:: on that +resource.
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
=/ already-blocked=? (~(has by blocks.state) scry-request)
|
|
|
|
:: store :scry-request in persistent state
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
=. blocks.state (~(put ju blocks.state) scry-request build)
|
2018-04-03 00:42:54 +03:00
|
|
|
::
|
|
|
|
?: already-blocked
|
2018-05-01 00:57:32 +03:00
|
|
|
:: this resource was already blocked, so don't duplicate move
|
2018-04-03 00:42:54 +03:00
|
|
|
::
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks ~ ~] accessed-builds]
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks ~ `scry-request] accessed-builds]
|
2018-03-23 05:17:00 +03:00
|
|
|
:: scry failed
|
|
|
|
::
|
|
|
|
?~ u.scry-response
|
2018-05-16 02:02:01 +03:00
|
|
|
%- return-error
|
|
|
|
:~ leaf+"scry failed for"
|
|
|
|
leaf+"%c{(trip care.resource)} {<(en-beam beam)>}"
|
|
|
|
==
|
2018-03-23 05:17:00 +03:00
|
|
|
:: scry succeeded
|
|
|
|
::
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%build-result %success %scry u.u.scry-response] accessed-builds]
|
2018-04-03 02:17:27 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-slim
|
2018-04-03 02:17:27 +03:00
|
|
|
|= [subject-type=type formula=hoon]
|
2018-05-10 00:00:09 +03:00
|
|
|
^- build-receipt
|
2018-04-03 02:17:27 +03:00
|
|
|
::
|
|
|
|
=/ compiled=(each (pair type nock) tang)
|
|
|
|
(mule |.((~(mint ut subject-type) [%noun formula])))
|
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
:* build
|
|
|
|
?- -.compiled
|
|
|
|
%| [%build-result %error [leaf+"%slim failed: " p.compiled]]
|
2018-05-01 00:57:32 +03:00
|
|
|
%& [%build-result %success %slim p.compiled]
|
2018-04-24 02:17:20 +03:00
|
|
|
==
|
|
|
|
accessed-builds
|
2018-04-03 02:17:27 +03:00
|
|
|
==
|
2018-05-03 00:47:24 +03:00
|
|
|
::
|
2018-05-16 01:02:17 +03:00
|
|
|
++ make-slit
|
2018-05-03 00:47:24 +03:00
|
|
|
|= [gate=vase sample=vase]
|
|
|
|
^- build-receipt
|
|
|
|
::
|
|
|
|
=/ product=(each type tang)
|
2018-05-16 01:02:17 +03:00
|
|
|
(mule |.((slit p.gate p.sample)))
|
2018-05-03 00:47:24 +03:00
|
|
|
::
|
|
|
|
:* build
|
|
|
|
?- -.product
|
|
|
|
%| :* %build-result %error
|
|
|
|
:* (~(dunk ut p.sample) %have)
|
|
|
|
(~(dunk ut (~(peek ut p.gate) %free 6)) %want)
|
|
|
|
leaf+"%slit failed: "
|
|
|
|
p.product
|
|
|
|
==
|
|
|
|
==
|
|
|
|
%& [%build-result %success %slit p.product]
|
|
|
|
==
|
|
|
|
accessed-builds
|
|
|
|
==
|
2018-03-21 21:10:54 +03:00
|
|
|
:: |utilities:make: helper arms
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
|
|
|
::+| utilities
|
2018-05-16 02:02:01 +03:00
|
|
|
:: +wrap-error: wrap an error message around a failed sub-build
|
|
|
|
::
|
|
|
|
++ wrap-error
|
|
|
|
|= result=(unit build-result)
|
|
|
|
^- build-receipt
|
|
|
|
::
|
|
|
|
?> ?=([~ %error *] result)
|
|
|
|
=/ message=tang
|
|
|
|
[[%leaf "ford: {<-.schematic.build>} failed: "] message.u.result]
|
|
|
|
::
|
|
|
|
[build [%build-result %error message] accessed-builds]
|
|
|
|
:: +return-error: returns a specific failure message
|
|
|
|
::
|
|
|
|
++ return-error
|
|
|
|
|= =tang
|
|
|
|
^- build-receipt
|
|
|
|
[build [%build-result %error tang] accessed-builds]
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
|
|
|
++ depend-on
|
2018-05-08 01:04:54 +03:00
|
|
|
|= kid=^build
|
2018-04-12 03:54:32 +03:00
|
|
|
^- [(unit build-result) _accessed-builds]
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
2018-05-08 01:04:54 +03:00
|
|
|
=. accessed-builds [kid accessed-builds]
|
2018-04-18 00:14:13 +03:00
|
|
|
:: +access-cache will mutate :results.state
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
2018-04-18 00:14:13 +03:00
|
|
|
:: It's okay to ignore this because the accessed-builds get gathered
|
|
|
|
:: and merged during the +reduce step.
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
2018-05-08 01:04:54 +03:00
|
|
|
=/ maybe-cache-line -:(access-cache kid)
|
2018-03-20 04:03:18 +03:00
|
|
|
?~ maybe-cache-line
|
2018-04-12 03:54:32 +03:00
|
|
|
[~ accessed-builds]
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
|
|
|
=* cache-line u.maybe-cache-line
|
|
|
|
?: ?=(%tombstone -.cache-line)
|
2018-04-12 03:54:32 +03:00
|
|
|
[~ accessed-builds]
|
2018-03-20 04:03:18 +03:00
|
|
|
::
|
2018-04-12 03:54:32 +03:00
|
|
|
[`build-result.cache-line accessed-builds]
|
2018-05-08 21:10:58 +03:00
|
|
|
:: +blocked-paths-to-receipt: handle the %2 case for mock
|
|
|
|
::
|
|
|
|
:: Multiple schematics handle +toon instances. This handles the %2 case
|
|
|
|
:: for a +toon and transforms it into a +build-receipt so we depend on
|
|
|
|
:: the blocked paths correctly.
|
|
|
|
::
|
|
|
|
++ blocked-paths-to-receipt
|
|
|
|
|= [name=term blocked-paths=(list path)]
|
|
|
|
^- build-receipt
|
|
|
|
::
|
|
|
|
=/ blocks-or-failures=(list (each ^build tank))
|
|
|
|
%+ turn blocked-paths
|
|
|
|
|= =path
|
|
|
|
::
|
|
|
|
=/ scry-request=(unit scry-request) (path-to-scry-request path)
|
|
|
|
?~ scry-request
|
|
|
|
[%| [%leaf "ford: {<name>}: invalid scry path: {<path>}"]]
|
|
|
|
::
|
|
|
|
=* case r.beam.u.scry-request
|
|
|
|
::
|
|
|
|
?. ?=(%da -.case)
|
|
|
|
[%| [%leaf "ford: {<name>}: invalid case in scry path: {<path>}"]]
|
|
|
|
::
|
|
|
|
=/ date=@da p.case
|
|
|
|
::
|
|
|
|
=/ resource=(unit resource) (path-to-resource path)
|
|
|
|
?~ resource
|
|
|
|
:- %|
|
|
|
|
[%leaf "ford: {<name>}: invalid resource in scry path: {<path>}"]
|
|
|
|
::
|
|
|
|
=/ sub-schematic=^schematic [%pin date %scry u.resource]
|
|
|
|
::
|
|
|
|
[%& `^build`[date sub-schematic]]
|
|
|
|
::
|
|
|
|
=/ failed=tang
|
|
|
|
%+ murn blocks-or-failures
|
|
|
|
|= block=(each ^build tank)
|
|
|
|
^- (unit tank)
|
|
|
|
?- -.block
|
|
|
|
%& ~
|
|
|
|
%| `p.block
|
|
|
|
==
|
|
|
|
::
|
|
|
|
?^ failed
|
|
|
|
:: some failed
|
|
|
|
::
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%build-result %error failed] accessed-builds]
|
2018-05-08 21:10:58 +03:00
|
|
|
:: no failures
|
|
|
|
::
|
|
|
|
=/ blocks=(list ^build)
|
|
|
|
%+ turn blocks-or-failures
|
|
|
|
|= block=(each ^build tank)
|
|
|
|
?> ?=(%& -.block)
|
|
|
|
::
|
|
|
|
p.block
|
|
|
|
::
|
|
|
|
=. accessed-builds
|
|
|
|
%+ roll blocks
|
|
|
|
|= [block=^build accumulator=_accessed-builds]
|
|
|
|
=. accessed-builds accumulator
|
|
|
|
+:(depend-on [date.block schematic.block])
|
|
|
|
::
|
|
|
|
:: TODO: Here we are passing a single ~ for :scry-blocked. Should we
|
|
|
|
:: be passing one or multiple resource back instead? Maybe not? Are
|
|
|
|
:: we building blocking schematics, which they themselves will scry?
|
|
|
|
::
|
2018-05-10 00:00:09 +03:00
|
|
|
[build [%blocks blocks ~] accessed-builds]
|
2018-03-16 04:38:33 +03:00
|
|
|
--
|
2018-03-21 21:10:54 +03:00
|
|
|
:: |utilities:per-event: helper arms
|
2018-03-16 12:34:40 +03:00
|
|
|
::
|
|
|
|
::+| utilities
|
|
|
|
::
|
|
|
|
++ this .
|
2018-04-05 03:11:21 +03:00
|
|
|
:: +intercepted-scry: use local results as a scry facade
|
|
|
|
::
|
|
|
|
++ intercepted-scry
|
2018-04-06 00:12:57 +03:00
|
|
|
%- sloy ^- slyd
|
|
|
|
|= [ref=* (unit (set monk)) =term =beam]
|
2018-04-05 03:11:21 +03:00
|
|
|
^- (unit (unit (cask)))
|
2018-04-06 00:12:57 +03:00
|
|
|
?> ?=([@ *] ref)
|
|
|
|
=/ hoon-version=@ud -.ref
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =type ((hard type) +.ref)
|
2018-04-05 03:11:21 +03:00
|
|
|
::
|
|
|
|
~| hoon-version=hoon-version
|
2018-04-06 00:12:57 +03:00
|
|
|
?> ?=(?(%143 %151) hoon-version)
|
2018-04-05 03:11:21 +03:00
|
|
|
::
|
|
|
|
=/ vane=(unit ?(%c %g)) ((soft ?(%c %g)) (end 3 1 term))
|
|
|
|
?~ vane
|
|
|
|
~
|
|
|
|
=/ care=(unit care:clay) ((soft care:clay) (rsh 3 1 term))
|
|
|
|
?~ care
|
|
|
|
~
|
|
|
|
::
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =resource
|
2018-04-05 03:11:21 +03:00
|
|
|
[u.vane u.care rail=[[p.beam q.beam] s.beam]]
|
2018-04-06 00:12:57 +03:00
|
|
|
:: TODO: handle other kinds of +case
|
|
|
|
::
|
|
|
|
=/ date=@da
|
|
|
|
~| bad-case+r.beam
|
|
|
|
?> ?=(%da -.r.beam)
|
|
|
|
p.r.beam
|
|
|
|
::
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =build [date %scry resource]
|
2018-04-06 00:12:57 +03:00
|
|
|
:: if the actual scry produces a value, use that value; otherwise use local
|
|
|
|
::
|
|
|
|
=/ scry-response (scry +<.$)
|
2018-04-05 03:11:21 +03:00
|
|
|
::
|
2018-04-06 00:12:57 +03:00
|
|
|
?^ scry-response
|
|
|
|
scry-response
|
2018-04-05 03:11:21 +03:00
|
|
|
:: look up the scry result from our permanent state
|
|
|
|
::
|
|
|
|
:: Note: we can't freshen this cache entry because we can't modify
|
|
|
|
:: the state in this gate.
|
|
|
|
::
|
|
|
|
=/ local-result (~(get by results.state) build)
|
|
|
|
?~ local-result
|
|
|
|
~
|
|
|
|
?: ?=(%tombstone -.u.local-result)
|
|
|
|
~
|
|
|
|
::
|
|
|
|
=/ local-cage=cage (result-to-cage build-result.u.local-result)
|
|
|
|
:: if :local-result does not nest in :type, produce an error
|
|
|
|
::
|
|
|
|
?. -:(nets:wa type `^type`p.q.local-cage)
|
|
|
|
[~ ~]
|
|
|
|
::
|
2018-04-06 00:12:57 +03:00
|
|
|
[~ ~ `(cask)`local-cage]
|
2018-04-18 00:14:13 +03:00
|
|
|
:: +mark-as-done: store :build as complete and produce any unblocked clients
|
|
|
|
::
|
|
|
|
:: We may not know about these unblocked clients, so we register them in
|
|
|
|
:: the state.
|
|
|
|
::
|
|
|
|
++ mark-as-done
|
|
|
|
|= =build
|
|
|
|
^- [(list ^build) _state]
|
|
|
|
::
|
|
|
|
=/ client-builds=(list ^build)
|
2018-04-26 02:56:38 +03:00
|
|
|
(~(get-clients by-build-dag blocked-builds.state) build)
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
|
|
|
=. blocked-builds.state
|
|
|
|
%+ roll client-builds
|
|
|
|
::
|
|
|
|
|= [client=^build blocked-builds=_blocked-builds.state]
|
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
(~(del by-build-dag blocked-builds) client build)
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
|
|
|
:_ state
|
|
|
|
::
|
|
|
|
%+ roll client-builds
|
|
|
|
::
|
|
|
|
|= [client=^build next-builds=(list ^build)]
|
|
|
|
::
|
|
|
|
?: (is-build-blocked client)
|
|
|
|
next-builds
|
|
|
|
[client next-builds]
|
2018-03-31 02:55:43 +03:00
|
|
|
:: +send-mades: send one %made move for :build per listener in :listeners
|
|
|
|
::
|
|
|
|
++ send-mades
|
|
|
|
|= [=build listeners=(list listener)] ^+ this
|
|
|
|
::
|
|
|
|
=^ result results.state (access-cache build)
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
?> ?=([~ %value *] result)
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
|
|
|
%_ this
|
|
|
|
moves
|
|
|
|
%+ roll listeners
|
|
|
|
|= [=listener moves=_moves]
|
|
|
|
::
|
|
|
|
:_ moves
|
|
|
|
:* duct.listener %give
|
|
|
|
%made date.build %complete build-result.u.result
|
|
|
|
==
|
|
|
|
==
|
2018-04-18 00:14:13 +03:00
|
|
|
:: +unlink-sub-builds
|
|
|
|
::
|
|
|
|
++ unlink-sub-builds
|
|
|
|
|= =build
|
2018-04-24 02:17:20 +03:00
|
|
|
^+ ..execute
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
|
|
|
=/ kids=(list ^build)
|
2018-05-01 01:15:25 +03:00
|
|
|
%~ tap in
|
2018-04-24 02:17:20 +03:00
|
|
|
%- ~(uni in (~(get ju sub-builds.components.state) build))
|
|
|
|
(~(get ju sub-builds.provisional-components.state) build)
|
|
|
|
::
|
|
|
|
=. components.state
|
2018-04-26 02:56:38 +03:00
|
|
|
(~(del-build by-build-dag components.state) build)
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
|
|
|
=. provisional-components.state
|
2018-04-26 02:56:38 +03:00
|
|
|
(~(del-build by-build-dag provisional-components.state) build)
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
|
|
|
%+ roll kids
|
|
|
|
|= [kid=^build accumulator=_..execute]
|
|
|
|
::
|
|
|
|
=. ..execute accumulator
|
|
|
|
(cleanup kid)
|
2018-04-28 01:32:06 +03:00
|
|
|
:: +advance-live-listeners: move live listeners from :old to :new
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
2018-04-28 01:32:06 +03:00
|
|
|
++ advance-live-listeners
|
2018-03-31 02:55:43 +03:00
|
|
|
|= [old=build new=build]
|
|
|
|
^+ state
|
|
|
|
::
|
|
|
|
=/ old-live-listeners=(list listener)
|
|
|
|
=- (skim - is-listener-live)
|
|
|
|
=- ~(tap in `(set listener)`(fall - ~))
|
|
|
|
(~(get by listeners.state) old)
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=/ old-root-listeners
|
|
|
|
~(tap in (fall (~(get by root-listeners.state) old) ~))
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-03-31 02:55:43 +03:00
|
|
|
=. state
|
2018-05-01 00:57:32 +03:00
|
|
|
%+ roll old-root-listeners
|
2018-03-31 02:55:43 +03:00
|
|
|
|= [=listener state=_state]
|
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
?. (is-listener-live listener)
|
|
|
|
state
|
2018-03-31 02:55:43 +03:00
|
|
|
%_ state
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
root-listeners
|
2018-03-31 02:55:43 +03:00
|
|
|
=- (~(put ju -) new listener)
|
2018-05-01 00:57:32 +03:00
|
|
|
(~(del ju root-listeners.state) old listener)
|
2018-04-24 02:17:20 +03:00
|
|
|
::
|
|
|
|
builds-by-listener
|
|
|
|
(~(put by builds-by-listener.state) duct.listener [new &])
|
2018-03-31 02:55:43 +03:00
|
|
|
==
|
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
%+ roll old-live-listeners
|
|
|
|
|= [=listener accumulator=_state]
|
|
|
|
=. state accumulator
|
|
|
|
:: if :listener ain't live, we wrote this wrong
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
?> live.listener
|
2018-04-18 00:14:13 +03:00
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
=. listeners.state (~(put ju listeners.state) new listener)
|
2018-03-31 02:55:43 +03:00
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
(remove-listener-from-build listener old)
|
2018-03-31 02:55:43 +03:00
|
|
|
:: +root-live-listeners: live listeners for which :build is the root build
|
|
|
|
::
|
|
|
|
++ root-live-listeners
|
|
|
|
|= =build
|
|
|
|
^- (list listener)
|
|
|
|
::
|
|
|
|
(skim (root-listeners build) is-listener-live)
|
|
|
|
:: +root-once-listeners: once listeners for which :build is the root build
|
|
|
|
::
|
|
|
|
++ root-once-listeners
|
|
|
|
|= =build
|
|
|
|
^- (list listener)
|
|
|
|
::
|
|
|
|
(skip (root-listeners build) is-listener-live)
|
|
|
|
:: +root-listeners: listeners for which :build is the root build
|
|
|
|
::
|
|
|
|
++ root-listeners
|
|
|
|
|= =build
|
|
|
|
^- (list listener)
|
|
|
|
::
|
|
|
|
=- ~(tap in `(set listener)`(fall - ~))
|
2018-05-01 00:57:32 +03:00
|
|
|
(~(get by root-listeners.state) build)
|
|
|
|
:: +is-build-blocked: is :build blocked on either builds or a resource?
|
2018-04-12 03:54:32 +03:00
|
|
|
::
|
|
|
|
++ is-build-blocked
|
|
|
|
|= =build
|
|
|
|
^- ?
|
|
|
|
::
|
|
|
|
?: (~(has by sub-builds.blocked-builds.state) build)
|
|
|
|
&
|
|
|
|
?. ?=(%scry -.schematic.build)
|
|
|
|
|
|
2018-05-01 00:57:32 +03:00
|
|
|
(~(has by blocks.state) resource.schematic.build build)
|
2018-04-18 00:14:13 +03:00
|
|
|
:: +is-build-cached:
|
|
|
|
::
|
|
|
|
++ is-build-cached
|
|
|
|
|= =build
|
|
|
|
^- ?
|
2018-05-01 00:57:32 +03:00
|
|
|
?=([~ %value *] (~(get by results.state) build))
|
2018-03-30 22:53:57 +03:00
|
|
|
:: +is-build-live: whether this is a live or a once build
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
|
|
|
++ is-build-live
|
2018-04-12 03:54:32 +03:00
|
|
|
|= =build
|
|
|
|
^- ?
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-03-30 22:53:57 +03:00
|
|
|
?: ?=(%pin -.schematic.build)
|
|
|
|
%.n
|
2018-04-25 00:44:41 +03:00
|
|
|
?: (has-pinned-client build)
|
2018-03-30 22:53:57 +03:00
|
|
|
%.n
|
|
|
|
:: check if :build has any live listeners
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=/ listeners ~(tap in (fall (~(get by listeners.state) build) ~))
|
|
|
|
?~ listeners
|
|
|
|
%.y
|
|
|
|
(lien `(list listener)`listeners is-listener-live)
|
2018-04-25 00:44:41 +03:00
|
|
|
:: +has-pinned-client: %.y if any of our ancestors are a %pin
|
|
|
|
::
|
|
|
|
++ has-pinned-client
|
|
|
|
|= =build
|
|
|
|
^- ?
|
|
|
|
:: iterate across all clients recursively, exiting early on %pin
|
|
|
|
::
|
2018-04-26 02:56:38 +03:00
|
|
|
=/ clients (~(get-clients by-build-dag components.state) build)
|
2018-04-25 00:44:41 +03:00
|
|
|
|-
|
|
|
|
?~ clients
|
|
|
|
%.n
|
|
|
|
?: ?=(%pin -.schematic.i.clients)
|
|
|
|
%.y
|
|
|
|
%_ $
|
|
|
|
clients
|
|
|
|
%+ weld t.clients
|
2018-04-26 02:56:38 +03:00
|
|
|
(~(get-clients by-build-dag components.state) i.clients)
|
2018-04-25 00:44:41 +03:00
|
|
|
==
|
2018-03-23 08:25:53 +03:00
|
|
|
:: +access-cache: access the +cache-line for :build, updating :last-accessed
|
|
|
|
::
|
|
|
|
:: Usage:
|
|
|
|
:: ```
|
|
|
|
:: =^ maybe-cache-line results.state (access-cache build)
|
|
|
|
:: ```
|
|
|
|
::
|
|
|
|
++ access-cache
|
|
|
|
|= =build
|
|
|
|
^- [(unit cache-line) _results.state]
|
|
|
|
::
|
|
|
|
=/ maybe-original=(unit cache-line) (~(get by results.state) build)
|
|
|
|
?~ maybe-original
|
|
|
|
[~ results.state]
|
|
|
|
::
|
|
|
|
=/ original=cache-line u.maybe-original
|
|
|
|
::
|
|
|
|
?: ?=(%tombstone -.original)
|
|
|
|
[`original results.state]
|
|
|
|
::
|
|
|
|
=/ mutant=cache-line original(last-accessed now)
|
|
|
|
::
|
|
|
|
[`mutant (~(put by results.state) build mutant)]
|
2018-04-18 00:14:13 +03:00
|
|
|
:: +finalize: convert per-event state to moves and persistent state
|
2018-03-21 21:10:54 +03:00
|
|
|
::
|
2018-03-22 04:27:25 +03:00
|
|
|
:: Converts :done-live-roots to %made +move's, performs +duct
|
2018-03-21 21:10:54 +03:00
|
|
|
:: accounting, and runs +cleanup on completed once builds and
|
|
|
|
:: stale live builds.
|
2018-03-16 12:34:40 +03:00
|
|
|
::
|
|
|
|
++ finalize
|
|
|
|
^- [(list move) ford-state]
|
2018-03-22 04:27:25 +03:00
|
|
|
:: once we're done, +flop :moves to put them in chronological order
|
2018-03-16 13:44:48 +03:00
|
|
|
::
|
2018-03-22 04:27:25 +03:00
|
|
|
=< [(flop moves) state]
|
2018-03-16 13:44:48 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=/ discs ~(tap in dirty-discs)
|
2018-03-16 13:44:48 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
|- ^+ this
|
|
|
|
?~ discs this
|
2018-03-20 00:08:31 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=* disc i.discs
|
2018-05-01 00:57:32 +03:00
|
|
|
:: resources: all resources on :disc
|
2018-03-16 13:44:48 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=/ resources=(set resource)
|
|
|
|
(fall (~(get by resources-by-disc.state) disc) ~)
|
|
|
|
:: if no resources on :disc, don't make a new clay subscription
|
2018-03-16 12:34:40 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
?~ resources
|
|
|
|
:: cancel clay subscriptions when we don't have any resources left
|
2018-03-22 04:27:25 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
?: (~(has in original-clay-subscriptions) disc)
|
|
|
|
=+ [their desk]=disc
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =note
|
2018-03-30 04:36:09 +03:00
|
|
|
:^ %c %warp sock=[our their]
|
|
|
|
^- riff:clay
|
|
|
|
[desk ~]
|
2018-03-22 04:27:25 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=. moves :_ moves
|
|
|
|
^- move
|
|
|
|
[duct=~ [%pass wire=(clay-sub-wire disc) note]]
|
2018-03-22 04:27:25 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=. clay-subscriptions.state (~(del in clay-subscriptions.state) disc)
|
|
|
|
::
|
|
|
|
=. latest-by-disc.state (~(del by latest-by-disc.state) disc)
|
|
|
|
::
|
|
|
|
$(discs t.discs)
|
2018-03-22 04:27:25 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
$(discs t.discs)
|
|
|
|
:: prevent thrashing; don't unsubscribe then immediately resubscribe
|
|
|
|
::
|
|
|
|
:: When we send a request to a foreign ship, that ship may have
|
|
|
|
:: started responding before we send a cancellation. In that case,
|
2018-04-28 01:32:06 +03:00
|
|
|
:: canceling and then resubscribing might cause the foreign ship
|
2018-03-30 04:36:09 +03:00
|
|
|
:: to send the response twice, which would be extra network traffic.
|
|
|
|
::
|
|
|
|
?: ?& (~(has in original-clay-subscriptions) disc)
|
|
|
|
::
|
|
|
|
(~(has in clay-subscriptions.state) disc)
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
.= (~(get by original-resources-by-disc) disc)
|
|
|
|
(~(get by resources-by-disc.state) disc)
|
2018-03-22 04:27:25 +03:00
|
|
|
==
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
$(discs t.discs)
|
|
|
|
:: request-contents: the set of [care path]s to subscribe to in clay
|
|
|
|
::
|
|
|
|
=/ request-contents=(set [care:clay path])
|
|
|
|
%- sy ^- (list [care:clay path])
|
2018-05-01 00:57:32 +03:00
|
|
|
%+ murn ~(tap in `(set resource)`resources)
|
|
|
|
|= =resource ^- (unit [care:clay path])
|
2018-03-22 23:30:44 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
?. ?=(%c -.resource) ~
|
2018-03-22 04:27:25 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
`[care.resource (flop spur.rail.resource)]
|
2018-03-30 04:36:09 +03:00
|
|
|
:: if :request-contents is `~`, this code is incorrect
|
|
|
|
::
|
|
|
|
?< ?=(~ request-contents)
|
|
|
|
:: their: requestee +ship
|
|
|
|
::
|
|
|
|
=+ [their desk]=disc
|
|
|
|
=/ latest-date (~(got by latest-by-disc.state) disc)
|
|
|
|
::
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =note
|
2018-03-30 04:36:09 +03:00
|
|
|
:^ %c %warp sock=[our their]
|
|
|
|
^- riff:clay
|
|
|
|
[desk `[%mult case=[%da latest-date] request-contents]]
|
|
|
|
::
|
|
|
|
=. moves :_ moves
|
2018-03-22 04:27:25 +03:00
|
|
|
^- move
|
2018-03-30 04:36:09 +03:00
|
|
|
[duct=~ [%pass wire=(clay-sub-wire disc) note]]
|
|
|
|
::
|
|
|
|
=. clay-subscriptions.state (~(put in clay-subscriptions.state) disc)
|
2018-03-16 13:44:48 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
$(discs t.discs)
|
2018-03-17 02:17:59 +03:00
|
|
|
:: +cleanup: try to clean up a build and its sub-builds
|
|
|
|
::
|
|
|
|
++ cleanup
|
|
|
|
|= =build
|
2018-03-30 04:36:09 +03:00
|
|
|
^+ this
|
2018-04-18 00:14:13 +03:00
|
|
|
:: does this build even exist?!
|
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
?. (~(has ju by-date.builds.state) date.build schematic.build)
|
2018-04-18 00:14:13 +03:00
|
|
|
this
|
2018-03-17 02:17:59 +03:00
|
|
|
::
|
|
|
|
:: if something depends on this build, no-op and return
|
|
|
|
::
|
2018-03-20 04:03:18 +03:00
|
|
|
?: ?| (~(has by client-builds.components.state) build)
|
2018-04-24 02:17:20 +03:00
|
|
|
(~(has by client-builds.provisional-components.state) build)
|
2018-03-20 00:15:39 +03:00
|
|
|
(~(has by old.rebuilds.state) build)
|
2018-03-17 02:17:59 +03:00
|
|
|
(~(has by listeners.state) build)
|
|
|
|
==
|
2018-04-25 00:44:41 +03:00
|
|
|
:: ~& :* %cleanup-no-op
|
|
|
|
:: build=(build-to-tape build)
|
|
|
|
:: has-client-builds=(~(has by client-builds.components.state) build)
|
|
|
|
:: has-provisional=(~(has by client-builds.provisional-components.state) build)
|
|
|
|
:: has-old-rebuilds=(~(has by old.rebuilds.state) build)
|
|
|
|
:: listeners=(~(get by listeners.state) build)
|
|
|
|
:: ==
|
2018-03-30 04:36:09 +03:00
|
|
|
this
|
2018-04-25 00:44:41 +03:00
|
|
|
:: ~& [%cleaning-up (build-to-tape build)]
|
2018-03-17 02:17:59 +03:00
|
|
|
:: remove :build from :state, starting with its cache line
|
|
|
|
::
|
|
|
|
=. results.state (~(del by results.state) build)
|
2018-04-26 23:53:16 +03:00
|
|
|
:: remove :build from the list of attempted builds
|
2018-03-17 02:17:59 +03:00
|
|
|
::
|
2018-04-26 23:53:16 +03:00
|
|
|
=. builds.state (~(del by-builds builds.state) build)
|
2018-05-01 00:57:32 +03:00
|
|
|
:: if no more builds at this date, remove the date from :resource-updates
|
2018-03-17 02:17:59 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=? resource-updates.state
|
2018-04-26 23:53:16 +03:00
|
|
|
!(~(has by by-date.builds.state) date.build)
|
2018-05-01 00:57:32 +03:00
|
|
|
(~(del by resource-updates.state) date.build)
|
2018-03-19 21:23:04 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=? blocks.state
|
|
|
|
::
|
|
|
|
?=(%scry -.schematic.build)
|
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
=/ =scry-request
|
|
|
|
=, resource.schematic.build
|
|
|
|
[vane care `beam`[[ship.disc.rail desk.disc.rail [%da date.build]] spur.rail]]
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
(~(del ju blocks.state) scry-request build)
|
2018-05-01 00:57:32 +03:00
|
|
|
:: check if :build depends on a live clay +resource
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=/ has-live-resource ?=([%scry %c *] schematic.build)
|
2018-03-30 04:36:09 +03:00
|
|
|
:: clean up dependency tracking and maybe cancel clay subscription
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=? this has-live-resource
|
2018-03-30 04:36:09 +03:00
|
|
|
:: type system didn't know, so tell it again
|
|
|
|
::
|
2018-03-30 23:21:08 +03:00
|
|
|
?> ?=([%scry %c *] schematic.build)
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =resource resource.schematic.build
|
|
|
|
=/ =disc (extract-disc resource)
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=/ should-delete-resource=?
|
|
|
|
:: checks if there are other live builds of this resource
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
|
|
|
=/ dates=(list @da)
|
2018-04-26 23:53:16 +03:00
|
|
|
(fall (~(get by by-schematic.builds.state) schematic.build) ~)
|
2018-03-30 04:36:09 +03:00
|
|
|
?!
|
|
|
|
%+ lien dates
|
|
|
|
|= date=@da
|
|
|
|
^- ?
|
|
|
|
=/ other-build [date schematic.build]
|
|
|
|
=/ listeners=(set listener)
|
2018-04-18 00:14:13 +03:00
|
|
|
(fall (~(get by listeners.state) other-build) ~)
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
|
|
|
(lien ~(tap in listeners) is-listener-live)
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=? resources-by-disc.state should-delete-resource
|
|
|
|
(~(del ju resources-by-disc.state) disc resource)
|
2018-03-30 04:36:09 +03:00
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
=? dirty-discs should-delete-resource
|
2018-03-30 04:36:09 +03:00
|
|
|
(~(put in dirty-discs) disc)
|
|
|
|
::
|
|
|
|
this
|
2018-04-24 02:17:20 +03:00
|
|
|
:: this also recurses on our children
|
2018-03-17 02:17:59 +03:00
|
|
|
::
|
2018-04-24 02:17:20 +03:00
|
|
|
=. ..execute (unlink-sub-builds build)
|
2018-03-17 02:17:59 +03:00
|
|
|
:: if there is a newer rebuild of :build, delete the linkage
|
|
|
|
::
|
2018-03-20 00:15:39 +03:00
|
|
|
=/ rebuild (~(get by new.rebuilds.state) build)
|
2018-03-17 02:17:59 +03:00
|
|
|
=? rebuilds.state ?=(^ rebuild)
|
|
|
|
%_ rebuilds.state
|
2018-03-20 00:15:39 +03:00
|
|
|
new (~(del by new.rebuilds.state) build)
|
2018-04-18 00:14:13 +03:00
|
|
|
old (~(del by old.rebuilds.state) u.rebuild)
|
2018-03-17 02:17:59 +03:00
|
|
|
==
|
2018-04-25 21:16:27 +03:00
|
|
|
:: if we have a :newer-build, clean it up too
|
2018-03-17 02:17:59 +03:00
|
|
|
::
|
2018-04-25 21:16:27 +03:00
|
|
|
=/ newer-build
|
2018-04-26 23:53:16 +03:00
|
|
|
(~(find-next by-schematic by-schematic.builds.state) build)
|
2018-04-25 21:16:27 +03:00
|
|
|
::
|
|
|
|
?~ newer-build
|
2018-03-30 04:36:09 +03:00
|
|
|
this
|
2018-04-25 21:16:27 +03:00
|
|
|
::
|
|
|
|
(cleanup u.newer-build)
|
2018-03-30 04:36:09 +03:00
|
|
|
:: +clay-sub-wire: the wire to use for a clay subscription
|
|
|
|
::
|
|
|
|
++ clay-sub-wire
|
|
|
|
|= =disc ^- wire
|
|
|
|
::
|
|
|
|
=+ [their desk]=disc
|
2018-03-17 02:17:59 +03:00
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
/(scot %p our)/clay-sub/(scot %p their)/[desk]
|
2018-03-16 03:21:46 +03:00
|
|
|
--
|
|
|
|
--
|
|
|
|
::
|
|
|
|
:: end =~
|
|
|
|
::
|
|
|
|
. ==
|
|
|
|
=, ford-api :: TODO remove once in vane
|
|
|
|
::
|
|
|
|
:::: vane core
|
|
|
|
::
|
|
|
|
=| axle
|
|
|
|
|= [now=@da eny=@ scry=sley]
|
|
|
|
:: allow jets to be registered within this core
|
|
|
|
::
|
|
|
|
~% %ford-d ..is ~ :: XX why the '-d'?
|
|
|
|
::
|
|
|
|
:: ^? :: to be added to real vane
|
|
|
|
::
|
|
|
|
|%
|
|
|
|
:: +call: handle a +task:able from arvo
|
|
|
|
::
|
|
|
|
++ call
|
|
|
|
|= [=duct type=* wrapped-task=(hobo task:able)]
|
2018-03-21 01:39:22 +03:00
|
|
|
^- [(list move) _this]
|
|
|
|
:: unwrap :task from :wrapped-task
|
2018-03-16 03:21:46 +03:00
|
|
|
::
|
|
|
|
=/ task=task:able
|
|
|
|
?. ?=(%soft -.wrapped-task)
|
|
|
|
wrapped-task
|
|
|
|
((hard task:able) p.wrapped-task)
|
|
|
|
::
|
|
|
|
?- -.task
|
|
|
|
:: %make: request to perform a build
|
|
|
|
::
|
|
|
|
%make
|
|
|
|
:: perform the build indicated by :task
|
|
|
|
::
|
|
|
|
:: First, we find or create the :ship-state for :our.task,
|
|
|
|
:: modifying :state-by-ship as necessary. Then we dispatch to the |ev
|
2018-03-21 21:10:54 +03:00
|
|
|
:: by constructing :event-args and using them to create :start-build,
|
|
|
|
:: which performs the build. The result of :start-build is a pair of
|
2018-03-16 03:21:46 +03:00
|
|
|
:: :moves and a mutant :ship-state. We update our :state-by-ship map
|
|
|
|
:: with the new :ship-state and produce it along with :moves.
|
|
|
|
::
|
|
|
|
=^ ship-state state-by-ship (find-or-create-ship-state our.task)
|
2018-03-16 04:38:33 +03:00
|
|
|
=* event-args [[our.task duct now scry] ship-state]
|
2018-03-30 04:36:09 +03:00
|
|
|
=* start-build start-build:(per-event event-args)
|
|
|
|
=^ moves ship-state (start-build schematic.task)
|
2018-03-16 03:21:46 +03:00
|
|
|
=. state-by-ship (~(put by state-by-ship) our.task ship-state)
|
|
|
|
::
|
|
|
|
[moves this]
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
:: %kill: cancel a %make
|
|
|
|
::
|
|
|
|
%kill
|
|
|
|
::
|
|
|
|
=/ ship-state ~|(our+our.task (~(got by state-by-ship) our.task))
|
|
|
|
=* event-args [[our.task duct now scry] ship-state]
|
|
|
|
=^ moves ship-state cancel:(per-event event-args)
|
|
|
|
=. state-by-ship (~(put by state-by-ship) our.task ship-state)
|
|
|
|
::
|
|
|
|
[moves this]
|
2018-03-16 03:21:46 +03:00
|
|
|
::
|
2018-05-01 20:55:05 +03:00
|
|
|
:: %wipe: wipe the cache, clearing half the entries
|
|
|
|
::
|
|
|
|
%wipe
|
|
|
|
::
|
|
|
|
=/ ship-states=(list [@p ford-state]) ~(tap by state-by-ship)
|
|
|
|
:: wipe each ship in the state separately
|
|
|
|
::
|
|
|
|
=. state-by-ship
|
|
|
|
%+ roll ship-states
|
|
|
|
|= [[ship=@p state=ford-state] accumulator=(map @p ford-state)]
|
|
|
|
::
|
|
|
|
(~(put by accumulator) ship (wipe state))
|
|
|
|
::
|
|
|
|
[~ this]
|
2018-03-16 03:21:46 +03:00
|
|
|
::
|
|
|
|
%wegh !!
|
|
|
|
==
|
2018-05-01 20:55:05 +03:00
|
|
|
:: +wipe: wipe half a +ford-state's cache, in LRU (least recently used) order
|
|
|
|
::
|
|
|
|
++ wipe
|
|
|
|
|= state=ford-state
|
|
|
|
^+ state
|
|
|
|
::
|
|
|
|
=/ cache-list=(list [build cache-line]) ~(tap by results.state)
|
|
|
|
::
|
|
|
|
=/ split-cache=[(list [build cache-line]) (list [build cache-line])]
|
|
|
|
%+ skid cache-list
|
|
|
|
|=([=build =cache-line] ?=(%tombstone -.cache-line))
|
|
|
|
::
|
|
|
|
=/ tombstones=(list [build cache-line]) -.split-cache
|
|
|
|
=/ values=(list [build cache-line]) +.split-cache
|
|
|
|
:: sort the cache lines in chronological order by :last-accessed
|
|
|
|
::
|
|
|
|
=/ sorted=(list [build cache-line])
|
|
|
|
%+ sort values
|
|
|
|
|= [a=[=build =cache-line] b=[=build =cache-line]]
|
|
|
|
^- ?
|
|
|
|
::
|
|
|
|
?> ?=(%value -.cache-line.a)
|
|
|
|
?> ?=(%value -.cache-line.b)
|
|
|
|
::
|
|
|
|
(lte last-accessed.cache-line.a last-accessed.cache-line.b)
|
|
|
|
::
|
|
|
|
=/ num-entries=@ (lent cache-list)
|
|
|
|
:: num-stale: half of :num-entries, rounded up in case :num-entries is 1
|
|
|
|
::
|
|
|
|
=/ num-stale (sub num-entries (div num-entries 2))
|
|
|
|
~& "ford: wipe: {<num-stale>} cache entries"
|
|
|
|
::
|
|
|
|
=/ stale=(list [build cache-line]) (scag num-stale sorted)
|
|
|
|
=/ fresh=(list [build cache-line]) (slag num-stale sorted)
|
|
|
|
::
|
|
|
|
=/ stale-tombstones=(list [build cache-line])
|
|
|
|
%+ turn stale
|
|
|
|
|= [=build =cache-line]
|
|
|
|
^+ +<
|
|
|
|
[build [%tombstone ~]]
|
|
|
|
::
|
|
|
|
=| results=(map build cache-line)
|
|
|
|
::
|
|
|
|
=. results (~(gas by results) tombstones)
|
|
|
|
=. results (~(gas by results) stale-tombstones)
|
|
|
|
=. results (~(gas by results) fresh)
|
|
|
|
::
|
|
|
|
state(results results)
|
2018-03-21 01:39:22 +03:00
|
|
|
:: +take: receive a response from another vane
|
|
|
|
::
|
|
|
|
++ take
|
|
|
|
|= [=wire =duct wrapped-sign=(hypo sign)]
|
|
|
|
^- [(list move) _this]
|
|
|
|
:: unwrap :sign from :wrapped-sign
|
|
|
|
::
|
|
|
|
:: TODO: verify wrapped-sign isn't an evil vase?
|
|
|
|
::
|
2018-05-01 01:15:25 +03:00
|
|
|
=/ =sign q.wrapped-sign
|
2018-03-21 04:20:11 +03:00
|
|
|
:: TODO: support other responses
|
|
|
|
::
|
2018-05-01 00:57:32 +03:00
|
|
|
:: parse :wire into :our, :ship-state, and :resource
|
2018-03-21 01:39:22 +03:00
|
|
|
::
|
|
|
|
?> ?=([@ @ *] wire)
|
2018-03-21 21:10:54 +03:00
|
|
|
:: we know :our is already in :state-by-ship because we sent this request
|
|
|
|
::
|
2018-03-22 23:30:44 +03:00
|
|
|
=/ our=@p (slav %p i.wire)
|
|
|
|
=/ ship-state ~|(our+our (~(got by state-by-ship) our))
|
|
|
|
=* event-args [[our duct now scry] ship-state]
|
|
|
|
:: %clay-sub: response to a clay %mult subscription
|
2018-03-21 01:39:22 +03:00
|
|
|
::
|
2018-03-22 23:30:44 +03:00
|
|
|
=^ moves ship-state
|
|
|
|
?: =(%clay-sub i.t.wire)
|
|
|
|
::
|
|
|
|
?> ?=([%c %wris *] sign)
|
|
|
|
=+ [ship desk]=(raid:wired t.t.wire ~[%p %tas])
|
|
|
|
::
|
2018-03-30 04:36:09 +03:00
|
|
|
=* rebuild rebuild:(per-event event-args)
|
2018-05-10 21:18:52 +03:00
|
|
|
(rebuild ship desk case.sign care-paths.sign)
|
2018-05-01 00:57:32 +03:00
|
|
|
:: %resource: response to a request for a +resource
|
2018-03-22 23:30:44 +03:00
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
?. =(%scry-request i.t.wire)
|
2018-03-22 23:30:44 +03:00
|
|
|
::
|
2018-04-05 03:11:21 +03:00
|
|
|
~|(unknown-take+i.t.wire !!)
|
|
|
|
::
|
|
|
|
?> ?=([%c %writ *] sign)
|
2018-05-08 00:31:24 +03:00
|
|
|
:: scry-request: the +scry-request we had previously blocked on
|
2018-04-05 03:11:21 +03:00
|
|
|
::
|
2018-05-08 00:31:24 +03:00
|
|
|
=/ =scry-request
|
|
|
|
~| [%bad-scry-request wire]
|
|
|
|
(need (path-to-scry-request t.t.wire))
|
2018-04-05 03:11:21 +03:00
|
|
|
:: scry-result: parse a (unit cage) from :sign
|
|
|
|
::
|
|
|
|
:: If the result is `~`, the requested resource was not available.
|
|
|
|
::
|
|
|
|
=/ scry-result=(unit cage)
|
|
|
|
?~ riot.sign
|
|
|
|
~
|
|
|
|
`r.u.riot.sign
|
2018-05-01 00:57:32 +03:00
|
|
|
:: unblock the builds that had blocked on :resource
|
2018-03-22 23:30:44 +03:00
|
|
|
::
|
2018-04-05 03:11:21 +03:00
|
|
|
=* unblock unblock:(per-event event-args)
|
2018-05-08 00:31:24 +03:00
|
|
|
(unblock scry-request scry-result)
|
2018-03-21 01:39:22 +03:00
|
|
|
::
|
|
|
|
=. state-by-ship (~(put by state-by-ship) our ship-state)
|
|
|
|
::
|
|
|
|
[moves this]
|
2018-03-16 03:21:46 +03:00
|
|
|
:: %utilities
|
|
|
|
::
|
|
|
|
::+|
|
|
|
|
::
|
|
|
|
++ this .
|
2018-03-16 14:09:14 +03:00
|
|
|
:: +find-or-create-ship-state: find or create a ford-state for a @p
|
|
|
|
::
|
|
|
|
:: Accesses and modifies :state-by-ship.
|
2018-03-16 03:21:46 +03:00
|
|
|
::
|
|
|
|
++ find-or-create-ship-state
|
|
|
|
|= our=@p
|
|
|
|
^- [ford-state _state-by-ship]
|
2018-03-16 14:09:14 +03:00
|
|
|
::
|
2018-03-16 03:21:46 +03:00
|
|
|
=/ existing (~(get by state-by-ship) our)
|
2018-03-16 14:09:14 +03:00
|
|
|
?^ existing
|
|
|
|
[u.existing state-by-ship]
|
|
|
|
::
|
|
|
|
=| new-state=ford-state
|
|
|
|
[new-state (~(put by state-by-ship) our new-state)]
|
2018-03-16 03:21:46 +03:00
|
|
|
--
|