github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/module/mempool/model/approval_map_entity.go (about)

     1  package model
     2  
     3  import (
     4  	"github.com/onflow/flow-go/model/flow"
     5  )
     6  
     7  // ApprovalMapEntity is an internal data structure for the approval mempool.
     8  // It implements a key-value entry where a chunk is associated with a map of
     9  // approvals indexed by approver ID.
    10  type ApprovalMapEntity struct {
    11  	ChunkKey   flow.Identifier
    12  	ResultID   flow.Identifier
    13  	ChunkIndex uint64
    14  	Approvals  map[flow.Identifier]*flow.ResultApproval // [approver_id] => approval
    15  }
    16  
    17  // ID implements flow.Entity.ID for ApprovalMapEntity to make it capable of
    18  // being stored directly in mempools and storage.
    19  func (a *ApprovalMapEntity) ID() flow.Identifier {
    20  	return a.ChunkKey
    21  }
    22  
    23  // CheckSum implements flow.Entity.CheckSum for ApprovalMapEntity to make it
    24  // capable of being stored directly in mempools and storage. It makes the id of
    25  // the entire ApprovalMapEntity.
    26  func (a *ApprovalMapEntity) Checksum() flow.Identifier {
    27  	return flow.MakeID(a)
    28  }