From 557c595e90c151e84aae38a9836dd225844df125 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Wed, 10 Jul 2019 17:33:51 +0200 Subject: [PATCH] make summary available externally --- reflector/uploader.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/reflector/uploader.go b/reflector/uploader.go index 5ad4421..22ef274 100644 --- a/reflector/uploader.go +++ b/reflector/uploader.go @@ -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: