Answer architecture round 11: a source states its mount in a field its manifest, its labels and its file reads share, so the mount can come before or after the manifest; the README says a stand-in for the places is a record with a format

This commit is contained in:
2026-10-11 15:13:39 +02:00
committed by Lillem4n
parent ad1dfac447
commit e8f5fd47d5
4 changed files with 29 additions and 20 deletions
+14 -3
View File
@@ -45,11 +45,22 @@ func (m mounted) ReadDir(name string) ([]fs.DirEntry, error) {
// inner is name as fsys spells it, where name lies at or below at.
func (m mounted) inner(name string) (string, bool) {
if name == m.at {
inner, below := underMount(m.at, name)
return inner, below && fs.ValidPath(name)
}
// underMount is name as the tree mounted at at spells it, where name lies at or below at.
func underMount(at, name string) (string, bool) {
switch name {
case at:
return ".", true
case "":
return name, false
}
rest, below := strings.CutPrefix(name, m.at+"/")
return rest, below && fs.ValidPath(name)
if at == "" {
return name, true
}
return strings.CutPrefix(name, at+"/")
}
// towards is the folder below name on the way to at, where name lies above at.