Commit d42ec589 authored by Rinke Hendriksen's avatar Rinke Hendriksen Committed by GitHub

Added translation from chunks to bytes in help and log (#308)

* added translation from chunks to bytes in help and log
parent 53885e61
...@@ -18,6 +18,7 @@ import ( ...@@ -18,6 +18,7 @@ import (
"github.com/ethersphere/bee/pkg/logging" "github.com/ethersphere/bee/pkg/logging"
"github.com/ethersphere/bee/pkg/node" "github.com/ethersphere/bee/pkg/node"
"github.com/ethersphere/bee/pkg/swarm"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
...@@ -151,7 +152,7 @@ func (c *command) initStartCmd() (err error) { ...@@ -151,7 +152,7 @@ func (c *command) initStartCmd() (err error) {
} }
cmd.Flags().String(optionNameDataDir, filepath.Join(c.homeDir, ".bee"), "data directory") cmd.Flags().String(optionNameDataDir, filepath.Join(c.homeDir, ".bee"), "data directory")
cmd.Flags().Uint64(optionNameDBCapacity, 5000000, "db capacity in chunks") cmd.Flags().Uint64(optionNameDBCapacity, 5000000, fmt.Sprintf("db capacity in chunks, multiply by %d to get approximate capacity in bytes", swarm.ChunkSize))
cmd.Flags().String(optionNamePassword, "", "password for decrypting keys") cmd.Flags().String(optionNamePassword, "", "password for decrypting keys")
cmd.Flags().String(optionNamePasswordFile, "", "path to a file that contains password for decrypting keys") cmd.Flags().String(optionNamePasswordFile, "", "path to a file that contains password for decrypting keys")
cmd.Flags().String(optionNameAPIAddr, ":8080", "HTTP API listen address") cmd.Flags().String(optionNameAPIAddr, ":8080", "HTTP API listen address")
......
...@@ -166,7 +166,15 @@ func New(path string, baseKey []byte, o *Options, logger logging.Logger) (db *DB ...@@ -166,7 +166,15 @@ func New(path string, baseKey []byte, o *Options, logger logging.Logger) (db *DB
if db.capacity == 0 { if db.capacity == 0 {
db.capacity = defaultCapacity db.capacity = defaultCapacity
} }
db.logger.Infof("db capacity: %v", db.capacity)
capacityMB := float64(db.capacity*swarm.ChunkSize) * 9.5367431640625e-7
if capacityMB <= 1000 {
db.logger.Infof("database capacity: %d chunks (approximately %fMB)", db.capacity, capacityMB)
} else {
db.logger.Infof("database capacity: %d chunks (approximately %0.1fGB)", db.capacity, capacityMB/1000)
}
if maxParallelUpdateGC > 0 { if maxParallelUpdateGC > 0 {
db.updateGCSem = make(chan struct{}, maxParallelUpdateGC) db.updateGCSem = make(chan struct{}, maxParallelUpdateGC)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment