Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. func handleDownloaderModify(ctxArg interface{}, objType string,
  2. key string, configArg interface{}) {
  3. log.Infof("handleDownloaderModify(%s)\n", key)
  4. ctx := ctxArg.(*downloaderContext)
  5. config := cast.CastDownloaderConfig(configArg)
  6. if config.Key() != key {
  7. log.Errorf("handleDownloaderModify key/UUID mismatch %s vs %s; ignored %+v\n",
  8. key, config.Key(), config)
  9. return
  10. }
  11. h, ok := handlerMap[config.Key()]
  12. if !ok {
  13. log.Fatalf("handleDownloaderModify called on config that does not exist")
  14. }
  15. h <- configArg
  16. }
  17. func handleDownloaderCreate(ctxArg interface{}, objType string,
  18. key string, configArg interface{}) {
  19. log.Infof("handleDownloaderModify(%s)\n", key)
  20. ctx := ctxArg.(*downloaderContext)
  21. config := cast.CastDownloaderConfig(configArg)
  22. if config.Key() != key {
  23. log.Errorf("handleDownloaderModify key/UUID mismatch %s vs %s; ignored %+v\n",
  24. key, config.Key(), config)
  25. return
  26. }
  27. h, ok := handlerMap[config.Key()]
  28. if ok {
  29. log.Fatalf("handleDownloaderCreate called on config that already exists")
  30. }
  31. h := make(chan interface{})
  32. handlerMap[config.Key()] = h
  33. go runHandler(ctx, objType, key, h)
  34. h <- configArg
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement