github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/orbiter/kinds/loadbalancers/dynamic/wrap/machinelb.go (about)

     1  package wrap
     2  
     3  import (
     4  	"github.com/caos/orbos/internal/operator/orbiter/kinds/clusters/core/infra"
     5  )
     6  
     7  type cmpLB struct {
     8  	infra.Machine
     9  	desire func() error
    10  }
    11  
    12  func machine(machine infra.Machine, desire func() error) infra.Machine {
    13  	return &cmpLB{
    14  		Machine: machine,
    15  		desire:  desire,
    16  	}
    17  }
    18  
    19  func (c *cmpLB) Destroy() (func() error, error) {
    20  	remove, err := c.Machine.Destroy()
    21  	if err != nil {
    22  		return nil, err
    23  	}
    24  	return remove, c.desire()
    25  }