mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
swarm/storage: Add parametric store limits for localdpa + chunksize
const
This commit is contained in:
parent
4a923691e7
commit
fe2f4ba2d6
2 changed files with 15 additions and 4 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ import (
|
|||
"github.com/ethereum/go-ethereum/crypto/sha3"
|
||||
)
|
||||
|
||||
const (
|
||||
CHUNKSIZE = 4096
|
||||
)
|
||||
|
||||
type Hasher func() hash.Hash
|
||||
type SwarmHasher func() SwarmHash
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue