facade

package
v0.0.0-...-88aa921 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2015 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPoolExists    = errors.New("facade: resource pool exists")
	ErrPoolNotExists = errors.New("facade: resource pool does not exist")
	ErrIPExists      = errors.New("facade: ip exists in resource pool")
	ErrIPNotExists   = errors.New("facade: ip does not exist in resource pool")
)
View Source
var LogstashContainerReloader reloadLogstashContainer = reloadLogstashContainerImpl

Functions

func UpdateDeployTemplateStatus

func UpdateDeployTemplateStatus(deploymentID string, status string)

UpdateDeployTemplateStatus updates the deployment status of the service being deployed

Types

type Facade

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

Facade is an entrypoint to available controlplane methods

func New

func New(dockerRegistry string) *Facade

New creates an initialized Facade instance

func (*Facade) AddHost

func (f *Facade) AddHost(ctx datastore.Context, entity *host.Host) error

AddHost register a host with serviced. Returns an error if host already exists or if the host's IP is a virtual IP

func (*Facade) AddResourcePool

func (f *Facade) AddResourcePool(ctx datastore.Context, entity *pool.ResourcePool) error

AddResourcePool adds a new resource pool

func (*Facade) AddService

func (f *Facade) AddService(ctx datastore.Context, svc service.Service) error

AddService adds a service; return error if service already exists

func (*Facade) AddServiceTemplate

func (f *Facade) AddServiceTemplate(ctx datastore.Context, serviceTemplate servicetemplate.ServiceTemplate) (string, error)

AddServiceTemplate adds a service template to the system. Returns the id of the template added

func (*Facade) AddVirtualIP

func (f *Facade) AddVirtualIP(ctx datastore.Context, vip pool.VirtualIP) error

AddVirtualIP adds a virtualIP to a pool

func (*Facade) AssignIPs

func (f *Facade) AssignIPs(ctx datastore.Context, request dao.AssignmentRequest) error

func (*Facade) CreateDefaultPool

func (f *Facade) CreateDefaultPool(ctx datastore.Context, id string) error

CreateDefaultPool creates the default pool if it does not exists, it is idempotent

func (*Facade) DeployService

func (f *Facade) DeployService(ctx datastore.Context, poolID, parentID string, overwrite bool, svcDef servicedefinition.ServiceDefinition) (string, error)

DeployService converts a service definition to a service and deploys it under a specific service. If the overwrite option is enabled, existing services with the same name will be overwritten, otherwise services may only be added.

func (*Facade) DeployTemplate

func (f *Facade) DeployTemplate(ctx datastore.Context, poolID string, templateID string, deploymentID string) ([]string, error)

DeployTemplate creates and deployes a service to the pool and returns the tenant id of the newly deployed service

func (*Facade) DeployTemplateActive

func (f *Facade) DeployTemplateActive(active *[]map[string]string) error

gather a list of all active DeploymentIDs

func (*Facade) DeployTemplateStatus

func (f *Facade) DeployTemplateStatus(deploymentID string, status *string) error

DeployTemplateStatus sets the status of a deployed service or template

func (*Facade) FindAssignmentByHostPort

func (f *Facade) FindAssignmentByHostPort(ctx datastore.Context, ipAddr string, port uint16) (*addressassignment.AddressAssignment, error)

func (*Facade) FindAssignmentByServiceEndpoint

func (f *Facade) FindAssignmentByServiceEndpoint(ctx datastore.Context, serviceID, endpointName string) (*addressassignment.AddressAssignment, error)

GetAddressAssignmentsByEndpoint returns the address assignment by serviceID and endpoint name

func (*Facade) FindChildService

func (f *Facade) FindChildService(ctx datastore.Context, parentServiceID string, childName string) (*service.Service, error)

FindChildService walks services below the service specified by serviceId, checking to see if childName matches the service's name. If so, it returns it.

func (*Facade) FindHostsInPool

func (f *Facade) FindHostsInPool(ctx datastore.Context, poolID string) ([]host.Host, error)

FindHostsInPool returns a list of all hosts with poolID

func (*Facade) GetActiveHostIDs

func (f *Facade) GetActiveHostIDs(ctx datastore.Context) ([]string, error)

func (*Facade) GetHealthChecksForService

func (f *Facade) GetHealthChecksForService(ctx datastore.Context, serviceID string) (map[string]domain.HealthCheck, error)

func (*Facade) GetHost

func (f *Facade) GetHost(ctx datastore.Context, hostID string) (*host.Host, error)

GetHost gets a host by id. Returns nil if host not found

func (*Facade) GetHostByIP

func (f *Facade) GetHostByIP(ctx datastore.Context, hostIP string) (*host.Host, error)

func (*Facade) GetHosts

func (f *Facade) GetHosts(ctx datastore.Context) ([]host.Host, error)

GetHosts returns a list of all registered hosts

func (*Facade) GetPoolForService

func (f *Facade) GetPoolForService(ctx datastore.Context, id string) (string, error)

func (*Facade) GetPoolIPs

func (f *Facade) GetPoolIPs(ctx datastore.Context, poolID string) (*PoolIPs, error)

GetPoolIPs gets all IPs available to a Pool

func (*Facade) GetResourcePool

func (f *Facade) GetResourcePool(ctx datastore.Context, id string) (*pool.ResourcePool, error)

GetResourcePool returns an ResourcePool ip id. nil if not found

func (*Facade) GetResourcePools

func (f *Facade) GetResourcePools(ctx datastore.Context) ([]pool.ResourcePool, error)

GetResourcePools Returns a list of all ResourcePools

func (*Facade) GetResourcePoolsByRealm

func (f *Facade) GetResourcePoolsByRealm(ctx datastore.Context, realm string) ([]pool.ResourcePool, error)

GetResourcePoolsByRealm Returns a list of all ResourcePools by Realm

func (*Facade) GetService

func (f *Facade) GetService(ctx datastore.Context, id string) (*service.Service, error)

func (*Facade) GetServiceAddressAssignments

func (f *Facade) GetServiceAddressAssignments(ctx datastore.Context, serviceID string, assignments *[]addressassignment.AddressAssignment) error

GetServiceAddressAssignments fills in all AddressAssignments for the specified serviced id.

func (*Facade) GetServiceAddressAssignmentsByPort

func (f *Facade) GetServiceAddressAssignmentsByPort(ctx datastore.Context, port uint16) ([]addressassignment.AddressAssignment, error)

func (*Facade) GetServiceEndpoints

func (f *Facade) GetServiceEndpoints(ctx datastore.Context, serviceId string) (map[string][]dao.ApplicationEndpoint, error)

Get a service endpoint.

func (*Facade) GetServiceStates

func (f *Facade) GetServiceStates(ctx datastore.Context, serviceID string) ([]servicestate.ServiceState, error)

GetServiceStates returns all the service states given a service ID

func (*Facade) GetServiceTemplates

func (f *Facade) GetServiceTemplates(ctx datastore.Context) (map[string]servicetemplate.ServiceTemplate, error)

func (*Facade) GetServices

func (f *Facade) GetServices(ctx datastore.Context, request dao.EntityRequest) ([]service.Service, error)

func (*Facade) GetServicesByPool

func (f *Facade) GetServicesByPool(ctx datastore.Context, poolID string) ([]service.Service, error)

GetServicesByPool looks up all services in a particular pool

func (*Facade) GetTaggedServices

func (f *Facade) GetTaggedServices(ctx datastore.Context, request dao.EntityRequest) ([]service.Service, error)

func (*Facade) GetTenantID

func (f *Facade) GetTenantID(ctx datastore.Context, serviceID string) (string, error)

The tenant id is the root service uuid. Walk the service tree to root to find the tenant id.

func (*Facade) HasIP

func (f *Facade) HasIP(ctx datastore.Context, poolID string, ipAddr string) (bool, error)

HasIP checks if a pool uses a particular IP address

func (*Facade) PauseService

func (f *Facade) PauseService(ctx datastore.Context, request dao.ScheduleServiceRequest) (int, error)

func (*Facade) RemoveAddressAssignment

func (f *Facade) RemoveAddressAssignment(ctx datastore.Context, id string) error

RemoveAddressAssignemnt Removes an AddressAssignment by id

func (*Facade) RemoveHost

func (f *Facade) RemoveHost(ctx datastore.Context, hostID string) (err error)

RemoveHost removes a Host from serviced

func (*Facade) RemoveResourcePool

func (f *Facade) RemoveResourcePool(ctx datastore.Context, id string) error

RemoveResourcePool removes a ResourcePool

func (*Facade) RemoveService

func (f *Facade) RemoveService(ctx datastore.Context, id string) error

func (*Facade) RemoveServiceTemplate

func (f *Facade) RemoveServiceTemplate(ctx datastore.Context, id string) error

RemoveServiceTemplate removes the service template from the system

func (*Facade) RemoveVirtualIP

func (f *Facade) RemoveVirtualIP(ctx datastore.Context, vip pool.VirtualIP) error

RemoveVirtualIP removes a virtual ip from a pool

func (*Facade) RestartService

func (f *Facade) RestartService(ctx datastore.Context, request dao.ScheduleServiceRequest) (int, error)

func (*Facade) RestoreIPs

func (f *Facade) RestoreIPs(ctx datastore.Context, svc service.Service) error

func (*Facade) ScheduleService

func (f *Facade) ScheduleService(ctx datastore.Context, serviceID string, autoLaunch bool, desiredState service.DesiredState) (int, error)

ScheduleService changes a service's desired state and returns the number of affected services

func (*Facade) ServiceUse

func (f *Facade) ServiceUse(ctx datastore.Context, serviceID string, imageName string, registry string, noOp bool) (string, error)

func (*Facade) StartService

func (f *Facade) StartService(ctx datastore.Context, request dao.ScheduleServiceRequest) (int, error)

func (*Facade) StopService

func (f *Facade) StopService(ctx datastore.Context, request dao.ScheduleServiceRequest) (int, error)

func (*Facade) UpdateHost

func (f *Facade) UpdateHost(ctx datastore.Context, entity *host.Host) error

UpdateHost information for a registered host

func (*Facade) UpdateResourcePool

func (f *Facade) UpdateResourcePool(ctx datastore.Context, entity *pool.ResourcePool) error

UpdateResourcePool updates an existing resource pool

func (*Facade) UpdateService

func (f *Facade) UpdateService(ctx datastore.Context, svc service.Service) error

func (*Facade) UpdateServiceTemplate

func (f *Facade) UpdateServiceTemplate(ctx datastore.Context, template servicetemplate.ServiceTemplate) error

UpdateServiceTemplate updates a service template

func (*Facade) WaitService

func (f *Facade) WaitService(ctx datastore.Context, dstate service.DesiredState, timeout time.Duration, serviceIDs ...string) error

WaitService waits for service/s to reach a particular desired state within the designated timeout

type FacadeInterface

type FacadeInterface interface {
	AddService(ctx datastore.Context, svc service.Service) error

	GetService(ctx datastore.Context, id string) (*service.Service, error)

	GetServices(ctx datastore.Context, request dao.EntityRequest) ([]service.Service, error)

	GetServiceStates(ctx datastore.Context, serviceID string) ([]servicestate.ServiceState, error)

	GetTenantID(ctx datastore.Context, serviceID string) (string, error)

	RemoveService(ctx datastore.Context, id string) error

	RestoreIPs(ctx datastore.Context, svc service.Service) error

	ScheduleService(ctx datastore.Context, serviceID string, autoLaunch bool, desiredState service.DesiredState) (int, error)

	UpdateService(ctx datastore.Context, svc service.Service) error

	WaitService(ctx datastore.Context, dstate service.DesiredState, timeout time.Duration, serviceIDs ...string) error

	GetServiceTemplates(ctx datastore.Context) (map[string]servicetemplate.ServiceTemplate, error)

	UpdateServiceTemplate(ctx datastore.Context, template servicetemplate.ServiceTemplate) error

	AddHost(ctx datastore.Context, entity *host.Host) error

	GetHosts(ctx datastore.Context) ([]host.Host, error)

	AddResourcePool(ctx datastore.Context, entity *pool.ResourcePool) error

	GetResourcePools(ctx datastore.Context) ([]pool.ResourcePool, error)

	HasIP(ctx datastore.Context, poolID string, ipAddr string) (bool, error)

	UpdateResourcePool(ctx datastore.Context, entity *pool.ResourcePool) error
}

The FacadeInterface is the API for a Facade

type FacadeTest

type FacadeTest struct {
	elastic.ElasticTest
	CTX    datastore.Context
	Facade *Facade
}

FacadeTest used for running tests where a facade type is needed.

func (*FacadeTest) SetUpSuite

func (ft *FacadeTest) SetUpSuite(c *gocheck.C)

SetUpSuite sets up test suite

type PoolIPs

type PoolIPs struct {
	PoolID     string
	HostIPs    []host.HostIPResource
	VirtualIPs []pool.VirtualIP
}

PoolIPs type for IP resources available in a ResourcePool

type Ports

type Ports map[uint16]struct{}

func GetPorts

func GetPorts(endpoints []service.ServiceEndpoint) (Ports, error)

func (Ports) List

func (m Ports) List() (ports []uint16)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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