Skip to content

Ability to grab all PIDs in the registry #149

Description

@stevohuncho

It would make things less complicated in my repos if I was able to have a couple more public functions for reading the registry. Right now only being able to get active PID info only by inputing the specific ID I'm looking for isn't too helpful for my case. I require the ability to check what the active PIDs are upon request. Using the event stream to monitor this just bloats my code by needing to create my own mapping to just replicate the privated one. I understand it is privated for mutex reasons, but if these functions could be added it would be very helpful. I have used these functions in my own code before using my fork with no issues, but I think this could be useful to others as well.

registry.go

...

func (r *Registry) GetIDs() []string {
	r.mu.RLock()
	defer r.mu.RUnlock()
	keys := make([]string, 0, len(r.lookup))
	for k := range r.lookup {
		keys = append(keys, k)
	}
	return keys
}

func (r *Registry) GetPIDs() []*PID {
	r.mu.RLock()
	defer r.mu.RUnlock()
	keys := make([]*PID, 0, len(r.lookup))
	for _, v := range r.lookup {
		keys = append(keys, v.PID())
	}
	return keys
}

...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions