github.com/benchkram/bob@v0.0.0-20240314204020-b7a57f2f9be9/bob/playbook/options.go (about)

     1  package playbook
     2  
     3  import (
     4  	"github.com/benchkram/bob/pkg/store"
     5  )
     6  
     7  type Option func(p *Playbook)
     8  
     9  func WithCachingEnabled(enable bool) Option {
    10  	return func(p *Playbook) {
    11  		p.enableCaching = enable
    12  	}
    13  }
    14  
    15  func WithPushEnabled(enable bool) Option {
    16  	return func(p *Playbook) {
    17  		p.enablePush = enable
    18  	}
    19  }
    20  
    21  func WithPullEnabled(enable bool) Option {
    22  	return func(p *Playbook) {
    23  		p.enablePull = enable
    24  	}
    25  }
    26  
    27  func WithPredictedNumOfTasks(tasks int) Option {
    28  	return func(p *Playbook) {
    29  		p.predictedNumOfTasks = tasks
    30  	}
    31  }
    32  
    33  func WithMaxParallel(maxParallel int) Option {
    34  	return func(p *Playbook) {
    35  		p.maxParallel = maxParallel
    36  	}
    37  }
    38  
    39  func WithRemoteStore(s store.Store) Option {
    40  	return func(p *Playbook) {
    41  		p.remoteStore = s
    42  	}
    43  }
    44  
    45  func WithLocalStore(s store.Store) Option {
    46  	return func(p *Playbook) {
    47  		p.localStore = s
    48  	}
    49  }