const queueCapacity … type RequestStats … type statsQueue … func (q *statsQueue) Len() int { … } func (q *statsQueue) ReqSize() int { … } // FrontAndBack gets the front and back elements in the queue // We must grab front and back together with the protection of the lock func (q *statsQueue) frontAndBack() (*RequestStats, *RequestStats) { … } // Insert function insert a RequestStats into the queue and update the records func (q *statsQueue) Insert(p *RequestStats) { … } // Rate function returns the package rate and byte rate func (q *statsQueue) Rate() (float64, float64) { … } // Clear function clear up the statsQueue func (q *statsQueue) Clear() { … }