From 24a4b65f268d8a4086cb2f906b1da2efce2799d8 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 17 Nov 2024 23:26:45 -0600 Subject: [PATCH] find package by name Signed-off-by: Jeff Carr --- machines.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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()