code: func NewRegistry(mapping FactoryMap, fFn FinishExecutionFn) Registry {
  	ret := &registry{fFn, make(map[reflect.Type]Factory, len(mapping))}
  	add := func(p proto.Message, factory Factory) {
  		if factory == nil {
  			panic("factory is nil")
  		}
  		if p == nil {
  			panic("proto.Message is nil")
  		}
  
  		typ := reflect.TypeOf(p)
  
  		if _, ok := ret.data[typ]; ok {
  			panic(fmt.Errorf("trying to register %q twice", typ))
  		}
  		ret.data[typ] = factory
  	}
  	for p, f := range mapping {
  		add(p, f)
  	}
  	return ret
  }
docs: // NewRegistry builds a new implementation of Registry configured to load
  // configuration data from luci-config.
  //
  // The mapping should hold nil-ptrs of various config protos -> respective
  // Factory. When loading from luci-config, when we see a given message type,
  // we'll construct the distributor instance using the provided Factory.