dao

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Scheduled = Status{1, "Scheduled"}
	Starting  = Status{2, "Starting"}
	Pausing   = Status{3, "Pausing"}
	Paused    = Status{4, "Paused"}
	Resuming  = Status{5, "Resuming"}
	Running   = Status{6, "Running"}
	Stopping  = Status{7, "Stopping"}
	Stopped   = Status{8, "Stopped"}
)

Functions

func WriteConfigurationFile

func WriteConfigurationFile(templates map[string]servicetemplate.ServiceTemplate) error

WriteConfigurationFile takes a map of ServiceTemplates and writes them to the appropriate place in the logstash.conf.

Types

type ApplicationEndpoint

type ApplicationEndpoint struct {
	ServiceID      string
	Application    string
	ContainerPort  uint16
	HostPort       uint16
	HostIP         string
	ContainerIP    string
	Protocol       string
	VirtualAddress string
	InstanceID     int
	ProxyPort      uint16
}

An exposed service endpoint

type AssignmentRequest

type AssignmentRequest struct {
	ServiceID      string
	IPAddress      string
	AutoAssignment bool
}

AssignmentRequest is used to couple a serviceId to an IPAddress

type AttachRequest

type AttachRequest struct {
	Running *RunningService
	Command string
	Args    []string
}

type BackupFile

type BackupFile struct {
	InProgress bool        `json:"in_progress"`
	FullPath   string      `json:"full_path"`
	Name       string      `json:"name"`
	Size       int64       `json:"size"`
	Mode       os.FileMode `json:"mode"`
	ModTime    time.Time   `json:"mod_time"`
}

BackupFile is the structure for backup file data

type ControlPlane

type ControlPlane interface {

	//for a service, get it's tenant Id
	GetTenantId(serviceId string, tenantId *string) error

	// Add a new service
	AddService(service service.Service, serviceId *string) error

	// Deploy a new service
	DeployService(service ServiceDeploymentRequest, serviceId *string) error

	// Update an existing service
	UpdateService(service service.Service, unused *int) error

	// Remove a service definition
	RemoveService(serviceId string, unused *int) error

	// Get a service from serviced
	GetService(serviceId string, service *service.Service) error

	// Get a list of services from serviced
	GetServices(request ServiceRequest, services *[]service.Service) error

	// Find a child service with the given name
	FindChildService(request FindChildRequest, service *service.Service) error

	// Get services with the given tag(s)
	GetTaggedServices(request ServiceRequest, services *[]service.Service) error

	// Find all service endpoint matches
	GetServiceEndpoints(serviceId string, response *map[string][]ApplicationEndpoint) error

	// Assign IP addresses to all services at and below the provided service
	AssignIPs(assignmentRequest AssignmentRequest, _ *struct{}) (err error)

	// Get the IP addresses assigned to an service
	GetServiceAddressAssignments(serviceID string, addresses *[]addressassignment.AddressAssignment) error

	// Schedule the given service to start
	StartService(request ScheduleServiceRequest, affected *int) error

	// Schedule the given service to restart
	RestartService(request ScheduleServiceRequest, affected *int) error

	// Schedule the given service to stop
	StopService(request ScheduleServiceRequest, affected *int) error

	// Stop a running instance of a service
	StopRunningInstance(request HostServiceRequest, unused *int) error

	// Wait for a particular service state
	WaitService(request WaitServiceRequest, _ *struct{}) error

	// Update the service state
	UpdateServiceState(state servicestate.ServiceState, unused *int) error

	// Computes the status of the service based on its service instances
	GetServiceStatus(serviceID string, statusmap *map[string]ServiceStatus) error

	// Get the services instances for a given service
	GetServiceStates(serviceId string, states *[]servicestate.ServiceState) error

	// Get logs for the given app
	GetServiceLogs(serviceId string, logs *string) error

	// Get logs for the given app
	GetServiceStateLogs(request ServiceStateRequest, logs *string) error

	// Get all running services
	GetRunningServices(request EntityRequest, runningServices *[]RunningService) error

	// Get the services instances for a given service
	GetRunningServicesForHost(hostId string, runningServices *[]RunningService) error

	// Get the service instances for a given service
	GetRunningServicesForService(serviceId string, runningServices *[]RunningService) error

	// Attach to a running container with a predefined action
	Action(request AttachRequest, unused *int) error

	// Deploy an application template in to production
	DeployTemplate(request ServiceTemplateDeploymentRequest, tenantIDs *[]string) error

	// Add a new service Template
	AddServiceTemplate(serviceTemplate servicetemplate.ServiceTemplate, templateId *string) error

	// Update a new service Template
	UpdateServiceTemplate(serviceTemplate servicetemplate.ServiceTemplate, unused *int) error

	// Update a new service Template
	RemoveServiceTemplate(serviceTemplateID string, unused *int) error

	// Get a list of ServiceTemplates
	GetServiceTemplates(unused int, serviceTemplates *map[string]servicetemplate.ServiceTemplate) error

	//GetSystemUser retrieves the credentials for the system_user account
	GetSystemUser(unused int, user *user.User) error

	//ValidateCredentials verifies if the passed in user has the correct username and password
	ValidateCredentials(user user.User, result *bool) error

	// Register a health check result
	LogHealthCheck(result domain.HealthCheckResult, unused *int) error

	// Return the number of layers in an image
	ImageLayerCount(imageUUID string, layers *int) error

	// Volume returns a service's volume
	GetVolume(serviceID string, volume volume.Volume) error

	// SetRegistry resets the path to the docker registry
	ResetRegistry(request EntityRequest, unused *int) error

	// Deletes a particular snapshot
	DeleteSnapshot(snapshotID string, unused *int) error

	// Deletes all snapshots for a specific tenant
	DeleteSnapshots(tenantID string, unused *int) error

	// Rollback a service to a particular snapshot
	Rollback(request RollbackRequest, unused *int) error

	// Snapshot takes a snapshot of the filesystem and images
	Snapshot(request SnapshotRequest, snapshotID *string) error

	// AsyncSnapshot performs a snapshot asynchronously
	AsyncSnapshot(serviceID string, snapshotID *string) error

	// ListSnapshots lists all the snapshots for a particular service
	ListSnapshots(serviceID string, snapshots *[]SnapshotInfo) error

	// Commit commits a docker container to a service image
	Commit(containerID string, snapshotID *string) error

	// ReadyDFS notifies whether there are any running operations
	ReadyDFS(bool, *int) error

	// ListBackups lists the backup files for a particular directory
	ListBackups(dirpath string, files *[]BackupFile) error

	// Backup backs up dfs and imagesWrite a tgz file containing all templates and services
	Backup(dirpath string, filename *string) error

	// AsyncBackup performs asynchronous backups
	AsyncBackup(dirpath string, filename *string) error

	// Restore templates and services from a tgz file (inverse of Backup)
	Restore(filename string, unused *int) error

	// AsyncRestore performs an asynchronous restore
	AsyncRestore(filename string, unused *int) error

	// BackupStatus monitors the status of a backup or restore
	BackupStatus(unused int, status *string) error
}

The ControlPlane interface is the API for a serviced master.

type ControlPlaneError

type ControlPlaneError struct {
	Msg string
}

A generic ControlPlane error

func (ControlPlaneError) Error

func (s ControlPlaneError) Error() string

Implement the Error() interface for ControlPlaneError

type EntityRequest

type EntityRequest interface{}

An request for a control center object.

type FindChildRequest

type FindChildRequest struct {
	ServiceID string
	ChildName string
}

type HostServiceRequest

type HostServiceRequest struct {
	HostID         string
	ServiceStateID string
}

type NullRequest

type NullRequest struct{}

type PoolHost

type PoolHost struct {
	HostID string
	PoolID string
	HostIP string
}

An association between a host and a pool.

type RollbackRequest

type RollbackRequest struct {
	SnapshotID   string
	ForceRestart bool
}

type RunningService

type RunningService struct {
	ID                string
	ServiceID         string
	HostID            string
	IPAddress         string // IP that this service has assigned ports
	DockerID          string
	StartedAt         time.Time
	InSync            bool
	Name              string
	Startup           string
	Description       string
	Instances         int
	ImageID           string
	PoolID            string
	DesiredState      int
	ParentServiceID   string
	InstanceID        int
	MonitoringProfile domain.MonitorProfile
}

This is created by selecting from service_state and joining to service

type ScheduleServiceRequest

type ScheduleServiceRequest struct {
	ServiceID  string
	AutoLaunch bool
}

type ServiceDeploymentRequest

type ServiceDeploymentRequest struct {
	PoolID    string // PoolID to deploy the service to
	ParentID  string // ID of parent service
	Overwrite bool   // Overwrites any existing service
	Service   servicedefinition.ServiceDefinition
}

A request to deploy a service from a service definition

Pool and deployment ids are derived from the parent

type ServiceRequest

type ServiceRequest struct {
	Tags         []string
	TenantID     string
	UpdatedSince time.Duration
	NameRegex    string
}

type ServiceStateRequest

type ServiceStateRequest struct {
	ServiceID      string
	ServiceStateID string
}

type ServiceStatus

type ServiceStatus struct {
	State  servicestate.ServiceState
	Status Status
}

type ServiceTemplateDeploymentRequest

type ServiceTemplateDeploymentRequest struct {
	PoolID       string // Pool Id to deploy service into
	TemplateID   string // Id of template to be deployed
	DeploymentID string // Unique id of the instance of this template
}

A request to deploy a service template

type SnapshotInfo

type SnapshotInfo struct {
	SnapshotID  string
	Description string
}

func (SnapshotInfo) String

func (s SnapshotInfo) String() string

type SnapshotRequest

type SnapshotRequest struct {
	ServiceID   string
	Description string
}

type Status

type Status struct {
	Key   int
	Value string
}

func (Status) String

func (s Status) String() string

type User

type User struct {
	Name     string // the unique identifier for a user
	Password string // no requirements on passwords yet
}

type WaitServiceRequest

type WaitServiceRequest struct {
	ServiceIDs   []string             // List of service IDs to monitor
	DesiredState service.DesiredState // State which to monitor for
	Timeout      time.Duration        // Time to wait before cancelling the subprocess
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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