instanceiterator

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIteratorState

func NewIteratorState(canaryInstances, allInstances []service.Instance, canaryLimit int) (*iteratorState, error)

Types

type BOSHTriggerer added in v0.32.0

type BOSHTriggerer struct {
	// contains filtered or unexported fields
}

func NewBOSHUpgradeTriggerer added in v0.32.0

func NewBOSHUpgradeTriggerer(brokerServices BrokerServices) *BOSHTriggerer

func NewRecreateTriggerer

func NewRecreateTriggerer(brokerServices BrokerServices) *BOSHTriggerer

func (*BOSHTriggerer) Check added in v0.32.0

func (t *BOSHTriggerer) Check(serviceInstanceGUID string, operationData broker.OperationData) (TriggeredOperation, error)

func (*BOSHTriggerer) TriggerOperation added in v0.32.0

func (t *BOSHTriggerer) TriggerOperation(instance service.Instance) (TriggeredOperation, error)

type BrokerServices

type BrokerServices interface {
	ProcessInstance(instance service.Instance, operationType string) (services.BOSHOperation, error)
	LastOperation(instance string, operationData broker.OperationData) (domain.LastOperation, error)
	Instances(filter map[string]string) ([]service.Instance, error)
	LatestInstanceInfo(inst service.Instance) (service.Instance, error)
}

type Builder

type Builder struct {
	BrokerServices        BrokerServices
	PollingInterval       time.Duration
	AttemptInterval       time.Duration
	AttemptLimit          int
	MaxInFlight           int
	Canaries              int
	Listener              Listener
	Sleeper               sleeper
	Triggerer             Triggerer
	CanarySelectionParams config.CanarySelectionParams
}

func NewBuilder

func NewBuilder(conf config.InstanceIteratorConfig, logger *log.Logger, logPrefix string) (*Builder, error)

func (*Builder) SetRecreateTriggerer

func (b *Builder) SetRecreateTriggerer() error

func (*Builder) SetUpgradeTriggerer

func (b *Builder) SetUpgradeTriggerer(cfClient CFClient, maintenanceInfoPresent bool, logger *log.Logger) error

type CFClient added in v0.32.0

type CFClient interface {
	CheckMinimumOSBAPIVersion(minimum string, logger *log.Logger) bool
	GetServiceInstance(serviceInstanceGUID string, logger *log.Logger) (cf.ServiceInstanceResource, error)
	UpgradeServiceInstance(serviceInstanceGUID string, maintenanceInfo cf.MaintenanceInfo, logger *log.Logger) (cf.LastOperation, error)
	GetLastOperationForInstance(serviceInstanceGUID string, logger *log.Logger) (cf.LastOperation, error)
	GetPlanByServiceInstanceGUID(planUniqueID string, logger *log.Logger) (cf.ServicePlan, error)
}

type CFTriggerer added in v0.32.0

type CFTriggerer struct {
	// contains filtered or unexported fields
}

func NewCFTrigger added in v0.32.0

func NewCFTrigger(client CFClient, logger *log.Logger) *CFTriggerer

func (*CFTriggerer) Check added in v0.32.0

func (t *CFTriggerer) Check(serviceInstanceGUID string, operationData broker.OperationData) (TriggeredOperation, error)

func (*CFTriggerer) TriggerOperation added in v0.32.0

func (t *CFTriggerer) TriggerOperation(instance service.Instance) (TriggeredOperation, error)

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

func New

func New(builder *Builder) *Iterator

func (*Iterator) Iterate

func (it *Iterator) Iterate() error

func (*Iterator) IterateInstancesWithAttempts

func (it *Iterator) IterateInstancesWithAttempts() error

type Listener

type Listener interface {
	FailedToRefreshInstanceInfo(instance string)
	Starting(maxInFlight int)
	RetryAttempt(num, limit int)
	RetryCanariesAttempt(num, limit, remainingCanaries int)
	InstancesToProcess(instances []service.Instance)
	InstanceOperationStarting(instance string, index int, totalInstances int, isCanary bool)
	InstanceOperationStartResult(instance string, status OperationState)
	InstanceOperationFinished(instance string, result string)
	WaitingFor(instance string, boshTaskId int)
	Progress(pollingInterval time.Duration, orphanCount, processedCount, skippedCount, toRetryCount, deletedCount int)
	Finished(orphanCount, finishedCount, skippedCount, deletedCount int, busyInstances, failedInstances []string)
	CanariesStarting(canaries int, filter config.CanarySelectionParams)
	CanariesFinished()
	UpgradeStrategy(strategy string)
}

func NewLoggingListener

func NewLoggingListener(logger *log.Logger, processType string) Listener

type LoggingListener

type LoggingListener struct {
	// contains filtered or unexported fields
}

func (LoggingListener) CanariesFinished

func (ll LoggingListener) CanariesFinished()

func (LoggingListener) CanariesStarting

func (ll LoggingListener) CanariesStarting(canaries int, filter config.CanarySelectionParams)

func (LoggingListener) FailedToRefreshInstanceInfo

func (ll LoggingListener) FailedToRefreshInstanceInfo(instance string)

func (LoggingListener) Finished

func (ll LoggingListener) Finished(orphanCount, finishedCount, skippedCount, deletedCount int, busyInstances, failedInstances []string)

func (LoggingListener) InstanceOperationFinished

func (ll LoggingListener) InstanceOperationFinished(instance string, result string)

func (LoggingListener) InstanceOperationStartResult

func (ll LoggingListener) InstanceOperationStartResult(instance string, status OperationState)

func (LoggingListener) InstanceOperationStarting

func (ll LoggingListener) InstanceOperationStarting(instance string, index, totalInstances int, isCanary bool)

func (LoggingListener) InstancesToProcess

func (ll LoggingListener) InstancesToProcess(instances []service.Instance)

func (LoggingListener) Progress

func (ll LoggingListener) Progress(pollingInterval time.Duration, orphanCount, processedCount, skippedCount, toRetryCount, deletedCount int)

func (LoggingListener) RetryAttempt

func (ll LoggingListener) RetryAttempt(num, limit int)

func (LoggingListener) RetryCanariesAttempt

func (ll LoggingListener) RetryCanariesAttempt(attempt, limit, remainingCanaries int)

func (LoggingListener) Starting

func (ll LoggingListener) Starting(maxInFlight int)

func (LoggingListener) UpgradeStrategy added in v0.32.0

func (ll LoggingListener) UpgradeStrategy(strategy string)

func (LoggingListener) WaitingFor

func (ll LoggingListener) WaitingFor(instance string, boshTaskId int)

type OperationState added in v0.32.0

type OperationState string
const (
	OperationAccepted   OperationState = "accepted"
	OperationSucceeded  OperationState = "succeeded"
	OperationSkipped    OperationState = "skipped"
	OperationFailed     OperationState = "failed"
	OperationInProgress OperationState = "busy"
	InstanceNotFound    OperationState = "instance-not-found"
	OperationPending    OperationState = "not-started"
	OrphanDeployment    OperationState = "orphan-deployment"
)

type TriggeredOperation added in v0.32.0

type TriggeredOperation struct {
	State       OperationState
	Data        broker.OperationData
	Description string
}

type Triggerer

type Triggerer interface {
	TriggerOperation(service.Instance) (TriggeredOperation, error)
	Check(string, broker.OperationData) (TriggeredOperation, error)
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL