-
Notifications
You must be signed in to change notification settings - Fork 202
/
common.go
29 lines (26 loc) · 1.01 KB
/
common.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package factory
import (
"github.com/ElrondNetwork/elrond-go/config"
"github.com/ElrondNetwork/elrond-go/storage/storageUnit"
)
// GetCacherFromConfig will return the cache config needed for storage unit from a config came from the toml file
func GetCacherFromConfig(cfg config.CacheConfig) storageUnit.CacheConfig {
return storageUnit.CacheConfig{
Name: cfg.Name,
Capacity: cfg.Capacity,
SizePerSender: cfg.SizePerSender,
SizeInBytes: cfg.SizeInBytes,
SizeInBytesPerSender: cfg.SizeInBytesPerSender,
Type: storageUnit.CacheType(cfg.Type),
Shards: cfg.Shards,
}
}
// GetDBFromConfig will return the db config needed for storage unit from a config came from the toml file
func GetDBFromConfig(cfg config.DBConfig) storageUnit.DBConfig {
return storageUnit.DBConfig{
Type: storageUnit.DBType(cfg.Type),
MaxBatchSize: cfg.MaxBatchSize,
BatchDelaySeconds: cfg.BatchDelaySeconds,
MaxOpenFiles: cfg.MaxOpenFiles,
}
}