// record is a FilterFunc and tracks each received event.
509285
func (r *Recorder) record(in Event) (Event, bool) {
	r.lock.Lock()
	defer r.lock.Unlock()
	r.events = append(r.events, in)
	return in, true
}
814788
func (r *recorder) Read(b []byte) (n int, err error) {
	if r.Conn != nil {
		numRead, err := r.Conn.Read(b)
		if numRead > 0 {
			r.record(b[:numRead], false)
		}

		if err != nil {
			r.recordErr(err, false)
		}

		return numRead, err
	}

	if r.currentEvent >= len(r.events) {
		return 0, errors.New("Trying to read past all of the events in the recorder! %#v", r)
	}
	event := r.events[r.currentEvent]
	if event.IsWrite {
		return 0, errors.New("Recorder expected Read, got Write! %#v, Event: %#v", r, event)
	}

	for i := 0; i < len(b); i++ {
		if len(event.Event) == 0 {
			return i, errors.New("Attempted to read past current event in recorder! Bytes: %s. Recorder %#v, Event; %#v", b, r, event)
		}
		b[i] = event.Event[0]
		event.Event = event.Event[1:]
	}

	if len(event.Event) == 0 {
		r.currentEvent++
	}

	return len(b), nil
}
1133894
func (a *NopAuditor) Record(ctx context.Context, attemptedAction string, actionResult string, params common.Params) error {
	return nil
}
795356
func (ll *ListLogHandler) Log(r *Record) (err error) {
	for _, handler := range ll.handlers {
		if err == nil {
			err = handler.Log(r)
		} else {
			handler.Log(r)
		}
	}
	return
}
955905
func Trace(w io.Writer, msgs func() []string) {
	if w == nil {
		return
	}
	c <- &event{w, time.Now(), msgs}
}
786981
func (ll *LeaseLock) RecordEvent(s string) {
	if ll.LockConfig.EventRecorder == nil {
		return
	}
	events := fmt.Sprintf("%v %v", ll.LockConfig.Identity, s)
	ll.LockConfig.EventRecorder.Eventf(&coordinationv1.Lease{ObjectMeta: ll.lease.ObjectMeta}, corev1.EventTypeNormal, "LeaderElection", events)
}
128395
func decode(record *Record, event *Event) error {
	r, err := gzip.NewReader(bytes.NewReader(record.AWSLogs.Data))
	if err != nil {
		return err
	}

	if err = json.NewDecoder(r).Decode(&event); err != nil {
		return err
	}

	if err := r.Close(); err != nil {
		return err
	}

	return nil
}
875361
func (cleaner *Cleaner) Record(name, target string, action CleanerFunction) {
	cleaner.mu.Lock()
	cleaner.actions = append(cleaner.actions, cleanerActionReference{
		name:   name,
		target: target,
		action: action,
	})
	cleaner.mu.Unlock()
}
105991
func (cml *ConfigMapLock) RecordEvent(s string) {
	if cml.LockConfig.EventRecorder == nil {
		return
	}
	events := fmt.Sprintf("%v %v", cml.LockConfig.Identity, s)
	cml.LockConfig.EventRecorder.Eventf(&v1.ConfigMap{ObjectMeta: cml.cm.ObjectMeta}, v1.EventTypeNormal, "LeaderElection", events)
}
66533
func (e *RuntimeStats) Record(d time.Duration, rowNum int) {
	atomic.AddInt32(&e.loop, 1)
	atomic.AddInt64(&e.consume, int64(d))
	atomic.AddInt64(&e.rows, int64(rowNum))
}
1159023
func (leg *Leg) Recordings(client *messagebird.Client) *Paginator {
	return newPaginator(client, fmt.Sprintf("%s/calls/%s/legs/%s/recordings", apiRoot, leg.CallID, leg.ID), reflect.TypeOf(Recording{}))
}
727768
func NewRecorder(w Interface) *Recorder {
	r := &Recorder{}
	r.Interface = Filter(w, r.record)
	return r
}
522486
func (kl *Kubelet) recordEvent(eventType, event, message string) {
	kl.recorder.Eventf(kl.nodeRef, eventType, event, message)
}
663174
func RecordTo(w io.Writer) empire.RunRecorder {
	return func() (io.Writer, error) {
		return w, nil
	}
}
1260492
func (m *Monitor) Record(conditions ...Condition) {
	if len(conditions) == 0 {
		return
	}
	m.lock.Lock()
	defer m.lock.Unlock()
	t := time.Now().UTC()
	for _, condition := range conditions {
		m.events = append(m.events, &Event{
			At:        t,
			Condition: condition,
		})
	}
}
673968
func (t *Timings) Record(name string, startTime time.Time) {
	t.Add(name, time.Now().Sub(startTime))
}
275969
func (h *PCPHistogram) Record(val int64) error {
	h.mutex.Lock()
	defer h.mutex.Unlock()

	err := h.h.RecordValue(val)
	if err != nil {
		return err
	}

	return h.update()
}