-
Notifications
You must be signed in to change notification settings - Fork 179
/
meter.go
67 lines (52 loc) · 1.45 KB
/
meter.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package noop
import (
"github.com/onflow/cadence/runtime/common"
interfaceMeter "github.com/onflow/flow-go/fvm/meter"
)
var _ interfaceMeter.Meter = &Meter{}
// Meter is a noop meter
type Meter struct{}
// NewMeter construct a new noop meter
func NewMeter() *Meter {
return &Meter{}
}
// NewChild returns a new noop meter
func (m *Meter) NewChild() interfaceMeter.Meter {
return &Meter{}
}
// MergeMeter merges two noop meters
func (m *Meter) MergeMeter(child interfaceMeter.Meter, enforceLimits bool) error {
return nil
}
// MeterComputation is a noop
func (m *Meter) MeterComputation(_ common.ComputationKind, _ uint) error {
return nil
}
// ComputationIntensities returns an empty map
func (m *Meter) ComputationIntensities() interfaceMeter.MeteredIntensities {
return map[common.ComputationKind]uint{}
}
// TotalComputationUsed always returns zero
func (m *Meter) TotalComputationUsed() uint {
return 0
}
// TotalComputationLimit always returns zero
func (m *Meter) TotalComputationLimit() uint {
return 0
}
// MeterMemory is a noop
func (m *Meter) MeterMemory(_ common.ComputationKind, _ uint) error {
return nil
}
// MemoryIntensities returns an empty map
func (m *Meter) MemoryIntensities() interfaceMeter.MeteredIntensities {
return map[common.ComputationKind]uint{}
}
// TotalMemoryUsed always returns zero
func (m *Meter) TotalMemoryUsed() uint {
return 0
}
// TotalMemoryLimit always returns zero
func (m *Meter) TotalMemoryLimit() uint {
return 0
}