~/bend-docscommunity

src/add/relock.bend checks

raw source on the hub · import ezx@1.18.0.0/src/add/relock.bend as Relock

add/relock: ez add as it runs, the add and the lock in one plan (laws/AddRemoveRelock.bend). The add is planned as before (AP.command, add/plan.bend); once it is known to succeed, the plain ez lock planner is run over the World it leaves (R.world, relock/relock.bend): the ledger the add writes, the .bend files git lists, and the lock's answers. The package the add walked is handed to the lock as the answer for its hash, read as a tree under BEND_LIB, which is where the add lays it, so it is not read twice; a hub package's answers are the ones the add was given. Every other package the lock asks about is answered by the lock's interpreter as ez lock answers it.

The plan, when both succeed: the add's effects, a note when the lock does not hold the package added (laws/AddNotesUnlockedPackage.bend), then the lock's effects, the lock last. When either refuses, a refusal with no effect at all.

11 imports
import Base
import ./world.bend as A
import ./plan.bend as AP
import ./hub.bend as H
import ../lock/plan.bend as P
import ../lock/world.bend as W
import ../lock/up.bend as Up
import ../lock/lock.bend as L
import ../ledger/manifest.bend as M
import ../pkg/pkg.bend as K
import ../relock/relock.bend as R

Types

type World source · line 30 · raw

Data

what ez add reads: the add's World, the .bend files git lists, and the answers to the lock's questions

type Next source · line 195 · raw

Data

what the interpreter does next: answer git's questions or the hub's for the add, answer the lock's, or run the plan

Definitions

def add source · line 34 · raw

@world:World -> 0x2414c9622cab2353684d02a392804eb1/src/add/world.World

the add's World

def found.pick source · line 43 · raw

@hit:Bool -> @body:String -> @rest:(@_:Unit -> String) -> String

this file's text when it is the one at the path, else the rest's. The rest arrives as a thunk, so the first hit ends the scan.

def text.at source · line 51 · raw

@fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Source> -> @+at:String -> String

the text of the file at a path among a walk's files, "" when none is there

def texts source · line 59 · raw

@+fs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Source> -> @items:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Item> -> List<&2, String>

the text of each file a manifest names, in its order

def seed.of source · line 70 · raw

@walk:0x2414c9622cab2353684d02a392804eb1/src/pkg/pkg.Walked -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Reply>

the package a walk made, as the answer to the lock's question about its hash: its manifest and the text of each file it names, read as a tree under BEND_LIB, which is where the add lays it. The lock checks it as it checks any tree there. A walk that made no package answers nothing.

def seeds.of source · line 83 · raw

@named:Bool -> @+aw:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Reply>

the answers the add already has for the lock: a hub package's are those the hub gave the add, and a git package's is the package its walk made

def seeds source · line 91 · raw

@+aw:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Reply>

the answers the add already has for the lock, on the add's World

def lock.world source · line 97 · raw

@world:World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/world.World

the World a plain ez lock reads once the add has run: the ledger it writes, the .bend files git lists, and the answers it was given, the add's first

def lock source · line 103 · raw

@world:World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

the plan of that lock

def added.of source · line 110 · raw

@named:Bool -> @+aw:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> String

the hash of the package the add records

def added source · line 118 · raw

@+aw:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> String

the hash of the package the add records, on the add's World

def held source · line 122 · raw

@ps:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/lock.Pack> -> @+hash:String -> Bool

whether the lock holds a package under the hash

def unlocked source · line 130 · raw

@+hash:String -> String

the line that says the lock does not hold it

def notes.of source · line 135 · raw

@held:Bool -> @+hash:String -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect>

the note: the line when the lock does not hold the package, none when it does

def notes source · line 143 · raw

@+world:World -> List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Effect>

the note on a World

def moved.of source · line 152 · raw

@moved:Bool -> @+name:String -> @+old:String -> @+new:String -> String

what is added after the lock's reason when the lock refuses: that nothing was written, and, when the add moves a dependency's hash, where the old one may still be imported from

def tail.dep source · line 161 · raw

@+dep:0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Dep -> @+old:0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Dep -> String

def dep.of source · line 168 · raw

@named:Bool -> @+aw:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> 0x2414c9622cab2353684d02a392804eb1/src/ledger/manifest.Dep

the dependency the add records

def tail source · line 176 · raw

@+aw:0x2414c9622cab2353684d02a392804eb1/src/add/world.World -> String

what is added after the lock's reason, on the add's World

def plan source · line 181 · raw

@world:World -> 0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Plan

ez add over a World: the add, then the lock over what it leaves

def refuses source · line 187 · raw

@world:World -> Bool

whether ez add refuses on a World

def next.lock source · line 202 · raw

@st:0x2414c9622cab2353684d02a392804eb1/src/lock/plan.Step -> @+world:World -> Next

the lock's step, once the add is planned and succeeds

def next.made source · line 210 · raw

@refused:Bool -> @+world:World -> Next

the add's plan made: refused, it is the plan; otherwise the lock is next

def next.add source · line 217 · raw

@nx:0x2414c9622cab2353684d02a392804eb1/src/add/plan.Next -> @+world:World -> Next

def next source · line 227 · raw

@+world:World -> Next

what the interpreter does next on a World

def more source · line 231 · raw

@world:World -> @rs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/up.Reply> -> World

the World with more of git's answers in the add's World

def more.hub source · line 236 · raw

@world:World -> @rs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Reply> -> World

the World with more of the hub's answers in the add's World

def more.lock source · line 241 · raw

@world:World -> @rs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/lock/world.Reply> -> World

the World with more of the lock's answers in it