github.com/matm/etcd@v0.3.1-0.20140328024009-5b4a473f1453/server/package_stats.go (about)

     1  package server
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  // packageStats represent the stats we need for a package.
     8  // It has sending time and the size of the package.
     9  type packageStats struct {
    10  	sendingTime time.Time
    11  	size        int
    12  }
    13  
    14  // NewPackageStats creates a pacakgeStats and return the pointer to it.
    15  func NewPackageStats(now time.Time, size int) *packageStats {
    16  	return &packageStats{
    17  		sendingTime: now,
    18  		size:        size,
    19  	}
    20  }
    21  
    22  // Time return the sending time of the package.
    23  func (ps *packageStats) Time() time.Time {
    24  	return ps.sendingTime
    25  }