make summary available externally
This commit is contained in:
parent
7d8772ed63
commit
557c595e90
1 changed files with 9 additions and 3 deletions
|
@ -24,6 +24,10 @@ const (
|
||||||
errInc
|
errInc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Summary struct {
|
||||||
|
total, alreadyStored, sd, blob, err int
|
||||||
|
}
|
||||||
|
|
||||||
type Uploader struct {
|
type Uploader struct {
|
||||||
db *db.SQL
|
db *db.SQL
|
||||||
store *store.DBBackedS3Store // could just be store.BlobStore interface
|
store *store.DBBackedS3Store // could just be store.BlobStore interface
|
||||||
|
@ -32,9 +36,7 @@ type Uploader struct {
|
||||||
stopper *stop.Group
|
stopper *stop.Group
|
||||||
countChan chan increment
|
countChan chan increment
|
||||||
|
|
||||||
count struct {
|
count Summary
|
||||||
total, alreadyStored, sd, blob, err int
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewUploader(db *db.SQL, store *store.DBBackedS3Store, workers int, skipExistsCheck bool) *Uploader {
|
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) {
|
func (u *Uploader) inc(t increment) {
|
||||||
select {
|
select {
|
||||||
case u.countChan <- t:
|
case u.countChan <- t:
|
||||||
|
|
Loading…
Reference in a new issue