aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage/chunker.go
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/storage/chunker.go')
-rw-r--r--swarm/storage/chunker.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/swarm/storage/chunker.go b/swarm/storage/chunker.go
index 98cd6e75e..2b397f801 100644
--- a/swarm/storage/chunker.go
+++ b/swarm/storage/chunker.go
@@ -23,6 +23,8 @@ import (
"io"
"sync"
"time"
+
+ "github.com/ethereum/go-ethereum/metrics"
)
/*
@@ -63,6 +65,11 @@ var (
errOperationTimedOut = errors.New("operation timed out")
)
+//metrics variables
+var (
+ newChunkCounter = metrics.NewRegisteredCounter("storage.chunks.new", nil)
+)
+
type TreeChunker struct {
branches int64
hashFunc SwarmHasher
@@ -298,6 +305,13 @@ func (self *TreeChunker) hashChunk(hasher SwarmHash, job *hashJob, chunkC chan *
job.parentWg.Done()
if chunkC != nil {
+ //NOTE: this increases the chunk count even if the local node already has this chunk;
+ //on file upload the node will increase this counter even if the same file has already been uploaded
+ //So it should be evaluated whether it is worth keeping this counter
+ //and/or actually better track when the chunk is Put to the local database
+ //(which may question the need for disambiguation when a completely new chunk has been created
+ //and/or a chunk is being put to the local DB; for chunk tracking it may be worth distinguishing
+ newChunkCounter.Inc(1)
chunkC <- newChunk
}
}