juju: github.com/juju/juju/environs/context Index | Files

package context

import "github.com/juju/juju/environs/context"


Package Files

callcontext.go distribution.go

type CloudCallContext Uses

type CloudCallContext struct {
    // InvalidateCredentialFunc is the actual callback function
    // that invalidates the credential used in the context of this call.
    InvalidateCredentialFunc func(string) error

    // DyingFunc returns the dying chan.
    DyingFunc Dying

CloudCallContext is a context intended to provide behaviors that are necessary to make a valid and lean call to an underlying substrate, for example cloud API.

For instance, when Juju makes a call to cloud API with an expired credential, we might not yet know that it is expired until cloud API rejects it. However, we do know in advance, before making the call, that we want to mark this credential as invalid if the cloud API rejects it. How credential will be found, where it is stored in Juju data model, what calls need to be done to mark it so, will be the responsibility of internal functions that are passed in to this context as this knowledge is specific to where the call was made *from* not on what object it was made.

func NewCloudCallContext Uses

func NewCloudCallContext() *CloudCallContext

func (*CloudCallContext) Dying Uses

func (c *CloudCallContext) Dying() <-chan struct{}

Dying returns the dying chan.

func (*CloudCallContext) InvalidateCredential Uses

func (c *CloudCallContext) InvalidateCredential(reason string) error

InvalidateCredential implements context.InvalidateCredentialCallback.

type Distributor Uses

type Distributor interface {
    // DistributeInstances takes a set of clean, empty instances,
    // a distribution group, and list of zones to limit the consideration to.
    // If the input zone collection has no elements, then all availability
    // zones are considered when attempting distribution.
    // It returns the subset of candidates that the policy will allow to enter
    // the distribution group.
    // The AssignClean and AssignCleanEmpty unit assignment policies will
    // attempt to assign a unit to each of the resulting instances until one is
    // successful. If no instances can be assigned to (e.g. because of
    // concurrent deployments), then a new machine will be allocated.
        ctx ProviderCallContext, candidates, distributionGroup []instance.Id, limitZones []string,
    ) ([]instance.Id, error)

Distributor is an interface that may be used to distribute application units across instances for high availability.

type Dying Uses

type Dying func() <-chan struct{}

Dying returns the dying chan.

type ProviderCallContext Uses

type ProviderCallContext interface {

    // InvalidateCredential provides means to invalidate a credential
    // that is used to make a call.
    InvalidateCredential(string) error

    // Dying returns the dying chan.
    Dying() <-chan struct{}

ProviderCallContext exposes useful capabilities when making calls to an underlying cloud substrate.

Package context imports 2 packages (graph) and is imported by 223 packages. Updated 2018-12-25. Refresh now. Tools for package owners.