Skip to content

Commit

Permalink
Provide API for getting all map specs (#202)
Browse files Browse the repository at this point in the history
get map specs
  • Loading branch information
usamasaqib authored Oct 29, 2024
1 parent ede90e3 commit c11e696
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,17 @@ func (m *Manager) GetPrograms() (map[string]*ebpf.Program, error) {
return maps.Clone(m.collection.Programs), nil
}

// GetMapSpecs - Return the list of eBPF map specs in the manager
func (m *Manager) GetMapSpecs() (map[string]*ebpf.MapSpec, error) {
m.stateLock.RLock()
defer m.stateLock.RUnlock()
if m.collectionSpec == nil || m.state < elfLoaded {
return nil, ErrManagerNotELFLoaded
}

return maps.Clone(m.collectionSpec.Maps), nil
}

// GetProgramSpecs - Return the list of eBPF program specs in the manager
func (m *Manager) GetProgramSpecs() (map[string]*ebpf.ProgramSpec, error) {
m.stateLock.RLock()
Expand Down

0 comments on commit c11e696

Please sign in to comment.