package lib

import (
	"sync"
	"time"
)

// 处理器接口
type Handler interface {
	SetReq(req []byte, flag bool)
	// 处理请求
	BuildReq() RawReq
	//调用
	Call(req []byte) ([]byte, error)
	// 检查响应
	Check(req RawReq, rsp RawResp) *CallResult

	GetConnMap() sync.Map
}

// 调用结果
type CallResult struct {
	Id      int64
	Req     RawReq
	Resp    RawResp
	Code    ResCode
	Message string
	Elapse  time.Duration
}

type Statistics struct {
	ElapseTotal float64 //总耗时
	MaxElapse   float64 //最大耗时
	MinElapse   float64 //最小耗时
	AvgElapse   float64 //平均耗时
	CallCount   int64   //调用次数
	Route       string  //协议名称
}
