Pin the node-engine at its ADR 0328 merge (#95), and speak its contract: a library's verdict is said for the modules that use it
This commit is contained in:
@@ -468,6 +468,7 @@ type Joined struct {
|
||||
Primary string
|
||||
PrimaryGID int
|
||||
Added []string
|
||||
AddedGIDs []int
|
||||
}
|
||||
|
||||
// librariesOf is the libraries a module uses, by name, in the order its entries first name them.
|
||||
@@ -504,6 +505,7 @@ func joinedOf(m Manifest, with Rendering) (Joined, error) {
|
||||
continue
|
||||
}
|
||||
j.Added = append(j.Added, MeshName(lib))
|
||||
j.AddedGIDs = append(j.AddedGIDs, gid)
|
||||
}
|
||||
return j, nil
|
||||
}
|
||||
@@ -723,14 +725,15 @@ type GroupEntry struct {
|
||||
GID int `json:"gid"`
|
||||
}
|
||||
|
||||
// IdentityEntry is one joining module's user as a machine's declaration names it (§4): its own group has its uid,
|
||||
// and Groups are its library groups, the primary first.
|
||||
// IdentityEntry is one joining module's user as a machine's declaration names it (§4; mesh-host internal/declaration
|
||||
// Identity): the engine always makes its own group with its uid; GID is its primary group's number — its first
|
||||
// library's, or its own — and Groups the numbers of its added groups.
|
||||
type IdentityEntry struct {
|
||||
Module string `json:"module"`
|
||||
Name string `json:"name"`
|
||||
UID int `json:"uid"`
|
||||
GID int `json:"gid"`
|
||||
Groups []string `json:"groups,omitempty"`
|
||||
Module string `json:"module"`
|
||||
Name string `json:"name"`
|
||||
UID int `json:"uid"`
|
||||
GID int `json:"gid"`
|
||||
Groups []int `json:"groups,omitempty"`
|
||||
}
|
||||
|
||||
// libraryEnvelope is what a machine's declaration says of libraries and joining modules: the group of every library
|
||||
@@ -748,10 +751,8 @@ func (r Resolution) libraryEnvelope(with Rendering, joined []Joined) ([]GroupEnt
|
||||
sort.Slice(groups, func(i, j int) bool { return groups[i].Name < groups[j].Name })
|
||||
var ids []IdentityEntry
|
||||
for _, j := range joined {
|
||||
e := IdentityEntry{Module: j.Module, Name: IdentityName(j.Module), UID: j.UID, GID: j.UID}
|
||||
if j.Primary != IdentityName(j.Module) {
|
||||
e.Groups = append([]string{j.Primary}, j.Added...)
|
||||
}
|
||||
e := IdentityEntry{Module: j.Module, Name: IdentityName(j.Module), UID: j.UID, GID: j.PrimaryGID,
|
||||
Groups: append([]int(nil), j.AddedGIDs...)}
|
||||
ids = append(ids, e)
|
||||
}
|
||||
sort.Slice(ids, func(a, b int) bool { return ids[a].Module < ids[b].Module })
|
||||
|
||||
Reference in New Issue
Block a user