-
Notifications
You must be signed in to change notification settings - Fork 178
/
entity.go
32 lines (25 loc) · 888 Bytes
/
entity.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
package execution_data
import (
"github.com/onflow/flow-go/model/flow"
)
// BlockExecutionDataEntity is a wrapper around BlockExecutionData that implements the flow.Entity
// interface to support caching with Herocache
type BlockExecutionDataEntity struct {
*BlockExecutionData
// id holds the cached BlockExecutionData ID. The ID generation process is expensive, so this
// entity interface exclusively uses a pre-calculated value.
id flow.Identifier
}
var _ flow.Entity = (*BlockExecutionDataEntity)(nil)
func NewBlockExecutionDataEntity(id flow.Identifier, executionData *BlockExecutionData) *BlockExecutionDataEntity {
return &BlockExecutionDataEntity{
id: id,
BlockExecutionData: executionData,
}
}
func (c BlockExecutionDataEntity) ID() flow.Identifier {
return c.id
}
func (c BlockExecutionDataEntity) Checksum() flow.Identifier {
return c.id
}