Skip to content

Commit

Permalink
changing name to dummyCache
Browse files Browse the repository at this point in the history
  • Loading branch information
otherview committed Nov 19, 2024
1 parent e9b1556 commit 5d9b776
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
18 changes: 18 additions & 0 deletions muxdb/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,21 @@ func (cs *cacheStats) ShouldLog(msg string) (func(), bool) {
cs.flag.Store(flag)
}, cs.flag.Load() != flag
}

type dummyCache struct{}

// AddNodeBlob is a no-op.
func (*dummyCache) AddNodeBlob(_ *[]byte, _ string, _ []byte, _ trie.Version, _ []byte, _ bool) {}

// GetNodeBlob always returns nil.
func (*dummyCache) GetNodeBlob(_ *[]byte, _ string, _ []byte, _ trie.Version, _ bool) []byte {
return nil
}

// AddRootNode is a no-op.
func (*dummyCache) AddRootNode(_ string, _ trie.Node) {}

// GetRootNode always returns nil.
func (*dummyCache) GetRootNode(_ string, _ trie.Version) trie.Node {
return nil
}
22 changes: 0 additions & 22 deletions muxdb/empty_cache.go

This file was deleted.

2 changes: 1 addition & 1 deletion muxdb/muxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func NewMem() *MuxDB {
engine: engine,
trieBackend: &backend{
Store: engine,
Cache: &emptyCache{},
Cache: &dummyCache{},
HistPtnFactor: 1,
DedupedPtnFactor: 1,
CachedNodeTTL: 32,
Expand Down
2 changes: 1 addition & 1 deletion muxdb/trie_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func newTestBackend() *backend {
engine := newTestEngine()
return &backend{
Store: engine,
Cache: &emptyCache{},
Cache: &dummyCache{},
HistPtnFactor: 1,
DedupedPtnFactor: 1,
CachedNodeTTL: 100,
Expand Down

0 comments on commit 5d9b776

Please sign in to comment.