facade

package
v0.0.0-...-1c5d739 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 61 Imported by: 12

Documentation

Overview

Copyright 2016 The Serviced Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Serviced Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Serviced Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// The mount point in the service migration docker image
	MIGRATION_MOUNT_POINT = "/migration"

	// The well-known path within the service's docker image of the directory which contains the service's migration script
	EMBEDDED_MIGRATION_DIRECTORY = "/opt/serviced/migration"
)

Variables

View Source
var (
	ErrHostDoesNotExist = errors.New("facade: host does not exist")
	ErrHostOffline      = errors.New("host is offline")
)
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")
	ErrDefaultPool   = errors.New("facade: cannot delete default resource pool")
)
View Source
var (
	ErrServiceExists            = errors.New("facade: service exists")
	ErrServiceDoesNotExist      = errors.New("facade: service does not exist")
	ErrServiceCollision         = errors.New("facade: service name already exists under parent")
	ErrTenantDoesNotMatch       = errors.New("facade: service tenants do not match")
	ErrServiceMissingAssignment = errors.New("facade: service is missing an address assignment")
	ErrServiceDuplicateEndpoint = errors.New("facade: duplicate endpoint found")
	ErrEmergencyShutdownNoOp    = errors.New("Cannot perform operation; Service has Emergency Shutdown flag set")
)
View Source
var (
	ErrLogstashUnchanged = errors.New("logstash config unchanged")
)
View Source
var (
	ErrPendingDeploymentConflict = errors.New("template deployment id conflict")
)
View Source
var INSTANCE_PASSWORD string
View Source
var LogstashContainerReloader reloadLogstashContainer = reloadLogstashContainerImpl
View Source
var SYSTEM_USER_NAME = "system_user"

each time Serviced starts up a new password will be generated. This will be passed into the containers so that they can authenticate against the API

Functions

func IpVisitorFn

func IpVisitorFn(portmap Ports, request addressassignment.AssignmentRequest, f *Facade, ctx datastore.Context) service.Visit

func NewPoolCache

func NewPoolCache() *poolCache

NewPoolCache creates a new poolCache, which is dirty and empty by default

func NewServiceCache

func NewServiceCache() *serviceCache

func NewServiceRegistryCache

func NewServiceRegistryCache() *serviceRegistryCache

Types

type DfsClientValidator

type DfsClientValidator interface {
	ValidateClient(string) bool
}

Interface to allow filtering DFS clients

func NewDfsClientValidator

func NewDfsClientValidator(fac *Facade, ctx datastore.Context) DfsClientValidator

type ErrInvalidServiceOption

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

A type for invalid service options; the details are specified when creating the error.

func (ErrInvalidServiceOption) Error

func (err ErrInvalidServiceOption) Error() string

type Facade

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

Facade is an entrypoint to available controlplane methods

func New

func New() *Facade

New creates an initialized Facade instance

func (*Facade) AddHost

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

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

func (*Facade) AddHostPrivate

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

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

func (*Facade) AddPublicEndpointPort

func (f *Facade) AddPublicEndpointPort(ctx datastore.Context, serviceID, endpointName, portAddr string,
	usetls bool, protocol string, isEnabled bool, restart bool) (*servicedefinition.Port, error)

Adds a port public endpoint to a service

func (*Facade) AddPublicEndpointVHost

func (f *Facade) AddPublicEndpointVHost(ctx datastore.Context, serviceid, endpointName, vhostName string, isEnabled, restart bool) (*servicedefinition.VHost, error)

Adds a vhost public endpoint to a service

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) (err error)

AddService adds a service; return error if service already exists

func (*Facade) AddServiceConfig

func (f *Facade) AddServiceConfig(ctx datastore.Context, serviceID string, conf servicedefinition.ConfigFile) error

AddServiceConfig creates a config file for a service

func (*Facade) AddServiceTemplate

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

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

func (*Facade) AddUser

func (f *Facade) AddUser(ctx datastore.Context, newUser userdomain.User) error

AddUser adds a new user record

func (*Facade) AddVirtualIP

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

AddVirtualIP adds a virtual IP to a pool

func (*Facade) AssignIPs

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

func (*Facade) Backup

func (f *Facade) Backup(ctx datastore.Context, w io.Writer, excludes []string, snapshotSpacePercent int, backupFilename string) error

Backup takes a backup of all installed applications

func (*Facade) BackupInfo

func (f *Facade) BackupInfo(ctx datastore.Context, r io.Reader) (*dfs.BackupInfo, error)

BackupInfo returns metadata info about a backup

func (*Facade) BootstrapLogFilters

func (f *Facade) BootstrapLogFilters(ctx datastore.Context) (bool, error)

Bootstraps the LogFilter store in cases where templates were added to the system in some prior CC version which did not have a separate store for LogFilters. For cases like that, this code creates new records in the LogFilter store for each logfilter found in an existing service template.

func (*Facade) CheckRemoveRegistryImage

func (f *Facade) CheckRemoveRegistryImage(ctx datastore.Context, imageID string) error

Checks the service.

func (*Facade) ClearEmergencyStopFlag

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

ClearEmergencyStopFlag sets EmergencyStop to false for all services on the tenant that have it set to true

func (*Facade) Commit

func (f *Facade) Commit(ctx datastore.Context, ctrID, message string, tags []string, snapshotSpacePercent int) (string, error)

Commit commits a container to the docker registry and takes a snapshot.

func (*Facade) CountDescendantStates

func (f *Facade) CountDescendantStates(ctx datastore.Context, serviceID string) (map[string]map[string]int, error)

CountDescendantStates returns the count of descendants of a service in terms of their Launch (auto/manual) and their DesiredState. This is primarily for use by the UI, so that it can know how many descendants a start/stop action will affect.

func (*Facade) CreateDefaultPool

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

CreateDefaultPool creates the default pool if it does not exist. It is idempotent.

func (*Facade) CreateSystemUser

func (f *Facade) CreateSystemUser(ctx datastore.Context) error

createSystemUser updates the running instance password as well as the user record in elastic

func (*Facade) DFSLock

func (f *Facade) DFSLock(ctx datastore.Context) dfs.DFSLocker

DFSLock returns the locker for the dfs

func (*Facade) DeleteRegistryImage

func (f *Facade) DeleteRegistryImage(ctx datastore.Context, image string) error

DeleteRegistryImage removes an image from the docker registry index. e.g. DeleteRegistryImage(ctx, "library/reponame:tagname")

func (*Facade) DeleteServiceConfig

func (f *Facade) DeleteServiceConfig(ctx datastore.Context, fileID string) error

DeleteServiceConfig deletes a service config file

func (*Facade) DeleteSnapshot

func (f *Facade) DeleteSnapshot(ctx datastore.Context, snapshotID string) error

DeleteSnapshot removes a snapshot from an application.

func (*Facade) DeleteSnapshots

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

DeleteSnapshots removes all snapshots for an application.

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 deploys 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, err error)

gather a list of all active DeploymentIDs

func (*Facade) DeployTemplateStatus

func (f *Facade) DeployTemplateStatus(deploymentID string, lastStatus string, timeout time.Duration) (status string, err error)

DeployTemplateStatus returns the current status of a deployed template. If the current status is the same as the value of the lastStatus parameter, block until the status changes, then return the new status. A timeout may be applied to the status change wait; if the timeout is negative then return immediately even if the status matches; if the timeout is zero then do not timeout.

func (*Facade) DockerOverride

func (f *Facade) DockerOverride(ctx datastore.Context, newImageName, oldImageName string) error

DockerOverride will replace a docker image in the registry with a new image

func (*Facade) Download

func (f *Facade) Download(imageID, tenantID string) error

Download will push a specified image into the registry for the specified tenant

func (*Facade) EmergencyStopService

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

func (*Facade) EnablePublicEndpointPort

func (f *Facade) EnablePublicEndpointPort(ctx datastore.Context, serviceid, endpointName, portAddr string, isEnabled bool) error

Enable/Disable a port public endpoint.

func (*Facade) EnablePublicEndpointVHost

func (f *Facade) EnablePublicEndpointVHost(ctx datastore.Context, serviceid, endpointName, vhost string, isEnabled bool) error

func (*Facade) EstimateBackup

func (f *Facade) EstimateBackup(ctx datastore.Context, request dao.BackupRequest, estimate *dao.BackupEstimate) error

EstimateBackup estimates storage requirements to take a backup of all installed applications

func (*Facade) FindAssignmentByHostPort

func (f *Facade) FindAssignmentByHostPort(ctx datastore.Context, poolID, 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) FindReadHostsInPool

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

FindReadHostsInPool returns list of all hosts for a pool using a minimal representation of a host

func (*Facade) GetActiveHostIDs

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

GetActiveHostIDs returns a list of active host ids

func (*Facade) GetAggregateServices

func (f *Facade) GetAggregateServices(ctx datastore.Context, since time.Time, serviceIDs []string) ([]service.AggregateService, error)

GetAggregateServices returns the aggregated states of a bulk of services

func (*Facade) GetAllPublicEndpoints

func (f *Facade) GetAllPublicEndpoints(ctx datastore.Context) ([]service.PublicEndpoint, error)

GetAllPublicEndpoints returns all the public endpoints in the system

func (*Facade) GetAllServices

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

GetAllServices will get all the services NOTE: Do NOT use this method unless you absolutely, positively need to get a full copy of every service. At sites

with 1000s of services, this can be a really expensive call.

func (*Facade) GetEvaluatedService

func (f *Facade) GetEvaluatedService(ctx datastore.Context, serviceID string, instanceID int) (*service.Service, error)

GetEvaluatedService returns a service where an evaluation has been executed against all templated properties.

func (*Facade) GetHealthChecksForService

func (f *Facade) GetHealthChecksForService(ctx datastore.Context, serviceID string) (map[string]health.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)

GetHostByIP returns the host by IP address

func (*Facade) GetHostInstances

func (f *Facade) GetHostInstances(ctx datastore.Context, since time.Time, hostID string) ([]service.Instance, error)

GetHostInstances returns the state of all instances for a particular host.

func (*Facade) GetHostKey

func (f *Facade) GetHostKey(ctx datastore.Context, hostID string) ([]byte, error)

GetHostKey gets a host key by id. Returns nil if host not found

func (*Facade) GetHostStatuses

func (f *Facade) GetHostStatuses(ctx datastore.Context, hostIDs []string, since time.Time) ([]host.HostStatus, error)

GetHostStatuses returns the memory usage and whether or not a host is active

func (*Facade) GetHostStrategyInstances

func (f *Facade) GetHostStrategyInstances(ctx datastore.Context, hosts []host.Host) ([]*service.StrategyInstance, error)

GetHostStrategyInstances returns the strategy objects of all the instances running on a host.

func (*Facade) GetHosts

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

GetHosts returns a list of all registered hosts

func (*Facade) GetInstanceMemoryStats

func (f *Facade) GetInstanceMemoryStats(startTime time.Time, instances ...metrics.ServiceInstance) ([]metrics.MemoryUsageStats, error)

func (*Facade) GetLogFilters

func (f *Facade) GetLogFilters(ctx datastore.Context) ([]*logfilter.LogFilter, error)

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) (*pool.PoolIPs, error)

GetPoolIPs gets all IPs available to a resource pool

func (*Facade) GetReadHosts

func (f *Facade) GetReadHosts(ctx datastore.Context) ([]host.ReadHost, error)

GetReadHosts returns list of all hosts using a minimal representation of a host

func (*Facade) GetReadPools

func (f *Facade) GetReadPools(ctx datastore.Context) ([]pool.ReadPool, error)

GetReadPools returns a list of simplified resource pools

func (*Facade) GetRegistryImage

func (f *Facade) GetRegistryImage(ctx datastore.Context, image string) (*registry.Image, error)

GetRegistryImage returns information about an image that is stored in the docker registry index. e.g. GetRegistryImage(ctx, "library/reponame:tagname")

func (*Facade) GetRegistryImages

func (f *Facade) GetRegistryImages(ctx datastore.Context) ([]registry.Image, error)

GetRegistryImages returns all the image that are in the docker registry index.

func (*Facade) GetResourcePool

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

GetResourcePool returns a resource pool, or nil if not found

func (*Facade) GetResourcePools

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

GetResourcePools returns a list of all resource pools

func (*Facade) GetResourcePoolsByRealm

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

GetResourcePoolsByRealm returns a list of all resource pools by Realm

func (*Facade) GetService

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

func (*Facade) GetServiceAddressAssignmentDetails

func (f *Facade) GetServiceAddressAssignmentDetails(ctx datastore.Context, serviceID string, children bool) ([]service.IPAssignment, error)

GetServiceAddressAssignmentDetails provides details about address assignments for the specified service id as is presented to the front-end.

func (*Facade) GetServiceAddressAssignments

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

GetServiceAddressAssignments fills in all address assignments for the specified service id.

func (*Facade) GetServiceAddressAssignmentsByPort

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

func (*Facade) GetServiceConfig

func (f *Facade) GetServiceConfig(ctx datastore.Context, fileID string) (*servicedefinition.ConfigFile, error)

GetServiceConfig returns a config file

func (*Facade) GetServiceConfigs

func (f *Facade) GetServiceConfigs(ctx datastore.Context, serviceID string) ([]service.Config, error)

GetServiceConfigs returns the config files for a service

func (*Facade) GetServiceDetails

func (f *Facade) GetServiceDetails(ctx datastore.Context, serviceID string) (*service.ServiceDetails, error)

GetServiceDetails returns the details of a particular service

func (*Facade) GetServiceDetailsAncestry

func (f *Facade) GetServiceDetailsAncestry(ctx datastore.Context, serviceID string) (*service.ServiceDetails, error)

GetServiceDetailsAncestry returns a service and its ancestors

func (*Facade) GetServiceDetailsByParentID

func (f *Facade) GetServiceDetailsByParentID(ctx datastore.Context, parentID string, since time.Duration) ([]service.ServiceDetails, error)

Get the details of the child services for the given parent

func (*Facade) GetServiceDetailsByTenantID

func (f *Facade) GetServiceDetailsByTenantID(ctx datastore.Context, tenantID string) ([]service.ServiceDetails, error)

Get the details of all services for the specified tenant

func (*Facade) GetServiceEndpoints

func (f *Facade) GetServiceEndpoints(ctx datastore.Context, serviceID string, reportImports, reportExports, validate bool) ([]applicationendpoint.EndpointReport, error)

Get the exported endpoints for a service

func (*Facade) GetServiceExportedEndpoints

func (f *Facade) GetServiceExportedEndpoints(ctx datastore.Context, serviceID string, children bool) ([]service.ExportedEndpoint, error)

GetServiceExportedEndpoints returns all the exported endpoints for a service and its children if enabled.

func (*Facade) GetServiceHealth

func (f *Facade) GetServiceHealth(ctx datastore.Context, serviceID string) (map[int]map[string]health.HealthStatus, error)

GetServiceHealth returns the status of all health instances.

func (*Facade) GetServiceInstances

func (f *Facade) GetServiceInstances(ctx datastore.Context, since time.Time, serviceID string) ([]service.Instance, error)

GetServiceInstances returns the state of all instances for a particular service.

func (*Facade) GetServiceList

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

GetServiceList gets all child services of the service specified by the given service ID, and returns them in a slice

func (*Facade) GetServiceMonitoringProfile

func (f *Facade) GetServiceMonitoringProfile(ctx datastore.Context, serviceID string) (*domain.MonitorProfile, error)

Get the monitoring profile of a given service

func (*Facade) GetServiceNamePath

func (f *Facade) GetServiceNamePath(ctx datastore.Context, serviceID string) (tenantID string, serviceNamePath string, err error)

func (*Facade) GetServicePublicEndpoints

func (f *Facade) GetServicePublicEndpoints(ctx datastore.Context, serviceID string, children bool) ([]service.PublicEndpoint, error)

GetServicePublicEndpoints returns all the endpoints for a service and its children if enabled.

func (*Facade) GetServiceTemplates

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

func (*Facade) GetServiceTemplatesAndImages

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

func (*Facade) GetServices

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

GetServices looks up all services. Allows filtering by tenant ID, name (regular expression), and/or update time. NOTE: Do NOT use this method unless you absolutely, positively need to get a full copy of every service. At sites

with 1000s of services, this can be a really expensive call.

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) GetServicesForScheduling

func (f *Facade) GetServicesForScheduling(ctx datastore.Context, ids []string) []*service.Service

func (*Facade) GetServicesHealth

func (f *Facade) GetServicesHealth(ctx datastore.Context) (map[string]map[int]map[string]health.HealthStatus, error)

GetServicesHealth returns the status of all services health instances.

func (*Facade) GetSnapshotByServiceIDAndTag

func (f *Facade) GetSnapshotByServiceIDAndTag(ctx datastore.Context, serviceID, tagName string) (*dfs.SnapshotInfo, error)

GetSnapshotByServiceIDAndTag finds the existing snapshot for a given service with a specific tag

func (*Facade) GetSnapshotInfo

func (f *Facade) GetSnapshotInfo(ctx datastore.Context, snapshotID string) (*dfs.SnapshotInfo, error)

GetSnapshotInfo returns information about a snapshot.

func (*Facade) GetSystemUser

func (f *Facade) GetSystemUser(ctx datastore.Context) (userdomain.User, error)

GetSystemUser returns the system user's credentials.

func (*Facade) GetTaggedServices

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

GetTaggedServices looks up all services with the specified tags. Allows filtering by tenant ID and/or name (regular expression).

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) GetTenantIDs

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

Get a list of tenant IDs

func (*Facade) GetUser

func (f *Facade) GetUser(ctx datastore.Context, userName string) (userdomain.User, error)

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) HostIsAuthenticated

func (f *Facade) HostIsAuthenticated(ctx datastore.Context, hostid string) (bool, error)

HostIsAuthenticated checks whether a host has authenticated and has an unexpired

token

func (*Facade) ListSnapshots

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

ListSnapshots returns a list of strings that describes the snapshots for the given application.

func (*Facade) ListTenants

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

func (*Facade) LocateServiceInstance

func (f *Facade) LocateServiceInstance(ctx datastore.Context, serviceID string, instanceID int) (*service.LocationInstance, error)

LocateServiceInstance returns host and container information about a service instance

func (*Facade) MigrateService

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

MigrateService migrates an existing service; return error if the service does not exist

func (*Facade) MigrateServices

func (f *Facade) MigrateServices(ctx datastore.Context, req dao.ServiceMigrationRequest) error

MigrateServices performs a batch migration on a group of services.

func (*Facade) PauseService

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

func (*Facade) PredictStorageAvailability

func (f *Facade) PredictStorageAvailability(ctx datastore.Context, lookahead time.Duration) (map[string]float64, error)

PredictStorageAvailability returns the predicted available storage after a given period for the thin pool data device, the thin pool metadata device, and each tenant filesystem.

func (*Facade) QueryServiceDetails

func (f *Facade) QueryServiceDetails(ctx datastore.Context, request service.Query) ([]service.ServiceDetails, error)

func (*Facade) RebalanceService

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

RebalanceService does a hard restart: All services are stopped, and then all services are started again

func (*Facade) RegisterHostKeys

func (f *Facade) RegisterHostKeys(ctx datastore.Context, entity *host.Host, nat utils.URL, keys []byte, prompt bool) error

RegisterHost attempts to register a host's keys over ssh, or locally if it's the current host.

func (*Facade) ReloadLogstashConfig

func (f *Facade) ReloadLogstashConfig(ctx datastore.Context) error

ReloadLogstashConfig will create a new logstash configuration based on the union of information from all templates and all currently deployed services. A union of values is used because scenarios like a service migration can expand the scope of auditable logs or change log filters without touching the currently loaded templates.

If the new configuration is different from the one currently used by logstash, then it will rewrite the logstash.conf file, trusting that logstash will recognize the file change and reload the new filter set.

This method should be called anytime the available service templates are modified or deployed services are upgraded.

This method depends on the elasticsearch container being up and running.

Note that the strategy of using a union of fields from the templates and deployed services means that if a template says a certain log file should be auditable, but the deployed service does not, then the field will still be auditable. Refactoring to update logstash soley on the basis of deployed services might resolve that problem, but it still leaves the constraint that in cases where separate tenant applications have conflicting filters/auditable types for the same file, the last one wins.

func (*Facade) RemoveAddressAssignment

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

RemoveAddressAssignment 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) RemoveHostExpiration

func (f *Facade) RemoveHostExpiration(ctx datastore.Context, hostid string)

RemoveHostExpiration removes a host from the HostExpirationRegistry

func (*Facade) RemoveIPs

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

func (*Facade) RemoveLogFilters

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

func (*Facade) RemovePublicEndpointPort

func (f *Facade) RemovePublicEndpointPort(ctx datastore.Context, serviceid, endpointName, portAddr string) error

Remove the port public endpoint from a service.

func (*Facade) RemovePublicEndpointVHost

func (f *Facade) RemovePublicEndpointVHost(ctx datastore.Context, serviceid, endpointName, vhost string) error

Remove the vhost public endpoint from a service.

func (*Facade) RemoveResourcePool

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

RemoveResourcePool removes a resource pool

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) RemoveSnapshotTag

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

RemoveSnapshotTag removes a specific tag from an existing snapshot

func (*Facade) RemoveUser

func (f *Facade) RemoveUser(ctx datastore.Context, userName string) error

RemoveUser removes the user specified by the userName string

func (*Facade) RemoveVirtualIP

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

RemoveVirtualIP removes a virtual IP from a pool

func (*Facade) RepairRegistry

func (f *Facade) RepairRegistry(ctx datastore.Context) error

RepairRegistry will load "latest" from the docker registry and save it to the database.

func (*Facade) ReportHealthStatus

func (f *Facade) ReportHealthStatus(key health.HealthStatusKey, value health.HealthStatus, expires time.Duration)

ReportHealthStatus writes the status of a health check to the cache.

func (*Facade) ReportInstanceDead

func (f *Facade) ReportInstanceDead(serviceID string, instanceID int)

ReportInstanceDead removes all health checks of a particular instance from the cache.

func (*Facade) ResetHostKey

func (f *Facade) ResetHostKey(ctx datastore.Context, hostID string) ([]byte, error)

ResetHostKey generates and returns a host key by id. Returns nil if host not found

func (*Facade) ResetLock

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

ResetLock resets locks for a specific tenant

func (*Facade) ResetLocks

func (f *Facade) ResetLocks(ctx datastore.Context) error

ResetLocks resets all tenant locks

func (*Facade) ResolveServicePath

func (f *Facade) ResolveServicePath(ctx datastore.Context, svcPath string, noprefix bool) ([]service.ServiceDetails, error)

ResolveServicePath resolves a service path (e.g., "infrastructure/mariadb") to zero or more service details with their ancestry populated.

func (*Facade) RestartService

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

func (*Facade) Restore

func (f *Facade) Restore(ctx datastore.Context, r io.Reader, backupInfo *dfs.BackupInfo, backupFilename string) error

Restore restores application data from a backup.

func (*Facade) RestoreResourcePools

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

RestoreResourcePools restores a bulk of resource pools, usually from a backup.

func (*Facade) RestoreServiceTemplates

func (f *Facade) RestoreServiceTemplates(ctx datastore.Context, templates []servicetemplate.ServiceTemplate) error

RestoreServiceTemplates restores a service template, typically from a backup

func (*Facade) RestoreServices

func (f *Facade) RestoreServices(ctx datastore.Context, tenantID string, svcs []service.Service) error

RestoreServices reverts service data

func (*Facade) Rollback

func (f *Facade) Rollback(ctx datastore.Context, snapshotID string, force bool) error

Rollback rolls back an application to state described in the provided snapshot.

func (*Facade) ScheduleServiceBatch

func (f *Facade) ScheduleServiceBatch(ctx datastore.Context, svcs []*servicestatemanager.CancellableService, tenantID string, desiredState service.DesiredState) ([]string, error)

func (*Facade) ScheduleServices

func (f *Facade) ScheduleServices(ctx datastore.Context, serviceIDs []string, autoLaunch bool, synchronous bool, desiredState service.DesiredState, emergency bool) (int, error)

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

func (*Facade) SearchRegistryLibraryByTag

func (f *Facade) SearchRegistryLibraryByTag(ctx datastore.Context, library, tagname string) ([]registry.Image, error)

SearchRegistryLibrary searches the docker registry index for images at a particular library and tag. e.g. library/reponame:tagname => SearchRegistryLibrary("library", "tagname")

func (*Facade) SendDockerAction

func (f *Facade) SendDockerAction(ctx datastore.Context, serviceID string, instanceID int, action string, args []string) error

SendDockerAction locates a service instance and sends an action to it

func (*Facade) ServiceUse

func (f *Facade) ServiceUse(ctx datastore.Context, tenantID, serviceID, imageName, registryName string, replaceImgs []string, noOp bool) error

ServiceUse will tag a new image (imageName) in a given registry for a given tenant to latest, making sure to push changes to the registry

func (*Facade) SetAddressConfig

func (f *Facade) SetAddressConfig(ctx datastore.Context, serviceid, endpointName string, sa servicedefinition.AddressResourceConfig) error

SetAddressConfig sets the AddressConfig to the endpoint

func (*Facade) SetAuditLogger

func (f *Facade) SetAuditLogger(logger audit.Logger)

func (*Facade) SetConfigStore

func (f *Facade) SetConfigStore(store serviceconfigfile.Store)

func (*Facade) SetDFS

func (f *Facade) SetDFS(dfs dfs.DFS)

func (*Facade) SetDeploymentMgr

func (f *Facade) SetDeploymentMgr(mgr *PendingDeploymentMgr)

func (*Facade) SetHealthCache

func (f *Facade) SetHealthCache(hcache *health.HealthStatusCache)

func (*Facade) SetHostExpiration

func (f *Facade) SetHostExpiration(ctx datastore.Context, hostid string, expiration int64)

SetHostExpiration sets a host's auth token expiration time in the HostExpirationRegistry

func (*Facade) SetHostExpirationRegistry

func (f *Facade) SetHostExpirationRegistry(hostRegistry auth.HostExpirationRegistryInterface)

func (*Facade) SetHostStore

func (f *Facade) SetHostStore(store host.Store)

func (*Facade) SetHostkeyStore

func (f *Facade) SetHostkeyStore(store hostkey.Store)

func (*Facade) SetIPs

func (*Facade) SetIsvcsPath

func (f *Facade) SetIsvcsPath(path string)

func (*Facade) SetLogFilterStore

func (f *Facade) SetLogFilterStore(store logfilter.Store)

func (*Facade) SetMetricsClient

func (f *Facade) SetMetricsClient(client MetricsClient)

func (*Facade) SetPoolStore

func (f *Facade) SetPoolStore(store pool.Store)

func (*Facade) SetRegistryImage

func (f *Facade) SetRegistryImage(ctx datastore.Context, rImage *registry.Image) error

SetRegistryImage creates/updates an image in the docker registry index.

func (*Facade) SetRegistryStore

func (f *Facade) SetRegistryStore(store registry.ImageRegistryStore)

func (*Facade) SetRollingRestartTimeout

func (f *Facade) SetRollingRestartTimeout(t time.Duration)

func (*Facade) SetServiceStateManager

func (f *Facade) SetServiceStateManager(ssm servicestatemanager.ServiceStateManager)

func (*Facade) SetServiceStore

func (f *Facade) SetServiceStore(store service.Store)

func (*Facade) SetServicesCurrentState

func (f *Facade) SetServicesCurrentState(ctx datastore.Context, currentState service.ServiceCurrentState, serviceIDs ...string)

func (*Facade) SetTemplateStore

func (f *Facade) SetTemplateStore(store servicetemplate.Store)

func (*Facade) SetUserStore

func (f *Facade) SetUserStore(store user.Store)

func (*Facade) SetZZK

func (f *Facade) SetZZK(zzk ZZK)

func (*Facade) Snapshot

func (f *Facade) Snapshot(ctx datastore.Context, serviceID, message string, tags []string, snapshotSpacePercent int) (string, error)

Snapshot takes a snapshot for a particular application.

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) StopServiceInstance

func (f *Facade) StopServiceInstance(ctx datastore.Context, serviceID string, instanceID int) error

StopServiceInstance stops a particular service instance

func (*Facade) SyncCurrentStates

func (f *Facade) SyncCurrentStates(ctx datastore.Context) error

func (*Facade) SyncRegistryImages

func (f *Facade) SyncRegistryImages(ctx datastore.Context, force bool) error

SyncRegistryImages makes sure images on es are in sync with zk. If force is enabled, all images are reset.

func (*Facade) SyncServiceRegistry

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

func (*Facade) TagSnapshot

func (f *Facade) TagSnapshot(snapshotID string, tagName string) error

TagSnapshot adds tags to an existing snapshot

func (*Facade) UpdateHost

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

UpdateHost information for a registered host

func (*Facade) UpdateLogFilters

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

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

UpdateService updates an existing service; return error if the service does not exist.

func (*Facade) UpdateServiceCache

func (f *Facade) UpdateServiceCache(ctx datastore.Context) error

Update the serviceCache with values from ZK.

func (*Facade) UpdateServiceConfig

func (f *Facade) UpdateServiceConfig(ctx datastore.Context, fileID string, conf servicedefinition.ConfigFile) error

UpdateServiceConfig updates an existing service config file

func (*Facade) UpdateServiceTemplate

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

UpdateServiceTemplate updates a service template

func (*Facade) UpdateUser

func (f *Facade) UpdateUser(ctx datastore.Context, user userdomain.User) error

UpdateUser updates the user record. NOTE: It is assumed the pasword is NOT hashed when updating the user record

func (*Facade) UpgradeRegistry

func (f *Facade) UpgradeRegistry(ctx datastore.Context, fromRegistryHost string, force bool) error

UpgradeRegistry adds the images to the registry index so that they will be pushed into the registry. If fromRegistryHost is not set, search for an old registry on the local host to upgrade. If force is true for a local registry, upgrade again even if previous upgrade was successful. (For a remote registry, the upgrade is always performed regardless of the value of the force parameter.)

func (*Facade) ValidateCredentials

func (f *Facade) ValidateCredentials(ctx datastore.Context, user userdomain.User) (bool, error)

ValidateCredentials takes a user name and password and validates them against a stored user

func (*Facade) WaitService

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

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

func (*Facade) WaitSingleService

func (f *Facade) WaitSingleService(svc *service.Service, dstate service.DesiredState, cancel <-chan interface{}) error

WaitServiceWithCancel waits for service/s to reach a particular desired state, or until canceled

type FacadeInterface

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

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

	// Get a service from serviced where all templated properties have been evaluated
	GetEvaluatedService(ctx datastore.Context, servicedID string, instanceID int) (*service.Service, error)

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

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

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

	SyncServiceRegistry(ctx datastore.Context, svc *service.Service) error

	MigrateServices(ctx datastore.Context, request dao.ServiceMigrationRequest) error

	RemoveService(ctx datastore.Context, id string) error

	ScheduleServices(ctx datastore.Context, serviceIDs []string, autoLaunch bool, synchronous bool, desiredState service.DesiredState, emergency bool) (int, error)

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

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

	AssignIPs(ctx datastore.Context, assignmentRequest addressassignment.AssignmentRequest) (err error)

	RemoveIPs(ctx datastore.Context, args []string) error

	SetIPs(ctx datastore.Context, request addressassignment.AssignmentRequest) error

	AddServiceTemplate(ctx datastore.Context, serviceTemplate servicetemplate.ServiceTemplate, reloadLogstashConfig bool) (string, error)

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

	RemoveServiceTemplate(ctx datastore.Context, templateID string) error

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

	DeployTemplate(ctx datastore.Context, poolID string, templateID string, deploymentID string) ([]string, error)

	DeployTemplateActive() (active []map[string]string, err error)

	DeployTemplateStatus(deploymentID string, lastStatus string, timeout time.Duration) (status string, err error)

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

	AddHostPrivate(ctx datastore.Context, entity *host.Host) ([]byte, error)

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

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

	GetHostKey(ctx datastore.Context, hostID string) ([]byte, error)

	ResetHostKey(ctx datastore.Context, hostID string) ([]byte, error)

	RegisterHostKeys(ctx datastore.Context, entity *host.Host, nat utils.URL, keys []byte, prompt bool) error

	SetHostExpiration(ctx datastore.Context, hostID string, expiration int64)

	RemoveHostExpiration(ctx datastore.Context, hostID string)

	HostIsAuthenticated(ctx datastore.Context, hostid string) (bool, error)

	GetActiveHostIDs(ctx datastore.Context) ([]string, error)

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

	RemoveHost(ctx datastore.Context, hostID string) error

	FindHostsInPool(ctx datastore.Context, poolID string) ([]host.Host, error)

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

	GetResourcePool(ctx datastore.Context, poolID string) (*pool.ResourcePool, error)

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

	GetPoolIPs(ctx datastore.Context, poolID string) (*pool.PoolIPs, error)

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

	RemoveResourcePool(ctx datastore.Context, id string) error

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

	GetHealthChecksForService(ctx datastore.Context, id string) (map[string]health.HealthCheck, error)

	AddPublicEndpointPort(ctx datastore.Context, serviceid, endpointName, portAddr string, usetls bool, protocol string, isEnabled bool, restart bool) (*servicedefinition.Port, error)

	RemovePublicEndpointPort(ctx datastore.Context, serviceid, endpointName, portAddr string) error

	EnablePublicEndpointPort(ctx datastore.Context, serviceid, endpointName, portAddr string, isEnabled bool) error

	AddPublicEndpointVHost(ctx datastore.Context, serviceid, endpointName, vhost string, isEnabled, restart bool) (*servicedefinition.VHost, error)

	RemovePublicEndpointVHost(ctx datastore.Context, serviceid, endpointName, vhost string) error

	EnablePublicEndpointVHost(ctx datastore.Context, serviceid, endpointName, vhost string, isEnabled bool) error

	GetHostInstances(ctx datastore.Context, since time.Time, hostid string) ([]service.Instance, error)

	ListTenants(datastore.Context) ([]string, error)

	GetServiceInstances(ctx datastore.Context, since time.Time, serviceid string) ([]service.Instance, error)

	GetAggregateServices(ctx datastore.Context, since time.Time, serviceids []string) ([]service.AggregateService, error)

	GetReadPools(ctx datastore.Context) ([]pool.ReadPool, error)

	GetReadHosts(ctx datastore.Context) ([]host.ReadHost, error)

	FindReadHostsInPool(ctx datastore.Context, poolID string) ([]host.ReadHost, error)

	GetServiceDetails(ctx datastore.Context, serviceID string) (*service.ServiceDetails, error)

	GetServiceDetailsAncestry(ctx datastore.Context, serviceID string) (*service.ServiceDetails, error)

	GetServiceDetailsByParentID(ctx datastore.Context, serviceID string, since time.Duration) ([]service.ServiceDetails, error)

	GetServiceDetailsByTenantID(ctx datastore.Context, tenantID string) ([]service.ServiceDetails, error)

	GetServiceMonitoringProfile(ctx datastore.Context, serviceID string) (*domain.MonitorProfile, error)

	GetServicePublicEndpoints(ctx datastore.Context, serviceID string, children bool) ([]service.PublicEndpoint, error)

	GetAllPublicEndpoints(ctx datastore.Context) ([]service.PublicEndpoint, error)

	GetServiceAddressAssignmentDetails(ctx datastore.Context, serviceID string, children bool) ([]service.IPAssignment, error)

	GetServiceExportedEndpoints(ctx datastore.Context, serviceID string, children bool) ([]service.ExportedEndpoint, error)

	AddUser(ctx datastore.Context, newUser user.User) error

	GetUser(ctx datastore.Context, userName string) (user.User, error)

	UpdateUser(ctx datastore.Context, u user.User) error

	RemoveUser(ctx datastore.Context, userName string) error

	GetSystemUser(ctx datastore.Context) (user.User, error)

	ValidateCredentials(ctx datastore.Context, u user.User) (bool, error)

	GetServicesHealth(ctx datastore.Context) (map[string]map[int]map[string]health.HealthStatus, error)

	ReportHealthStatus(key health.HealthStatusKey, value health.HealthStatus, expires time.Duration)

	ReportInstanceDead(serviceID string, instanceID int)

	GetServiceConfigs(ctx datastore.Context, serviceID string) ([]service.Config, error)

	GetServiceConfig(ctx datastore.Context, fileID string) (*servicedefinition.ConfigFile, error)

	AddServiceConfig(ctx datastore.Context, serviceID string, conf servicedefinition.ConfigFile) error

	UpdateServiceConfig(ctx datastore.Context, fileID string, conf servicedefinition.ConfigFile) error

	DeleteServiceConfig(ctx datastore.Context, fileID string) error

	GetHostStatuses(ctx datastore.Context, hostIDs []string, since time.Time) ([]host.HostStatus, error)

	UpdateServiceCache(ctx datastore.Context) error

	CountDescendantStates(ctx datastore.Context, serviceID string) (map[string]map[string]int, error)

	ReloadLogstashConfig(ctx datastore.Context) error

	EmergencyStopService(ctx datastore.Context, request dao.ScheduleServiceRequest) (int, error)

	ClearEmergencyStopFlag(ctx datastore.Context, serviceID string) (int, error)

	PredictStorageAvailability(ctx datastore.Context, lookahead time.Duration) (map[string]float64, error)

	QueryServiceDetails(ctx datastore.Context, query service.Query) ([]service.ServiceDetails, error)

	GetServiceNamePath(ctx datastore.Context, serviceID string) (tenantID string, servicePath string, err error)

	StartService(ctx datastore.Context, request dao.ScheduleServiceRequest) (int, error)

	RestartService(ctx datastore.Context, request dao.ScheduleServiceRequest) (int, error)

	StopService(ctx datastore.Context, request dao.ScheduleServiceRequest) (int, error)

	PauseService(ctx datastore.Context, request dao.ScheduleServiceRequest) (int, error)
}

The FacadeInterface is the API for a Facade

type GetPoolsFunc

type GetPoolsFunc func() ([]pool.ReadPool, error)

GetPoolsFunc should return an up-to-date slice of ReadPools.

type GetServiceDetails

type GetServiceDetails func(servicedID string) (*service.ServiceDetails, error)

type IpArgs

type IpArgs struct {
	AuditName string
	Portmap   Ports
}

type MetricsClient

type MetricsClient interface {
	GetInstanceMemoryStats(time.Time, ...metrics.ServiceInstance) ([]metrics.MemoryUsageStats, error)
	GetAvailableStorage(time.Duration, string, ...string) (*metrics.StorageMetrics, error)
}

type PendingDeployment

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

PendingDeployment represents a template deployment which is has been initiated but has not yet completed. It is synchronized, allowing access from multiple goroutines. In particular clients can register for asynchronous notification of changes to its "status".

func NewPendingDeployment

func NewPendingDeployment(deploymentID, templateID, poolID string) PendingDeployment

NewPendingDeployment returns a new PendingDeployment object.

func (*PendingDeployment) GetInfo

func (d *PendingDeployment) GetInfo() map[string]string

GetInfo returns all information about a pending deployment in the form of a map, appropriate for json serialization.

func (*PendingDeployment) GetStatus

func (d *PendingDeployment) GetStatus() (string, <-chan struct{})

GetStatus returns the current status of a PendingDeployment and a channel which will be closewhen the status changes.

func (*PendingDeployment) SetTemplateName

func (d *PendingDeployment) SetTemplateName(name string)

SetTemplateName sets the template name of a PendingDeployment.

func (*PendingDeployment) UpdateStatus

func (d *PendingDeployment) UpdateStatus(status string)

UpdateStatus updates the status of a PendingDeployment.

type PendingDeploymentMgr

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

PendingDeploymentMGr maintains a map from deployment ID to PendingDeployment objects.

func NewPendingDeploymentMgr

func NewPendingDeploymentMgr() *PendingDeploymentMgr

NewPendingDeploymentMgr returns a new PendingDeploymentMgr

func (*PendingDeploymentMgr) DeletePendingDeployment

func (dm *PendingDeploymentMgr) DeletePendingDeployment(deploymentID string)

DeletePendingDeployment removes the PendingDeployment associated with the given deploymentID from the PendingDeploymentMgr.

func (*PendingDeploymentMgr) GetPendingDeployment

func (dm *PendingDeploymentMgr) GetPendingDeployment(deploymentID string) *PendingDeployment

GetPendingDeployment returns the PendingDeployment associated with the given deploymentID if one exists; nil otherwise.

func (*PendingDeploymentMgr) NewPendingDeployment

func (dm *PendingDeploymentMgr) NewPendingDeployment(deploymentID, templateID, poolID string) (*PendingDeployment, error)

NewPendingDeployment allocates a new PendingDeployment with the given attributes and associates it with the PendingDeploymentMgr

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)

type ServiceRegistrySyncRequest

type ServiceRegistrySyncRequest struct {
	ServiceID       string
	PortsToDelete   []zkr.PublicPortKey
	PortsToPublish  map[zkr.PublicPortKey]zkr.PublicPort
	VHostsToDelete  []zkr.VHostKey
	VHostsToPublish map[zkr.VHostKey]zkr.VHost
}

type TenantLocker

type TenantLocker struct {
	sync.Locker
	// contains filtered or unexported fields
}

TenantLocker keeps track of locks per tenant

type ZZK

type ZZK interface {
	UpdateService(ctx datastore.Context, tenantID string, svc *service.Service, setLockOnCreate, setLockOnUpdate bool) error
	UpdateServices(ctx datastore.Context, tenantID string, svc []*service.Service, setLockOnCreate, setLockOnUpdate bool) error
	SyncServiceRegistry(ctx datastore.Context, tenantID string, svc *service.Service) error
	RemoveService(poolID, serviceID string) error
	RemoveServiceEndpoints(serviceID string) error
	RemoveTenantExports(tenantID string) error
	WaitService(svc *service.Service, state service.DesiredState, cancel <-chan interface{}) error
	WaitInstance(ctx datastore.Context, svc *service.Service, instanceID int, checkInstance func(*zkservice.State, bool) bool, cancel <-chan struct{}) error
	GetPublicPort(portAddress string) (string, string, error)
	GetVHost(subdomain string) (string, string, error)
	AddHost(_host *host.Host) error
	UpdateHost(_host *host.Host) error
	RemoveHost(_host *host.Host) error
	GetActiveHosts(ctx datastore.Context, poolID string, hosts *[]string) error
	IsHostActive(poolID string, hostId string) (bool, error)
	UpdateResourcePool(_pool *pool.ResourcePool) error
	RemoveResourcePool(poolID string) error
	GetRegistryImage(id string) (*registry.Image, error)
	SetRegistryImage(rImage *registry.Image) error
	DeleteRegistryImage(id string) error
	DeleteRegistryLibrary(tenantID string) error
	LockServices(ctx datastore.Context, svcs []service.ServiceDetails) error
	UnlockServices(ctx datastore.Context, svcs []service.ServiceDetails) error
	GetServiceStates(ctx datastore.Context, poolID, serviceID string) ([]zkservice.State, error)
	GetHostStates(ctx datastore.Context, poolID, hostID string) ([]zkservice.State, error)
	GetServiceState(ctx datastore.Context, poolID, serviceID string, instanceID int) (*zkservice.State, error)
	StopServiceInstance(poolID, serviceID string, instanceID int) error
	StopServiceInstances(ctx datastore.Context, poolID, serviceID string) error
	RestartInstance(ctx datastore.Context, poolID, serviceID string, instanceID int) error
	SendDockerAction(poolID, serviceID string, instanceID int, command string, args []string) error
	GetServiceStateIDs(poolID, serviceID string) ([]zkservice.StateRequest, error)
	GetServiceNodes() ([]zkservice.ServiceNode, error)
	RegisterDfsClients(clients ...host.Host) error
	UnregisterDfsClients(clients ...host.Host) error
	GetVirtualIPHostID(poolID, ip string) (string, error)
	UpdateInstanceCurrentState(ctx datastore.Context, poolID, serviceID string, instanceID int, state service.InstanceCurrentState) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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