code: func (p *ProcessingResult) Proto() (*api.Processor, error) {
  	out := &api.Processor{Id: p.ProcID}
  
  	if p.CreatedTs.IsZero() {
  		out.State = api.Processor_PENDING // no result yet
  		return out, nil
  	}
  	out.FinishedTs = google.NewTimestamp(p.CreatedTs)
  
  	if p.Success {
  		out.State = api.Processor_SUCCEEDED
  		res := &structpb.Struct{}
  		if err := p.ReadResultIntoStruct(res); err != nil {
  			return nil, err
  		}
  		if len(res.Fields) != 0 {
  			out.Result = res
  		}
  	} else {
  		out.State = api.Processor_FAILED
  		out.Error = p.Error
  	}
  
  	return out, nil
  }
docs: // Proto returns cipd.Processor proto with information from this entity.