diff --git a/machines.go b/machines.go index 52a37e7..3766ae7 100644 --- a/machines.go +++ b/machines.go @@ -92,7 +92,7 @@ func (r *Machine) Age(newP *Machine) time.Duration { return t } -// find a package by name +// find a machine by name func (r *Machines) FindByName(name string) *Machine { machinesLock.RLock() defer machinesLock.RUnlock() @@ -106,6 +106,17 @@ func (r *Machines) FindByName(name string) *Machine { return nil } +// find a package by name +func (m *Machine) FindPackageByName(name string) *Package { + if m == nil { + return nil + } + if m.Packages == nil { + return nil + } + return m.Packages.FindByName(name) +} + func (r *Machines) Len() int { machinesLock.RLock() defer machinesLock.RUnlock()