src/add/hub.bend checks
raw source on the hub · import ezx@1.18.0.0/src/add/hub.bend as Hub
add/hub: ez add <name>@<version> as a pure planner, for a target bend
reads as a hub package's name (Tgt.aim). It reads the same World as the
git planner (add/world.bend), and asks the lock's own questions of the hub
the ledger names (lock/world.bend): what the name names (W.Name), then
that package's manifest and files (W.Pkg). Their answers are the World's
hubs.
Before it asks anything the planner refuses what needs no answer: no
ledger, one that does not parse, a ref and an entry both given (a name pins
its version, so the word after it is the entry), and a key the ledger
alone refuses (Named.hub.why). Then it asks at most two rounds: the name,
then the package it names. The hub's answer must be a 0x name, and the
package is judged as ez lock judges a hub package (W.hub.how): its
manifest hashes to that name, no path leaves it, each file hashes to its
sum, and the files hash to the name (laws/LaidTreeNamedByManifest.bend).
With the package in hand, the entry is the one given, which the package
must hold, else its main.bend, else its first top-level .bend file in
manifest order, else none. The key is Named.hub.key's: --rename, else
the key the ledger gives this name part, else the name part itself. The
plan of an add that succeeds, in order: the tree laid under $BEND_LIB;
the name's file, $BEND_LIB/names/<name>@<version>, so bend reads the name
without asking the hub; ez.toml written with [deps.<key>] holding hub
and hash; .gitignore when the allowlist changes; and the lines a person
is told, the hash the name names and, when there is an entry, the import
line. A refusal has no effect at all. ez add writes no lock, for a name
as for a git package: the next ez lock reads the name from ez.toml and
asks the hub nothing (laws/ResolvedNotAsked.bend).
12 imports
import Base import ./world.bend as A import ../lock/plan.bend as P import ../lock/world.bend as W import ../lock/lock.bend as L import ../ledger/manifest.bend as M import ../ledger/render.bend as Rend import ../ledger/ignore.bend as I import ../pkg/pkg.bend as K import ../pkg/path.bend as Path import ../git/git.bend as Git import ../ez/named.bend as Named
Types
type Verdict source · line 85 · raw
Data
every answer is in, with the hash the hub named and the package it serves checked against it; a question is still open; or the add refuses
Go@hash:String -> @files:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> @srcs:List<&2, String> -> Verdict
Pending@asks:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Ask> -> Verdict
Stop@why:String -> Verdict
Definitions
def nv source · line 46 · raw
@world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> String
the <name>@<version> asked for
def part source · line 50 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> String
its name part, which a re-add of another version finds its entry by
def key source · line 54 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> String
the key the dependency is recorded under (laws/DependencyNameChosen.bend)
def asked source · line 59 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> String
the entry asked for: the word after the name. A name pins its version, so that word is the entry, whichever place it was given in.
def heard.at source · line 64 · raw
@hit:Bool -> @answer:0x2414c9622cab2353684d02a392804eb1/src/lock/world.Answer -> @rest:(@_:Unit -> Maybe<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Answer>) -> Maybe<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Answer>
this reply's answer when it is about the key, else the rest's. The rest arrives as a thunk, so the first answer ends the scan.
def heard source · line 73 · raw
@rs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Reply> -> @+key:String -> Maybe<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Answer>
the answer the World holds for a question about this key: a name, or a package's hash
def decide.body source · line 91 · raw
@verdict:0x2414c9622cab2353684d02a392804eb1/src/lock/world.Verdict -> @+hash:String -> Verdict
the package, judged as the lock judges a hub package
def decide.got source · line 101 · raw
@answer:0x2414c9622cab2353684d02a392804eb1/src/lock/world.Answer -> @+hash:String -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> Verdict
the package the hub served for the hash, or why it served none
def decide.pkg source · line 111 · raw
@got:Maybe<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Answer> -> @+hash:String -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> Verdict
the package, once it is asked for
def decide.hash source · line 119 · raw
@ok:Bool -> @+hash:String -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> Verdict
a 0x name the hub answered, or an answer that names none
def unsaid source · line 128 · raw
@ez:Bool -> @+why:String -> String
why the hub gave no answer, without the ez: a miss is said with
def decide.said source · line 136 · raw
@answer:0x2414c9622cab2353684d02a392804eb1/src/lock/world.Answer -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> Verdict
what the hub said the name names
def decide.name source · line 148 · raw
@got:Maybe<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Answer> -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> Verdict
the name, once it is asked of the hub
def early source · line 157 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> String
why the add is refused before anything is asked, "" when it is not: a ref and an entry both given, or a key the ledger refuses
def decide.early source · line 165 · raw
@ok:Bool -> @+why:String -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> Verdict
a refusal the ledger alone decides
def decide.read source · line 174 · raw
@read:0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Read -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> Verdict
no ledger, or one that does not parse, is refused before anything else, with the reason every command that edits a ledger gives
def decide source · line 183 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> Verdict
where a World stands
def holds source · line 190 · raw
@fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> @+at:String -> Bool
whether a package holds a file at this path
def top.one source · line 199 · raw
@+at:String -> Bool
a top-level .bend file: one with no directory in front of it
def top.at source · line 204 · raw
@hit:Bool -> @+at:String -> @rest:(@_:Unit -> String) -> String
this file when it is a top-level .bend file, else the rest's. The rest
arrives as a thunk, so the first one ends the scan.
def top source · line 212 · raw
@fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> String
the first top-level .bend file, in manifest order, "" for none
def entry.main source · line 220 · raw
@held:Bool -> @fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> String
main.bend when the package holds one, else its first top-level file
def entry.of source · line 229 · raw
@+fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> String
the entry a package is recorded with when none was asked for: its
main.bend, else its first top-level .bend file, else none
def entry.pick source · line 233 · raw
@none:Bool -> @+fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> @+asked:String -> String
the entry asked for, or, when none was, the package's own
def entry source · line 241 · raw
@+fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> String
the entry recorded: the one asked for, else the package's own
def dep.of source · line 248 · raw
@+hash:String -> @+fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> 0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Dep
the dependency recorded for a package the hub named by this hash
def outcome.fit source · line 254 · raw
@fit:Bool -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Outcome
the ledger with the package added, once it is known to read back. A ledger that could not be written so that it reads back is refused (laws/WrittenLedgerReadsBack.bend).
def outcome.entry source · line 262 · raw
@held:Bool -> @fit:Bool -> @+at:String -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Outcome
an entry asked for must be in the package
def outcome.of source · line 270 · raw
@+hash:String -> @+fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Outcome
how an add ends once the package is in hand
def place.of source · line 278 · raw
@vend:Bool -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Place
where the tree is laid: under .ez/lib when the entry it replaces is
vendored, under BEND_LIB otherwise. A hub dependency is never vendored, so
a name the ledger already records is laid under BEND_LIB like a new one.
def ignore.put source · line 286 · raw
@same:Bool -> @+next:String -> @rest:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect> -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect>
.gitignore written ahead of the rest when the allowlist changes it
def says source · line 296 · raw
@+hash:String -> @+entry:String -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect>
the lines a person is told: the hash the name names, then, when there is
an entry, the import line for it, the line ez publish prints with the
name in place of the hash
def effects.of source · line 303 · raw
@+dep:0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Dep -> @+hash:String -> @+ls:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Source> -> @+manifest:0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Manifest -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect>
what an add of a package the hub served does: the tree laid, its name's
file, ez.toml written, .gitignore when the allowlist changes, and what a
person is told
def seal source · line 320 · raw
@es:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect> -> @outcome:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Outcome -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan
a plan that refuses has no effect at all; its reason is how it ends
def made source · line 328 · raw
@+hash:String -> @+fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> @+ss:List<&2, String> -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan
the plan once the package is in hand
def plan.v source · line 335 · raw
@verdict:Verdict -> @+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan
the plan for where the World stands. One that still asks is a World the interpreter did not finish, and is refused rather than guessed at.
def plan source · line 345 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan
ez add <name>@<version> over a World
def asks.v source · line 349 · raw
@verdict:Verdict -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Ask>
the questions still open where the World stands
def wants source · line 359 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Ask>
the questions a World still leaves open
def refuses.plan source · line 366 · raw
@pl:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> Bool
whether a plan ends in a refusal
def refuses source · line 375 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> Bool
whether ez add <name>@<version> refuses on a World
def verdict.hash source · line 379 · raw
@verdict:Verdict -> String
the hash and files a verdict carries, none when it carries no package
def verdict.files source · line 388 · raw
@verdict:Verdict -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item>
def hash source · line 398 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> String
the hash the hub named, as the World answered it
def files source · line 402 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item>
the package's files, as the hub served them
def added source · line 406 · raw
@+world:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> 0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Dep
the dependency ez add <name>@<version> records on a World
def ask.hub source · line 410 · raw
@ask:0x2414c9622cab2353684d02a392804eb1/src/lock/world.Ask -> String
the hub a question names
def asks.hub source · line 420 · raw
@as:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Ask> -> @+hub:String -> Bool
whether every question names this hub
def last.go source · line 429 · raw
@ls:List<&2, String> -> @+prev:String -> String
the last of some lines, prev when there are none after it
def last source · line 437 · raw
@pl:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan -> String
the last line a plan says, "" when it says none
def names.laid source · line 441 · raw
@es:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect> -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/lock.Name>
every name's file a list of effects lays, in order