corso/src/internal/stats/stats.go
ryanfkeepers 5cf020d5c8 remove stats.Errs
Now that fault errors is in place, we don't need
the operation stats errs.
2023-02-20 18:58:26 -07:00

31 lines
783 B
Go

package stats
import (
"sync/atomic"
"time"
)
// ReadWrites tracks the total count of reads and writes. ItemsRead
// and ItemsWritten counts are assumed to be successful reads.
type ReadWrites struct {
BytesRead int64 `json:"bytesRead,omitempty"`
BytesUploaded int64 `json:"bytesUploaded,omitempty"`
ItemsRead int `json:"itemsRead,omitempty"`
ItemsWritten int `json:"itemsWritten,omitempty"`
ResourceOwners int `json:"resourceOwners,omitempty"`
}
// StartAndEndTime tracks a paired starting time and ending time.
type StartAndEndTime struct {
StartedAt time.Time `json:"startedAt"`
CompletedAt time.Time `json:"completedAt"`
}
type ByteCounter struct {
NumBytes int64
}
func (bc *ByteCounter) Count(i int64) {
atomic.AddInt64(&bc.NumBytes, i)
}