github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/storage/qcs.go (about) 1 package storage 2 3 import ( 4 "github.com/onflow/flow-go/model/flow" 5 "github.com/onflow/flow-go/storage/badger/transaction" 6 ) 7 8 // QuorumCertificates represents storage for Quorum Certificates. 9 // Quorum Certificates are distributed using blocks, where a block incorporates a QC for its parent. 10 // When stored, QCs are indexed by the ID of the block they certify (not the block they are included within). 11 // In the example below, `QC_1` is indexed by `Block_1.ID()` 12 // Block_1 <- Block_2(QC_1) 13 type QuorumCertificates interface { 14 // StoreTx stores a Quorum Certificate as part of database transaction QC is indexed by QC.BlockID. 15 // * storage.ErrAlreadyExists if any QC for blockID is already stored 16 StoreTx(qc *flow.QuorumCertificate) func(*transaction.Tx) error 17 // ByBlockID returns QC that certifies block referred by blockID. 18 // * storage.ErrNotFound if no QC for blockID doesn't exist. 19 ByBlockID(blockID flow.Identifier) (*flow.QuorumCertificate, error) 20 }