diff --git a/swarm/storage/dpa.go b/swarm/storage/dpa.go index fb9dde3fe4..adbf915335 100644 --- a/swarm/storage/dpa.go +++ b/swarm/storage/dpa.go @@ -63,20 +63,27 @@ type DPA struct { } // for testing locally -func NewLocalDPA(datadir string, hashalgorithm string) (*DPA, error) { +func NewLocalDPA(datadir string, hashalgorithm string, dbcapacity uint64, memcapacity uint) (*DPA, error) { if hashalgorithm == "" { hashalgorithm = "SHA3" } hash := MakeHashFunc(hashalgorithm) - dbStore, err := NewDbStore(datadir, hash, singletonSwarmDbCapacity, 0) + if dbcapacity == 0 { + dbcapacity = uint64(singletonSwarmDbCapacity) + } + if memcapacity == 0 { + memcapacity = uint(singletonSwarmCacheCapacity) + } + + log.Debug("LocalDPA create", "dbcap", dbcapacity, "memcap", memcapacity) + dbStore, err := NewDbStore(datadir, hash, dbcapacity, 0) if err != nil { return nil, err } - return NewDPA(&LocalStore{ - NewMemStore(dbStore, singletonSwarmCacheCapacity), + NewMemStore(dbStore, memcapacity), dbStore, }, NewChunkerParams()), nil } diff --git a/swarm/storage/types.go b/swarm/storage/types.go index d35f1f9294..860659020a 100644 --- a/swarm/storage/types.go +++ b/swarm/storage/types.go @@ -29,6 +29,10 @@ import ( "github.com/ethereum/go-ethereum/crypto/sha3" ) +const ( + CHUNKSIZE = 4096 +) + type Hasher func() hash.Hash type SwarmHasher func() SwarmHash