github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/storage/badger/operation/views.go (about) 1 package operation 2 3 import ( 4 "github.com/dgraph-io/badger/v2" 5 6 "github.com/onflow/flow-go/consensus/hotstuff" 7 "github.com/onflow/flow-go/model/flow" 8 ) 9 10 // InsertSafetyData inserts safety data into the database. 11 func InsertSafetyData(chainID flow.ChainID, safetyData *hotstuff.SafetyData) func(*badger.Txn) error { 12 return insert(makePrefix(codeSafetyData, chainID), safetyData) 13 } 14 15 // UpdateSafetyData updates safety data in the database. 16 func UpdateSafetyData(chainID flow.ChainID, safetyData *hotstuff.SafetyData) func(*badger.Txn) error { 17 return update(makePrefix(codeSafetyData, chainID), safetyData) 18 } 19 20 // RetrieveSafetyData retrieves safety data from the database. 21 func RetrieveSafetyData(chainID flow.ChainID, safetyData *hotstuff.SafetyData) func(*badger.Txn) error { 22 return retrieve(makePrefix(codeSafetyData, chainID), safetyData) 23 } 24 25 // InsertLivenessData inserts liveness data into the database. 26 func InsertLivenessData(chainID flow.ChainID, livenessData *hotstuff.LivenessData) func(*badger.Txn) error { 27 return insert(makePrefix(codeLivenessData, chainID), livenessData) 28 } 29 30 // UpdateLivenessData updates liveness data in the database. 31 func UpdateLivenessData(chainID flow.ChainID, livenessData *hotstuff.LivenessData) func(*badger.Txn) error { 32 return update(makePrefix(codeLivenessData, chainID), livenessData) 33 } 34 35 // RetrieveLivenessData retrieves liveness data from the database. 36 func RetrieveLivenessData(chainID flow.ChainID, livenessData *hotstuff.LivenessData) func(*badger.Txn) error { 37 return retrieve(makePrefix(codeLivenessData, chainID), livenessData) 38 }