Skip to content

Commit a8fa698

Browse files
ARR4Nqdm12
andauthored
Apply suggestions from code review
Co-authored-by: Quentin McGaw <[email protected]> Signed-off-by: Arran Schlosberg <[email protected]>
1 parent 3deaa98 commit a8fa698

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

core/rawdb/database.libevm.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ func WithDatabaseMetadataKeys(isMetadata func(key []byte) bool) InspectDatabaseO
7979
})
8080
}
8181

82-
// WithDatabaseStatsTransformer returns an option that causes all statistics to
82+
// WithDatabaseStatsTransformer returns an option that causes all statistics rows to
8383
// be passed to the provided function, with its return value being printed
8484
// instead of the original values.
85-
func WithDatabaseStatsTransformer(transform func([][]string) [][]string) InspectDatabaseOption {
85+
// Each row contains 4 columns: database, category, size and count.
86+
func WithDatabaseStatsTransformer(transform func(rows [][]string) [][]string) InspectDatabaseOption {
8687
return newInspectOpt(func(c *inspectDatabaseConfig) {
8788
c.statsTransformer = transform
8889
})

core/rawdb/database.libevm_test.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,15 @@ import (
3232
func ExampleDatabaseStat() {
3333
var stat rawdb.DatabaseStat
3434

35-
stat.Add(common.StorageSize(0)) // only to demonstrate param type
36-
stat.Add(1)
35+
stat.Add(common.StorageSize(1)) // only to demonstrate param type
3736
stat.Add(2)
38-
stat.Add(4)
3937

4038
fmt.Println("Sum:", stat.Size()) // sum of all values passed to Add()
4139
fmt.Println("Count:", stat.Count()) // number of calls to Add()
4240

4341
// Output:
44-
// Sum: 7.00 B
45-
// Count: 4
42+
// Sum: 3.00 B
43+
// Count: 2
4644
}
4745

4846
func ExampleInspectDatabase() {
@@ -155,7 +153,7 @@ func (s *stubDatabase) Get(key []byte) ([]byte, error) {
155153
return nil, nil
156154
}
157155

158-
func (s *stubDatabase) ReadAncients(fn func(ethdb.AncientReaderOp) error) (err error) {
156+
func (s *stubDatabase) ReadAncients(fn func(ethdb.AncientReaderOp) error) error {
159157
return nil
160158
}
161159

@@ -178,8 +176,7 @@ func (s *stubIterator) pos() int {
178176

179177
func (s *stubIterator) Next() bool {
180178
s.i++
181-
available := s.pos() < len(s.kvs)
182-
return available
179+
return s.pos() < len(s.kvs)
183180
}
184181

185182
func (s *stubIterator) Release() {}

0 commit comments

Comments
 (0)