// Handle associates a HandlerFunc h with a the Docker container or image lifecycle
// event specified by es. Any HandlerFunc previously associated with es is replaced.
343098
func (s *Subscription) Handle(es string, h HandlerFunc) error {
	if _, ok := validEvents[es]; !ok {
		return fmt.Errorf("unknown event: %s", es)
	}

	s.lock.Lock()
	s.handlers[es] = h
	s.lock.Unlock()
	return nil
}
1101951
func (fn GetPetByIDHandlerFunc) Handle(params GetPetByIDParams, principal interface{}) middleware.Responder {
	return fn(params, principal)
}
978632
func (fn AddOrderHandlerFunc) Handle(params AddOrderParams, principal *models.Principal) middleware.Responder {
	return fn(params, principal)
}
645372
func (h EventHandlerFunc) HandleEvent(ctx context.Context, e Event) error {
	return h(ctx, e)
}
356886
func (fn CreateHandlerFunc) Handle(params CreateParams, principal *models.Principal) middleware.Responder {
	return fn(params, principal)
}
583071
func (f HandlerFunc) Serve(ctx context.Context, in io.Reader, out io.Writer) {
	f(ctx, in, out)
}
324053
func (fn PetUploadImageHandlerFunc) Handle(params PetUploadImageParams, principal interface{}) middleware.Responder {
	return fn(params, principal)
}
667067
func (r Rule) Handle(h events.Handler) Rule {
	return Rules{r, Handle(h)}.Eval
}
64999
func (s *Server) Handle(typ string, f protocolHandler) {
	s.handlers[typ] = f
}
75340
func Handler(h StatusHandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		status, response := h(w, r)
		w.WriteHeader(status)
		if response == nil {
			return
		}

		Responder(w, r, response)
	}
}
298600
func (fn DeletePetHandlerFunc) Handle(params DeletePetParams, principal interface{}) middleware.Responder {
	return fn(params, principal)
}
1045740
func (hdr *Handler) handle(im *imageserver.Image, params imageserver.Params) (*imageserver.Image, error) {
	arguments := list.New()

	width, height, err := hdr.buildArgumentsResize(arguments, params)
	if err != nil {
		return nil, err
	}

	err = hdr.buildArgumentsBackground(arguments, params)
	if err != nil {
		return nil, err
	}

	err = hdr.buildArgumentsExtent(arguments, params, width, height)
	if err != nil {
		return nil, err
	}

	format, formatSpecified, err := hdr.buildArgumentsFormat(arguments, params, im)
	if err != nil {
		return nil, err
	}

	err = hdr.buildArgumentsQuality(arguments, params, format)
	if err != nil {
		return nil, err
	}

	if arguments.Len() == 0 {
		return im, nil
	}

	arguments.PushFront("mogrify")

	tempDir, err := ioutil.TempDir(hdr.TempDir, tempDirPrefix)
	if err != nil {
		return nil, err
	}
	defer func() {
		_ = os.RemoveAll(tempDir)
	}()

	file := filepath.Join(tempDir, "image")
	arguments.PushBack(file)
	err = ioutil.WriteFile(file, im.Data, os.FileMode(0600))
	if err != nil {
		return nil, err
	}

	argumentSlice := convertArgumentsToSlice(arguments)
	cmd := exec.Command(hdr.Executable, argumentSlice...)
	err = hdr.runCommand(cmd)
	if err != nil {
		return nil, err
	}

	if formatSpecified {
		file = fmt.Sprintf("%s.%s", file, format)
	}
	data, err := ioutil.ReadFile(file)
	if err != nil {
		return nil, err
	}

	im = &imageserver.Image{
		Format: format,
		Data:   data,
	}
	return im, nil
}
254732
func (c *managedHandleImpl) Handle() (interface{}, error) {
	if atomic.LoadInt32(&c.isActive) == 0 {
		return c.handle, errors.New("Resource handle is no longer valid")
	}
	return c.handle, nil
}
360300
func (fn UploadTaskFileHandlerFunc) Handle(params UploadTaskFileParams, principal interface{}) middleware.Responder {
	return fn(params, principal)
}
857036
func Handle(iface string, fn func(string, *Client)) {
	handlers.Lock()
	hdlrs, ok := handlers.extpointHandlers[iface]
	if !ok {
		hdlrs = []func(string, *Client){}
	}

	hdlrs = append(hdlrs, fn)
	handlers.extpointHandlers[iface] = hdlrs

	storage.Lock()
	for _, p := range storage.plugins {
		p.activateWait.L.Lock()
		if p.activated() && p.implements(iface) {
			p.handlersRun = false
		}
		p.activateWait.L.Unlock()
	}
	storage.Unlock()

	handlers.Unlock()
}
218020
func (fn PetDeleteHandlerFunc) Handle(params PetDeleteParams, principal interface{}) middleware.Responder {
	return fn(params, principal)
}
1292447
func (s *Server) Handle(addr string, handler HandlerFunc) error {
	if s.Dispatcher == nil {
		s.Dispatcher = NewOscDispatcher()
	}
	return s.Dispatcher.AddMsgHandler(addr, handler)
}