github.com/koko1123/flow-go-1@v0.29.6/storage/commits.go (about)

     1  package storage
     2  
     3  import (
     4  	"github.com/koko1123/flow-go-1/model/flow"
     5  )
     6  
     7  // Commits represents persistent storage for state commitments.
     8  type Commits interface {
     9  
    10  	// Store will store a commit in the persistent storage.
    11  	Store(blockID flow.Identifier, commit flow.StateCommitment) error
    12  
    13  	// BatchStore stores Commit keyed by blockID in provided batch
    14  	// No errors are expected during normal operation, even if no entries are matched.
    15  	// If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned.
    16  	BatchStore(blockID flow.Identifier, commit flow.StateCommitment, batch BatchStorage) error
    17  
    18  	// ByBlockID will retrieve a commit by its ID from persistent storage.
    19  	ByBlockID(blockID flow.Identifier) (flow.StateCommitment, error)
    20  
    21  	// BatchRemoveByBlockID removes Commit keyed by blockID in provided batch
    22  	// No errors are expected during normal operation, even if no entries are matched.
    23  	// If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned.
    24  	BatchRemoveByBlockID(blockID flow.Identifier, batch BatchStorage) error
    25  }