// Stream.Flush flushes the playback buffer, discarding any audio therein
10148
func (s *Stream) Flush() (error) {
	var err C.int
	_ = C.pa_simple_flush(s.simple, &err)
	if err == C.PA_OK {
		return nil
	}
	return errorFromCode(err)
}
87222
func (s *RateLimitedStorage) Flush() error {
	s.wait()
	defer s.signal()

	return s.storage.Flush()
}
182207
func (p *Producer) flush(records []*k.PutRecordsRequestEntry, reason string) {
	p.Logger.WithFields(log.Fields{
		"records": len(records),
		"reason":  reason,
	}).Info("flush")

	out, err := p.Client.PutRecords(&k.PutRecordsInput{
		StreamName: &p.StreamName,
		Records:    records,
	})

	if err != nil {
		p.Logger.WithError(err).Error("flush")
		p.backoff(len(records))
		p.flush(records, "error")
		return
	}

	failed := *out.FailedRecordCount
	if failed == 0 {
		p.Backoff.Reset()
		return
	}

	p.backoff(int(failed))
	p.flush(failures(records, out.Records), "retry")
}
910280
func (w *TxnWatcher) flush() {
	// refreshEvents are stored newest first.
	for i := len(w.syncEvents) - 1; i >= 0; i-- {
		e := w.syncEvents[i]
		w.hub.Publish(txnWatcherCollection, e)
	}
	w.averageSyncLen = (filterFactor * float64(len(w.syncEvents))) + ((1.0 - filterFactor) * w.averageSyncLen)
	w.syncEventsLastLen = len(w.syncEvents)
	w.syncEvents = w.syncEvents[:0]
	// TODO(jam): 2018-11-07 Consider if averageSyncLen << cap(syncEvents) we should reallocate the buffer, so that it
	// doesn't grow to the size of the largest-ever change and never shrink
}
631601
func (w *BufferedWriter) Flush() error {
	if w.err == nil {
		w.err = w.bw.Flush()
	}

	return w.err
}
91742
func (s *TCP) Flush() error {
	defer func() {
		s.frames = s.frames[:0]
	}()
	c, err := net.DialTimeout("tcp", s.address, time.Second)
	if err != nil {
		return err
	}
	enc, err := fs.NewEncoder(c, &fs.EncoderOptions{
		ContentType:   []byte("protobuf:dnstap.Dnstap"),
		Bidirectional: true,
	})
	if err != nil {
		return err
	}
	for _, frame := range s.frames {
		if _, err = enc.Write(frame); err != nil {
			return err
		}
	}
	return enc.Flush()
}
239078
func (sb *StatsdBuffer) flush() (err error) {
	n := len(sb.events)
	if n == 0 {
		return nil
	}
	if err := sb.statsd.SendEvents(sb.events); err != nil {
		sb.Logger.Println(err)
		return err
	}
	sb.events = make(map[string]event.Event)

	return nil
}
1361044
func (s *Segment) flush() {
	b, _ := json.Marshal(s)
	// append so we make only one call to Write to be goroutine-safe
	s.conn.Write(append([]byte(udpHeader), b...))
}
27315
func flush(r io.Reader) (bytes int64, err error) {
	return io.Copy(ioutil.Discard, r)
}
791845
func (c *connector) Flush() error {
	buf := c.out

	written := 0
	all := buf.Readable()
	for {
		if written == all {
			break
		}

		n, err := c.conn.Write(buf.buf[buf.readerIndex+written : buf.writerIndex])
		if err != nil {
			for _, sm := range c.opts.middlewares {
				sm.WriteError(err, c)
			}

			c.writeRelease()
			return err
		}

		written += n
	}

	c.writeRelease()
	return nil
}
279391
func (r *responseWriter) Flush() {
	if f, ok := r.ResponseWriter.(http.Flusher); ok {
		f.Flush()
	}
}
1310134
func (b *Buffer) Flush() (size int, err error) {
	for _, buf := range b.buffer {
		if size, err = b.write(buf); err != nil {
			return
		}
	}

	b.buffer = b.buffer[:0]
	return
}
1128310
func (w *LogWriter) Flush() error {
	w.bufferLock.Lock()
	defer w.bufferLock.Unlock()

	var err error
	if len(w.buffer) > 0 {
		err = w.send(w.buffer)
		w.buffer = []byte{}
	}

	return err
}
233209
func (b *NoStorage) Flush() error {
	if f, ok := b.w.(http.Flusher); ok {
		f.Flush()
	}
	return nil
}
196076
func Flush(c context.Context) error {
	return GetState(c).Flush(c, nil)
}
1109162
func (l *BytesBufferLogger) Flush() {
	l.mux.Lock()
	defer l.mux.Unlock()
	l.buf.Reset()
}
1150921
func (xw *Writer) Flush(mode FlushMode) error {
	if xw.err != nil {
		return xw.err
	}

	switch mode {
	case FlushSync:
		offset := xw.zw.OutputOffset
		xw.err = xw.zw.Flush()
		xw.OutputOffset += xw.zw.OutputOffset - offset
		return xw.err
	case FlushFull:
		if xw.err = xw.Flush(FlushSync); xw.err != nil {
			return xw.err
		}
		xw.idx.AppendRecord(xw.zw.OutputOffset, xw.zw.InputOffset, deflateType)
		xw.zw.Reset(xw.wr)
		if int64(len(xw.idx.Records)) == xw.nidx {
			xw.err = xw.Flush(FlushIndex)
		}
		return xw.err
	case FlushIndex:
		if xw.zw.InputOffset+xw.zw.OutputOffset > 0 {
			if err := xw.Flush(FlushFull); err != nil {
				return err
			}
		}
		xw.err = xw.encodeIndex(&xw.idx)
		backSize := xw.idx.IndexSize
		xw.idx.Reset()
		xw.idx.BackSize = backSize
		return xw.err
	default:
		return errorf(errors.Invalid, "invalid flush mode: %d", mode)
	}
}