github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/environs/context/distribution.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package context
     5  
     6  import "github.com/juju/juju/core/instance"
     7  
     8  // Distributor is an interface that may be used to distribute
     9  // application units across instances for high availability.
    10  type Distributor interface {
    11  	// DistributeInstances takes a set of clean, empty instances,
    12  	// a distribution group, and list of zones to limit the consideration to.
    13  	// If the input zone collection has no elements, then all availability
    14  	// zones are considered when attempting distribution.
    15  	// It returns the subset of candidates that the policy will allow to enter
    16  	// the distribution group.
    17  	//
    18  	// The AssignClean and AssignCleanEmpty unit assignment policies will
    19  	// attempt to assign a unit to each of the resulting instances until one is
    20  	// successful. If no instances can be assigned to (e.g. because of
    21  	// concurrent deployments), then a new machine will be allocated.
    22  	DistributeInstances(
    23  		ctx ProviderCallContext, candidates, distributionGroup []instance.Id, limitZones []string,
    24  	) ([]instance.Id, error)
    25  }