// Record implements trigger.
483546
func (f *fen) Record(w *watched) {
	f.pthLkp[w.p] = w
}
709686
func (j *JSONSource) Record() (interface{}, error) {
	rec, ok := <-j.records
	if !ok {
		return nil, io.EOF
	}
	return rec.data, rec.err
}
1099098
func (records *Records) Create(ctx context.Context, record *Record) (err error) {
	buffer := new(bytes.Buffer)
	err = json.NewEncoder(buffer).Encode(record)
	if err != nil {
		return
	}
	response, err := httpDo(ctx, records.Options, "POST", apiURL("/zones/%s/dns_records", record.ZoneID), buffer)
	if err != nil {
		return
	}
	defer response.Body.Close()
	result, err := readResponse(response.Body)
	if err != nil {
		return
	}
	res := new(Record)
	err = json.Unmarshal(result.Result, &res)
	if err != nil {
		return
	}
	record.ID = res.ID
	record.TTL = res.TTL
	record.Locked = res.Locked
	record.Proxied = res.Proxied
	record.Proxiable = res.Proxiable
	record.CreatedOn = res.CreatedOn
	record.ModifiedOn = res.ModifiedOn
	return
}
238358
func (r *Record) Assign(expr string) error {
	pair := strings.SplitN(expr, "=", 2)
	if len(pair) < 2 || pair[0] == "" || pair[1] == "" {
		return fmt.Errorf("Record assign '%s' not in correct format. Expected: key=value", expr)
	}

	if strings.HasPrefix(pair[0], "_") {
		return fmt.Errorf("Cannot set data with reserved key: %s", pair[0])
	}

	r.Set(pair[0], pair[1])
	return nil
}
38086
func (rg *RecordGenerator) listenerRecord(listener string, ns string) {
	if listener == "0.0.0.0" {
		rg.setFromLocal(listener, ns)
	} else if listener == "127.0.0.1" {
		rg.insertRR(ns, "127.0.0.1", A)
	} else {
		rg.insertRR(ns, listener, rrsKindForIPStr(listener))
	}
}
152263
func (p *PeekingSource) Record() (interface{}, error) {
	p.mu.RLock()
	var rec interface{}
	if p.rec == nil {
		defer p.mu.RUnlock()
		return p.Source.Record()
	} else {
		// Exchange read lock for write lock and recheck p.rec
		p.mu.RUnlock()
		p.mu.Lock()
		if p.rec == nil {
			p.mu.Unlock()
			return p.Record()
		}
		rec = p.rec
		p.rec = nil
		p.mu.Unlock()
		return rec, nil
	}
}
1294528
func (c remoteHandler) Log(record *Record) error {
	return c(record.Message, record.Time, record.Level, record.Call, record.Context)
}
1260869
func (t *Trace) Record(name string, tags map[string]string) error {
	return t.ClientRecord(DefaultClient, name, tags)
}
442525
func (s *session) recordCommited(rec *sessionRecord) {
	if rec.has(recJournalNum) {
		s.stJournalNum = rec.journalNum
	}

	if rec.has(recPrevJournalNum) {
		s.stPrevJournalNum = rec.prevJournalNum
	}

	if rec.has(recSeqNum) {
		s.stSeqNum = rec.seqNum
	}

	for _, r := range rec.compPtrs {
		s.setCompPtr(r.level, internalKey(r.ikey))
	}
}
70835
func (s *scanner) pushRecord(state, pos int) {
	s.stateRecord = append(s.stateRecord, Record{state:state, pos:pos}) //state are at even positions, pos are at odd positions in stateRecord array
}
898454
func (r *EventRecorder) Record(ctx context.Context, e metric.Event) {
	labels := prometheus.Labels{
		"org_id":   e.OrgID.String(),
		"endpoint": e.Endpoint,
		"status":   fmt.Sprintf("%d", e.Status),
	}
	r.count.With(labels).Inc()
	r.requestBytes.With(labels).Add(float64(e.RequestBytes))
	r.responseBytes.With(labels).Add(float64(e.ResponseBytes))
}
879613
func (b *InsertStmt) Record(structValue interface{}) *InsertStmt {
	v := reflect.Indirect(reflect.ValueOf(structValue))

	if v.Kind() == reflect.Struct {
		found := make([]interface{}, len(b.Column)+1)
		// ID is recommended by golint here
		s := newTagStore()
		s.findValueByName(v, append(b.Column, "id"), found, false)

		value := found[:len(found)-1]
		for i, v := range value {
			if v != nil {
				value[i] = v.(reflect.Value).Interface()
			}
		}

		if v.CanSet() {
			switch idField := found[len(found)-1].(type) {
			case reflect.Value:
				if idField.Kind() == reflect.Int64 {
					b.RecordID = idField.Addr().Interface().(*int64)
				}
			}
		}
		b.Values(value...)
	}
	return b
}
1046400
func (idx *index) LastRecord() record {
	var rec record
	if len(idx.Records) > 0 {
		rec = idx.Records[len(idx.Records)-1]
	}
	return rec
}
694967
func (mock *AuditorServiceMock) Record(ctx context.Context, action, result string, params common.Params) error {
	newParams := params.Copy()
	if mock.RecordFunc == nil {
		panic("MockAuditor.RecordFunc is nil but MockAuditor.Record was just called")
	}

	callInfo := struct {
		Ctx    context.Context
		Action string
		Result string
		Params common.Params
	}{
		Ctx:    ctx,
		Action: action,
		Result: result,
		Params: newParams,
	}

	lockMockAuditorRecord.Lock()
	mock.calls.Record = append(mock.calls.Record, callInfo)
	lockMockAuditorRecord.Unlock()

	return mock.RecordFunc(ctx, action, result, newParams)
}
1106306
func recordEvent(sink EventSink, event *v1.Event, patch []byte, updateExistingEvent bool, eventCorrelator *EventCorrelator) bool {
	var newEvent *v1.Event
	var err error
	if updateExistingEvent {
		newEvent, err = sink.Patch(event, patch)
	}
	// Update can fail because the event may have been removed and it no longer exists.
	if !updateExistingEvent || (updateExistingEvent && util.IsKeyNotFoundError(err)) {
		// Making sure that ResourceVersion is empty on creation
		event.ResourceVersion = ""
		newEvent, err = sink.Create(event)
	}
	if err == nil {
		// we need to update our event correlator with the server returned state to handle name/resourceversion
		eventCorrelator.UpdateState(newEvent)
		return true
	}

	// If we can't contact the server, then hold everything while we keep trying.
	// Otherwise, something about the event is malformed and we should abandon it.
	switch err.(type) {
	case *restclient.RequestConstructionError:
		// We will construct the request the same next time, so don't keep trying.
		klog.Errorf("Unable to construct event '%#v': '%v' (will not retry!)", event, err)
		return true
	case *errors.StatusError:
		if errors.IsAlreadyExists(err) {
			klog.V(5).Infof("Server rejected event '%#v': '%v' (will not retry!)", event, err)
		} else {
			klog.Errorf("Server rejected event '%#v': '%v' (will not retry!)", event, err)
		}
		return true
	case *errors.UnexpectedObjectError:
		// We don't expect this; it implies the server's response didn't match a
		// known pattern. Go ahead and retry.
	default:
		// This case includes actual http transport errors. Go ahead and retry.
	}
	klog.Errorf("Unable to write event: '%v' (may retry after sleeping)", err)
	return false
}
650787
func recordOperation(operation string, start time.Time) {
	metrics.RuntimeOperations.WithLabelValues(operation).Inc()
	metrics.DeprecatedRuntimeOperations.WithLabelValues(operation).Inc()
	metrics.RuntimeOperationsDuration.WithLabelValues(operation).Observe(metrics.SinceInSeconds(start))
	metrics.DeprecatedRuntimeOperationsLatency.WithLabelValues(operation).Observe(metrics.SinceInMicroseconds(start))
}
1118079
func Record(cmd []string, wd string, quiet bool) (tracedir string, err error) {
	if err := checkRRAvailabe(); err != nil {
		return "", err
	}

	rfd, wfd, err := os.Pipe()
	if err != nil {
		return "", err
	}

	args := make([]string, 0, len(cmd)+2)
	args = append(args, "record", "--print-trace-dir=3")
	args = append(args, cmd...)
	rrcmd := exec.Command("rr", args...)
	rrcmd.Stdin = os.Stdin
	if !quiet {
		rrcmd.Stdout = os.Stdout
		rrcmd.Stderr = os.Stderr
	}
	rrcmd.ExtraFiles = []*os.File{wfd}
	rrcmd.Dir = wd

	done := make(chan struct{})
	go func() {
		bs, _ := ioutil.ReadAll(rfd)
		tracedir = strings.TrimSpace(string(bs))
		close(done)
	}()

	err = rrcmd.Run()
	// ignore run errors, it could be the program crashing
	wfd.Close()
	<-done
	return
}