// Dnstap enqueues the payload for log.
168276
func (dio *DnstapIO) Dnstap(payload tap.Dnstap) {
	select {
	case dio.queue <- payload:
	default:
		log.Println("[WARN] Dnstap payload dropped.")
	}
}
1194825
func (c *Content) ToMap() map[string]interface{} {
	res := make(map[string]interface{})
	res[RepositoryKey] = c.Repository
	res[BranchKey] = c.Branch
	res[FileNameKey] = c.FileName
	res[LineNumberKey] = c.LineNumber
	res[CodebaseIDKey] = c.CodebaseID
	return res
}
469313
func (logger *RequestLogger) Wrap(innerconnection uaa.Connection) uaa.Connection {
	logger.connection = innerconnection
	return logger
}
260650
func (h *Timing) DNSTime(dNSTime int64) *Timing {
	h.dNSTime = dNSTime
	h.dNSTimeSet = true
	return h
}
799502
func (e Timing) Payload() interface{} {
	return map[string]int64{
		"min": e.Min,
		"max": e.Max,
		"val": e.Value,
		"cnt": e.Count,
	}
}
763201
func (l Labels) ToMap() map[ACIdentifier]string {
	labelsMap := make(map[ACIdentifier]string)
	for _, lbl := range l {
		labelsMap[lbl.Name] = lbl.Value
	}
	return labelsMap
}
1175375
func FnLogs(client *docker.Client, containerID string, stdout io.Writer, stderr io.Writer) error {
	return client.Logs(docker.LogsOptions{
		Container:    containerID,
		Stdout:       true,
		Stderr:       true,
		ErrorStream:  stderr,
		OutputStream: stdout,
	})
}
1110009
func (h Dnstap) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {

	// Add send option into context so other plugin can decide on which DNSTap
	// message to be sent out
	sendOption := taprw.SendOption{Cq: true, Cr: true}
	newCtx := context.WithValue(ctx, DnstapSendOption, &sendOption)
	newCtx = ContextWithTapper(newCtx, h)

	rw := &taprw.ResponseWriter{
		ResponseWriter: w,
		Tapper:         &h,
		Query:          r,
		Send:           &sendOption,
		QueryEpoch:     time.Now(),
	}

	code, err := plugin.NextOrFailure(h.Name(), h.Next, newCtx, rw, r)
	if err != nil {
		// ignore dnstap errors
		return code, err
	}

	if err = rw.DnstapError(); err != nil {
		return code, plugin.Error("dnstap", err)
	}

	return code, nil
}
524435
func MsgPackEncode(b *[]byte, in interface{}) error {
	return codec.NewEncoderBytes(b, MsgpackHandle).Encode(in)
}
714830
func (s *Server) parsePacket(packet []byte, from net.Addr) error {
	var msg dns.Msg
	if err := msg.Unpack(packet); err != nil {
		log.Printf("[ERR] mdns: Failed to unpack packet: %v", err)
		return err
	}
	return s.handleQuery(&msg, from)
}
62048
func MsgpackDecodeAll(data []byte, handle *codec.MsgpackHandle, out interface{}) error {
	decoder := codec.NewDecoderBytes(data, handle)
	err := decoder.Decode(out)
	if err != nil {
		return err
	}

	if decoder.NumBytesRead() != len(data) {
		return fmt.Errorf("Did not consume entire buffer: %d byte(s) left", len(data)-decoder.NumBytesRead())
	}
	return nil
}
1079022
func (c *syncClient) Blpop(arg0 string, timeout int) (result [][]byte, err Error) {
	arg0bytes := []byte(arg0)
	arg1bytes := []byte(fmt.Sprint(timeout))

	var resp Response
	resp, err = c.conn.ServiceRequest(&BLPOP, [][]byte{arg0bytes, arg1bytes})
	if err == nil {
		result = resp.GetMultiBulkData()
	}
	return result, err

}
1155596
func (m *MemoryBackend) Log(event LogEvent, client *Client, pkt packet.Generic, msg *packet.Message, err error) {
	// call logger if available
	if m.Logger != nil {
		m.Logger(event, client, pkt, msg, err)
	}
}
329163
func (t *deducerTrie) ToMap() map[string]pathDeducer {
	m := make(map[string]pathDeducer)
	t.RLock()
	t.t.Walk(func(s string, d interface{}) bool {
		m[s] = d.(pathDeducer)
		return false
	})

	t.RUnlock()
	return m
}
1163300
func (r *StatsServer) PostPacketEvent(req rpcwrapper.Request, resp *rpcwrapper.Response) error {
	if !r.rpchdl.ProcessMessage(&req, r.secret) {
		return errors.New("message sender cannot be verified")
	}

	payload := req.Payload.(rpcwrapper.DebugPacketPayload)
	for _, record := range payload.PacketRecords {

		r.collector.CollectPacketEvent(record)
	}
	return nil
}
688212
func (h Dnstap) TapMessage(m *tap.Message) {
	t := tap.Dnstap_MESSAGE
	h.IO.Dnstap(tap.Dnstap{
		Type:    &t,
		Message: m,
	})
}
492631
func (hns HandlerNames) ToMap() map[string]*HandlerName {
	hnMap := make(map[string]*HandlerName)

	for _, nh := range hns {
		hnMap[nh.Name] = nh
	}

	return hnMap
}