github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/internal/operator/nodeagent/dep/middleware/dep.go (about)

     1  package middleware
     2  
     3  import "github.com/caos/orbos/internal/operator/nodeagent"
     4  
     5  type Installer interface {
     6  	nodeagent.Installer
     7  	original() nodeagent.Installer
     8  }
     9  
    10  func Unwrap(w nodeagent.Installer) nodeagent.Installer {
    11  	if u, ok := w.(Installer); ok {
    12  		return Unwrap(u.original())
    13  	}
    14  
    15  	return w
    16  }
    17  
    18  type wrapped struct {
    19  	o nodeagent.Installer
    20  }
    21  
    22  func (l *wrapped) original() nodeagent.Installer {
    23  	return l.o
    24  }
    25  
    26  func (l *wrapped) Is(other nodeagent.Installer) bool {
    27  	return Unwrap(l.o).Is(Unwrap(other))
    28  }
    29  
    30  func (l *wrapped) String() string {
    31  	return Unwrap(l.o).String()
    32  }
    33  
    34  func (l *wrapped) Equals(other nodeagent.Installer) bool {
    35  	return Unwrap(l.o).Equals(Unwrap(other))
    36  }