demote NewStream
This commit is contained in:
parent
ecace73aed
commit
ae82433a8f
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package bandwidth
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
@ -29,7 +29,7 @@ type stream struct {
|
||||
max time.Duration
|
||||
}
|
||||
|
||||
func NewStream(seconds []int) *stream {
|
||||
func newStream(seconds []int) *stream {
|
||||
extents := []time.Duration{}
|
||||
for _, s := range seconds {
|
||||
extents = append(extents, time.Duration(-s)*time.Second)
|
||||
@ -113,8 +113,8 @@ func NewBandwidth(seconds []int, dt time.Duration) (*Bandwidth, error) {
|
||||
Tx: make(chan []float64),
|
||||
dt: dt,
|
||||
Quit: make(chan interface{}),
|
||||
rxstream: NewStream(seconds),
|
||||
txstream: NewStream(seconds),
|
||||
rxstream: newStream(seconds),
|
||||
txstream: newStream(seconds),
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package bandwidth
|
||||
|
||||
import (
|
||||
"log"
|
||||
@ -55,7 +55,7 @@ func TestOncePerSecond(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
bw.rxstream = NewStream([]int{1, 10, 60})
|
||||
bw.rxstream = newStream([]int{1, 10, 60})
|
||||
var i int64 = 0
|
||||
for ; i < 1000; i++ {
|
||||
d := datum{
|
||||
@ -72,7 +72,7 @@ func TestOneOverManySeconds(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
bw.rxstream = NewStream([]int{1, 10, 60})
|
||||
bw.rxstream = newStream([]int{1, 10, 60})
|
||||
var i int64 = 0
|
||||
for ; i < 1000; i++ {
|
||||
d := datum{
|
||||
@ -89,7 +89,7 @@ func TestManyPerSecond(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
bw.rxstream = NewStream([]int{1, 10, 60})
|
||||
bw.rxstream = newStream([]int{1, 10, 60})
|
||||
var i int64 = 0
|
||||
for ; i < 10000; i++ {
|
||||
d := datum{
|
||||
@ -106,7 +106,7 @@ func TestEmpty(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
bw.rxstream = NewStream([]int{1, 10, 60})
|
||||
bw.rxstream = newStream([]int{1, 10, 60})
|
||||
validate(t, bw.rxstream.averages(), []float64{})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user