carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package host
2
3import "encoding/json"
4
5func proofFileSource(file proofUnitFile) []byte {
6 if file.Persistent.Boot != "" {
7 stable := file.Persistent
8 stable.Boot, stable.Device, stable.Mount, stable.MountNamespace = "", 0, 0, ""
9 stable.MountUnique, stable.NamespaceUnique = 0, 0
10 raw, _ := json.Marshal(struct {
11 Path string
12 Stable any
13 }{file.Path, stable})
14 return raw
15 }
16 raw, _ := json.Marshal(file.Identity)
17 return raw
18}
19
20func sameProofFiles(prior, current []proofUnitFile) bool {
21 if len(prior) != len(current) {
22 return false
23 }
24 for i, p := range prior {
25 q := current[i]
26 if p.Path != q.Path {
27 return false
28 }
29 if p.Persistent.Boot != "" {
30 if !p.Persistent.Same(q.Persistent) {
31 return false
32 }
33 } else if p.Identity != q.Identity || q.Persistent.Boot != "" {
34 return false
35 }
36 }
37 return true
38}
39