func (storage *InMemory) Each(fn func(key string, port *proto.Port) error) error {
	storage.mutex.Lock()
	defer storage.mutex.Unlock()

	for key, value := range storage.data {
		if err := fn(key, value); err != nil {
			return err
		}
	}

	return nil
}
// Each calls provided callback function for each available pair id/port.
Each calls provided callback function for each available pair id/port.
// Each calls provided callback function for each available pair id / port .
func (storage *InMemory) Each(fn func(key string, port *proto.Port) error) error {
	storage.mutex.Lock()
	defer storage.mutex.Unlock()
	for key, value := range storage.data {
		if err := fn(key, value); err != nil {
			return err
		}
	}
	return nil
}
func ( storage * InMemory ) Each ( fn func ( key string , port * proto . Port ) error ) error { storage . mutex . Lock ( ) defer storage . mutex . Unlock ( ) for key , value := range storage . data { if err := fn ( key , value ) ; err != nil { return err } } return nil }
Each calls provided callback function for each available pair id/port.
Each calls provided callback function for each available pair id / port .