code: func New(p *messages.TriggeringPolicy) (Func, error) {
  	// There will be more kinds here, so this should technically be a switch, even
  	// though currently it is not a very interesting switch.
  	switch p.Kind {
  	case messages.TriggeringPolicy_GREEDY_BATCHING:
  		return GreedyBatchingPolicy(int(p.MaxConcurrentInvocations), int(p.MaxBatchSize))
  	case messages.TriggeringPolicy_LOGARITHMIC_BATCHING:
  		return LogarithmicBatchingPolicy(int(p.MaxConcurrentInvocations), int(p.MaxBatchSize), float64(p.LogBase))
  	default:
  		return nil, errors.Reason("unrecognized triggering policy kind %d", p.Kind).Err()
  	}
  }
docs: // New is a factory that takes TriggeringPolicy proto and returns a concrete
  // function that implements this policy.
  //
  // The returned function will be used only during one triage round and then
  // discarded.
  //
  // The caller is responsible for filling in all default values in the proto if
  // necessary. Use UnmarshalDefinition to deserialize TriggeringPolicy filling in
  // the defaults.
  //
  // Returns an error if the TriggeringPolicy message can't be
  // understood (for example, it references an undefined policy kind).