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

     1  package operation
     2  
     3  import (
     4  	"github.com/dgraph-io/badger/v3"
     5  
     6  	"github.com/koko1123/flow-go-1/model/flow"
     7  )
     8  
     9  // InsertStartedView inserts a view into the database.
    10  func InsertStartedView(chainID flow.ChainID, view uint64) func(*badger.Txn) error {
    11  	return insert(makePrefix(codeStartedView, chainID), view)
    12  }
    13  
    14  // UpdateStartedView updates the view in the database.
    15  func UpdateStartedView(chainID flow.ChainID, view uint64) func(*badger.Txn) error {
    16  	return update(makePrefix(codeStartedView, chainID), view)
    17  }
    18  
    19  // RetrieveStartedView retrieves a view from the database.
    20  func RetrieveStartedView(chainID flow.ChainID, view *uint64) func(*badger.Txn) error {
    21  	return retrieve(makePrefix(codeStartedView, chainID), view)
    22  }
    23  
    24  // InsertVotedView inserts a view into the database.
    25  func InsertVotedView(chainID flow.ChainID, view uint64) func(*badger.Txn) error {
    26  	return insert(makePrefix(codeVotedView, chainID), view)
    27  }
    28  
    29  // UpdateVotedView updates the view in the database.
    30  func UpdateVotedView(chainID flow.ChainID, view uint64) func(*badger.Txn) error {
    31  	return update(makePrefix(codeVotedView, chainID), view)
    32  }
    33  
    34  // RetrieveVotedView retrieves a view from the database.
    35  func RetrieveVotedView(chainID flow.ChainID, view *uint64) func(*badger.Txn) error {
    36  	return retrieve(makePrefix(codeVotedView, chainID), view)
    37  }