github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/component/runnable.go (about)

     1  package component
     2  
     3  import "context"
     4  
     5  // Runnable represents a workload to execute.
     6  type Runnable interface {
     7  	// Run is invoked repeatedly. The component should perform whatever work is
     8  	// available and return.
     9  	Run(context.Context) error
    10  }
    11  
    12  // RunFunc turns a simple function into a Runnable.
    13  type RunFunc func(context.Context) error
    14  
    15  func (f RunFunc) Run(ctx context.Context) error {
    16  	return f(ctx)
    17  }