github.com/koko1123/flow-go-1@v0.29.6/storage/badger/operation/children.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  // InsertBlockChildren insert an index to lookup the direct child of a block by its ID
    10  func InsertBlockChildren(blockID flow.Identifier, childrenIDs flow.IdentifierList) func(*badger.Txn) error {
    11  	return insert(makePrefix(codeBlockChildren, blockID), childrenIDs)
    12  }
    13  
    14  // UpdateBlockChildren updates the children for a block.
    15  func UpdateBlockChildren(blockID flow.Identifier, childrenIDs flow.IdentifierList) func(*badger.Txn) error {
    16  	return update(makePrefix(codeBlockChildren, blockID), childrenIDs)
    17  }
    18  
    19  // RetrieveBlockChildren the child block ID by parent block ID
    20  func RetrieveBlockChildren(blockID flow.Identifier, childrenIDs *flow.IdentifierList) func(*badger.Txn) error {
    21  	return retrieve(makePrefix(codeBlockChildren, blockID), childrenIDs)
    22  }