~/bend-docscommunity

src/sha/dump.bend relies on unsafe/foreign

raw source on the hub · import ezx@1.18.0.0/src/sha/dump.bend as Dump

sha/dump: a directory read off the disk and handed to sha/nar, which builds its NAR and names it. The listing is one find, run through snap's foreign effect, and every regular file is then read. This half lives apart from sha/nar because bend 2.0.32 fails a proof whose imports reach foreign code, so a law may import sha/nar but never this.

4 imports
import Base
import snap@1.6.0.0/main.bend as R
import ../io/file.bend as F
import ./nar.bend as Nar

Definitions

def said source · line 12 · raw

@ok:Bool -> @+why:String -> @+text:String -> IO(String)

a command's output as it printed it, or the walk stopped with why it failed

def under.top source · line 20 · raw

@+top:String -> @+at:String -> String

a path of the tree, as the file effect is to open it

def file.got source · line 23 · raw

@got:Maybe<&2, String> -> @+path:String -> IO(String)

def file.of source · line 31 · raw

@+path:String -> IO(String)

a regular file's text, by its path from the top

def ent.other source · line 38 · raw

@known:Bool -> @+kind:String -> @+name:String -> @+at:String -> @+target:String -> @+path:String -> IO(0x2414c9622cab2353684d02a392804eb1/src/sha/nar.Ent)

a path of the listing with what the NAR needs of it: a file's text read, a symlink's target as the listing printed it

def ent.read source · line 53 · raw

@file:Bool -> @+kind:String -> @+mode:String -> @+name:String -> @+at:String -> @+target:String -> @+path:String -> IO(0x2414c9622cab2353684d02a392804eb1/src/sha/nar.Ent)

a regular file's text read, or anything else as the listing gave it

def ent.of source · line 72 · raw

@+top:String -> @row:0x2414c9622cab2353684d02a392804eb1/src/sha/nar.Row -> IO(0x2414c9622cab2353684d02a392804eb1/src/sha/nar.Ent)

one path of the listing, read

def ents source · line 77 · raw

@+top:String -> @rs:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/sha/nar.Row> -> IO(List<&2, 0x2414c9622cab2353684d02a392804eb1/src/sha/nar.Ent>)

every path of the listing, read

def built source · line 88 · raw

@got:Maybe<&2, String> -> @+path:String -> IO(String)

the tree's node, or the walk stopped when the listing made none

def dump source · line 96 · raw

@+path:String -> IO(String)

the NAR serial of one path

def path source · line 104 · raw

@+work:String -> IO(String)

the SRI narHash of a path, the same string nix hash path --sri prints