github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/network/alsp/internal/cache_entity.go (about) 1 package internal 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 "github.com/onflow/flow-go/network/alsp/model" 6 ) 7 8 // ProtocolSpamRecordEntity is an entity that represents a spam record. It is internally 9 // used by the SpamRecordCache to store the spam records in the cache. 10 // The identifier of this entity is the origin id of the spam record. This entails that the spam records 11 // are deduplicated by origin id. 12 type ProtocolSpamRecordEntity struct { 13 model.ProtocolSpamRecord 14 } 15 16 var _ flow.Entity = (*ProtocolSpamRecordEntity)(nil) 17 18 // ID returns the origin id of the spam record, which is used as the unique identifier of the entity for maintenance and 19 // deduplication purposes in the cache. 20 func (p ProtocolSpamRecordEntity) ID() flow.Identifier { 21 return p.OriginId 22 } 23 24 // Checksum returns the origin id of the spam record, it does not have any purpose in the cache. 25 // It is implemented to satisfy the flow.Entity interface. 26 func (p ProtocolSpamRecordEntity) Checksum() flow.Identifier { 27 return p.OriginId 28 }