aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2019-05-14 22:07:44 +0800
committerPéter Szilágyi <peterke@gmail.com>2019-05-16 15:39:34 +0800
commit37d280da411eb649ce22ab69827ac5aacd46534b (patch)
tree8d19d2071c812575a14cea54a2de9efd2dd33157 /common
parent42c746d6f405deb0c49d868dcc6e0afe279e19ab (diff)
downloadgo-tangerine-37d280da411eb649ce22ab69827ac5aacd46534b.tar
go-tangerine-37d280da411eb649ce22ab69827ac5aacd46534b.tar.gz
go-tangerine-37d280da411eb649ce22ab69827ac5aacd46534b.tar.bz2
go-tangerine-37d280da411eb649ce22ab69827ac5aacd46534b.tar.lz
go-tangerine-37d280da411eb649ce22ab69827ac5aacd46534b.tar.xz
go-tangerine-37d280da411eb649ce22ab69827ac5aacd46534b.tar.zst
go-tangerine-37d280da411eb649ce22ab69827ac5aacd46534b.zip
core, cmd, vendor: fixes and database inspection tool (#15)
* core, eth: some fixes for freezer * vendor, core/rawdb, cmd/geth: add db inspector * core, cmd/utils: check ancient store path forceily * cmd/geth, common, core/rawdb: a few fixes * cmd/geth: support windows file rename and fix rename error * core: support ancient plugin * core, cmd: streaming file copy * cmd, consensus, core, tests: keep genesis in leveldb * core: write txlookup during ancient init * core: bump database version
Diffstat (limited to 'common')
-rw-r--r--common/size.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/common/size.go b/common/size.go
index 6381499a4..097b6304a 100644
--- a/common/size.go
+++ b/common/size.go
@@ -26,7 +26,11 @@ type StorageSize float64
// String implements the stringer interface.
func (s StorageSize) String() string {
- if s > 1048576 {
+ if s > 1099511627776 {
+ return fmt.Sprintf("%.2f TiB", s/1099511627776)
+ } else if s > 1073741824 {
+ return fmt.Sprintf("%.2f GiB", s/1073741824)
+ } else if s > 1048576 {
return fmt.Sprintf("%.2f MiB", s/1048576)
} else if s > 1024 {
return fmt.Sprintf("%.2f KiB", s/1024)
@@ -38,7 +42,11 @@ func (s StorageSize) String() string {
// TerminalString implements log.TerminalStringer, formatting a string for console
// output during logging.
func (s StorageSize) TerminalString() string {
- if s > 1048576 {
+ if s > 1099511627776 {
+ return fmt.Sprintf("%.2fTiB", s/1099511627776)
+ } else if s > 1073741824 {
+ return fmt.Sprintf("%.2fGiB", s/1073741824)
+ } else if s > 1048576 {
return fmt.Sprintf("%.2fMiB", s/1048576)
} else if s > 1024 {
return fmt.Sprintf("%.2fKiB", s/1024)