make summary available externally

This commit is contained in:
Niko Storni 2019-07-10 17:33:51 +02:00
parent 7d8772ed63
commit 557c595e90

View file

@ -24,6 +24,10 @@ const (
errInc
)
type Summary struct {
total, alreadyStored, sd, blob, err int
}
type Uploader struct {
db *db.SQL
store *store.DBBackedS3Store // could just be store.BlobStore interface
@ -32,9 +36,7 @@ type Uploader struct {
stopper *stop.Group
countChan chan increment
count struct {
total, alreadyStored, sd, blob, err int
}
count Summary
}
func NewUploader(db *db.SQL, store *store.DBBackedS3Store, workers int, skipExistsCheck bool) *Uploader {
@ -211,6 +213,10 @@ func (u *Uploader) counter() {
}
}
func (u *Uploader) GetSummary() Summary {
return u.count
}
func (u *Uploader) inc(t increment) {
select {
case u.countChan <- t: