github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/mempool/model/id_map_entity.go (about) 1 package model 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 ) 6 7 // IdMapEntity is an internal data structure for mempool 8 // It implements a key-value entry where an identifier is mapped to a list of other identifiers. 9 type IdMapEntity struct { 10 Key flow.Identifier 11 IDs map[flow.Identifier]struct{} 12 } 13 14 // ID implements flow.Entity.ID for IdMapEntity to make it capable of being stored directly 15 // in mempools and storage. It returns key field of the id. 16 func (id IdMapEntity) ID() flow.Identifier { 17 return id.Key 18 } 19 20 // CheckSum implements flow.Entity.CheckSum for IdMapEntity to make it capable of being stored directly 21 // in mempools and storage. It makes the id of the entire IdMapEntity. 22 func (id IdMapEntity) Checksum() flow.Identifier { 23 return flow.MakeID(id) 24 }