find package by name

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-17 23:26:45 -06:00
parent 8ebf38a472
commit 24a4b65f26
1 changed files with 12 additions and 1 deletions

View File

@ -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()