()
| 31 | ) |
| 32 | |
| 33 | func init() { |
| 34 | registry.Register(&plugin.Registration{ |
| 35 | Type: plugins.DiffPlugin, |
| 36 | ID: "walking", |
| 37 | Requires: []plugin.Type{ |
| 38 | plugins.MetadataPlugin, |
| 39 | plugins.MountManagerPlugin, |
| 40 | }, |
| 41 | InitFn: func(ic *plugin.InitContext) (any, error) { |
| 42 | md, err := ic.GetSingle(plugins.MetadataPlugin) |
| 43 | if err != nil { |
| 44 | return nil, err |
| 45 | } |
| 46 | |
| 47 | var mm mount.Manager |
| 48 | if mountsI, err := ic.GetSingle(plugins.MountManagerPlugin); err == nil { |
| 49 | mm = mountsI.(mount.Manager) |
| 50 | } else if !errors.Is(err, plugin.ErrPluginNotFound) { |
| 51 | return nil, err |
| 52 | } |
| 53 | |
| 54 | ic.Meta.Platforms = append(ic.Meta.Platforms, platforms.DefaultSpec()) |
| 55 | cs := md.(*metadata.DB).ContentStore() |
| 56 | |
| 57 | return diffPlugin{ |
| 58 | Comparer: walking.NewWalkingDiff(cs), |
| 59 | Applier: apply.NewFileSystemApplierWithMountManager(cs, mm), |
| 60 | }, nil |
| 61 | }, |
| 62 | }) |
| 63 | } |
| 64 | |
| 65 | type diffPlugin struct { |
| 66 | diff.Comparer |
nothing calls this directly
no test coverage detected
searching dependent graphs…