~/bend-docscommunity

src/fetch/run.bend fails

raw source on the hub · import 0x74799d3f846634a3d7461d4336d7c9d4/src/fetch/run.bend as Run

fetch/run: the interpreter for ez fetch. It reads whether there is an ez.toml and the lock's text into a World, with the directory they are in, then loops: it asks the planner (fetch/plan.bend) what is still open, answers each question, and adds the answers to the World, until nothing is left to ask. Then it runs the planner's plan with the lock's effect runner (Run.exec.plan), which lays each tree and exits 1 with the reason when the plan refuses. A tree under BEND_LIB is read here as the lock reads one (Run.answer.lib), a hub package is fetched as the lock fetches one (Run.answer), and a checkout is made as ez add makes one (Run.answer.up of Up.Clone), in a scratch directory outside the project and BEND_LIB that is removed whether or not the clone worked. A name's file under BEND_LIB/names is read as it is. So nothing is written while the questions are answered, and a refused fetch leaves BEND_LIB as it found it. It decides nothing; that it reads and executes faithfully is EZ-TRUST-2.

8 imports
import Base
import 0xabe575924687afad4cee1a2c1194d639/main.bend as R
import ../io/file.bend as F
import ../lock/run.bend as Run
import ../lock/world.bend as W
import ../lock/up.bend as Up
import ./world.bend as FW
import ./plan.bend as FP

Definitions

def laid.seen source · line 27 · raw

@got:Maybe<&2, String> -> @+dir:String -> IO(0x74799d3f846634a3d7461d4336d7c9d4/src/lock/world.Answer)

a tree's manifest, when there is one: the tree as it names it, and otherwise a miss

def laid source · line 36 · raw

@+lib:String -> @+hash:String -> IO(0x74799d3f846634a3d7461d4336d7c9d4/src/lock/world.Answer)

the tree under BEND_LIB for a hash, as its manifest names it, or a miss when there is none

def answer source · line 43 · raw

@+lib:String -> @ask:0x74799d3f846634a3d7461d4336d7c9d4/src/fetch/world.Ask -> IO(0x74799d3f846634a3d7461d4336d7c9d4/src/fetch/world.Answer)

one question, answered

def answer.all source · line 63 · raw

@+lib:String -> @asks:List<&2, 0x74799d3f846634a3d7461d4336d7c9d4/src/fetch/world.Ask> -> IO(List<&2, 0x74799d3f846634a3d7461d4336d7c9d4/src/fetch/world.Reply>)

every question, answered

def more source · line 74 · raw

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

the World with more answers in it

def loop.step source · line 80 · raw

@st:0x74799d3f846634a3d7461d4336d7c9d4/src/fetch/plan.Step -> @+lib:String -> @world:0x74799d3f846634a3d7461d4336d7c9d4/src/fetch/world.World -> @go:(@_:0x74799d3f846634a3d7461d4336d7c9d4/src/fetch/world.World -> IO(Unit)) -> IO(Unit)

the planner's step: its questions answered and the loop gone round again, or its plan run

def rounds source · line 93 · raw

Nat

the rounds the loop may take. A package asks at most twice, for its tree under BEND_LIB and for its fetch, and a round asks for every package at once, so this is only a guard against a planner that keeps asking, and running out of it dies loudly.

def loop source · line 99 · raw

@fuel:Nat -> @+lib:String -> @+world:0x74799d3f846634a3d7461d4336d7c9d4/src/fetch/world.World -> IO(Unit)

the loop, under fuel. A package asks at most twice, for its tree under BEND_LIB and for its fetch, and every round answers what it asked, so the fuel is only a guard.

def at source · line 107 · raw

@+here:String -> @+file:String -> String

a file of the project, read

def fill source · line 113 · raw

@+here:String -> @+lib:String -> IO(Unit)

BEND_LIB lib filled from the lock of the project in here, which is where every relative path in the lock is read from. ez tool fills a tool's cache from its checkout's lock this way.

def run source · line 120 · raw

IO(Unit)

ez fetch: BEND_LIB filled from the lock of the project ez runs in