github.com/openshift/installer@v1.4.17/pkg/asset/parents.go (about)

     1  package asset
     2  
     3  import (
     4  	"reflect"
     5  )
     6  
     7  // Parents is the collection of assets upon which another asset is directly
     8  // dependent.
     9  type Parents map[reflect.Type]Asset
    10  
    11  // Add adds the specified assets to the parents collection.
    12  func (p Parents) Add(assets ...Asset) {
    13  	for _, a := range assets {
    14  		p[reflect.TypeOf(a)] = a
    15  	}
    16  }
    17  
    18  // Get populates the state of the specified assets with the state stored in the
    19  // parents collection.
    20  func (p Parents) Get(assets ...Asset) {
    21  	for _, a := range assets {
    22  		reflect.ValueOf(a).Elem().Set(reflect.ValueOf(p[reflect.TypeOf(a)]).Elem())
    23  	}
    24  }