dao

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: 9 Imported by: 28

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttachRequest

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

AttachRequest is a request to run a command in the container of a running service.

type BackupEstimate

type BackupEstimate struct {
	AvailableBytes  uint64
	EstimatedBytes  uint64
	AvailableString string
	EstimatedString string
	BackupPath      string
	AllowBackup     bool
}

BackupEstimate is a set of fields that describe the estimated resource utilization of a backup.

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 BackupRequest

type BackupRequest struct {
	Dirpath              string
	SnapshotSpacePercent int
	Excludes             []string
	Force                bool
	Username             string
}

BackupRequest is a request to create a backup.

type ControlPlane

type ControlPlane interface {

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

	// Clones a new service
	CloneService(request ServiceCloneRequest, serviceID *string) error

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

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

	// Migrate a service definition
	MigrateServices(request ServiceMigrationRequest, _ *int) error

	// Remove a service definition
	RemoveService(serviceID string, _ *int) error

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

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

	// Assign IP addresses to all services at and below the provided service
	AssignIPs(assignmentRequest addressassignment.AssignmentRequest, _ *int) (err error)

	// Get a list of tenant IDs
	GetTenantIDs(_ struct{}, tenantIDs *[]string) 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 rebalance
	RebalanceService(request ScheduleServiceRequest, affected *int) error

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

	// Schedule the given service to pause
	PauseService(request ScheduleServiceRequest, affected *int) error

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

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

	// Computes the status of the service based on its service instances
	GetServiceStatus(serviceID string, status *[]service.Instance) 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, _ *int) error

	// Get service memory stats for a particular host
	GetHostMemoryStats(req MetricRequest, stats *metrics.MemoryUsageStats) error

	// Get service memory stats for a particular service
	GetServiceMemoryStats(req MetricRequest, stats *metrics.MemoryUsageStats) error

	// Get service memory stats for a particular service instance
	GetInstanceMemoryStats(req MetricRequest, stats *[]metrics.MemoryUsageStats) error

	// Backup captures the state of the application stack and writes the output
	// to disk.
	Backup(backupRequest BackupRequest, filename *string) (err error)

	// GetBackupEstimate estimates space required to take backup and space available
	GetBackupEstimate(backupRequest BackupRequest, estimate *BackupEstimate) (err error)

	// AsyncBackup is the same as backup but asynchronous
	AsyncBackup(backupRequest BackupRequest, filename *string) (err error)

	// Restore reverts the full application stack from a backup file
	Restore(restoreRequest RestoreRequest, _ *int) (err error)

	// AsyncRestore is the same as restore but asynchronous
	AsyncRestore(restoreRequest RestoreRequest, _ *int) (err error)

	// Adds 1 or more tags to an existing snapshot
	TagSnapshot(request TagSnapshotRequest, _ *int) error

	// Removes a specific tag from an existing snapshot
	RemoveSnapshotTag(request SnapshotByTagRequest, snapshotID *string) error

	// Gets the snapshot from a specific service with a specific tag
	GetSnapshotByServiceIDAndTag(request SnapshotByTagRequest, snapshot *SnapshotInfo) error

	// ListBackups returns the list of backups
	ListBackups(dirpath string, files *[]BackupFile) (err error)

	// BackupStatus returns the current status of a running backup or restore
	BackupStatus(_ EntityRequest, status *string) (err error)

	// Snapshot captures the state of a single application
	Snapshot(req SnapshotRequest, snapshotID *string) (err error)

	// Rollback reverts a single application to the state of a snapshot
	Rollback(req RollbackRequest, _ *int) (err error)

	// DeleteSnapshot deletes a single snapshot
	DeleteSnapshot(snapshotID string, _ *int) (err error)

	// DeleteSnapshots deletes all snapshots for a service
	DeleteSnapshots(serviceID string, _ *int) (err error)

	// ListSnapshots returns a list of all snapshots for a service
	ListSnapshots(serviceID string, snapshots *[]SnapshotInfo) (err error)

	// ResetRegistry prompts all images to be re-pushed into the docker
	// registry.
	ResetRegistry(_ EntityRequest, _ *int) (err error)

	// RepairRegistry will try to recover the latest image of all service
	// images from the docker registry and save it to the index.
	RepairRegistry(_ EntityRequest, _ *int) (err error)

	// ReadyDFS waits for the DFS to be idle when creating a service shell.
	ReadyDFS(serviceID string, _ *int) (err error)
}

The ControlPlane interface is the API for a serviced master.

type ControlPlaneError

type ControlPlaneError struct {
	Msg string
}

ControlPlaneError is a generic ControlPlane error

func (ControlPlaneError) Error

func (s ControlPlaneError) Error() string

Implement the Error() interface for ControlPlaneError

type EntityRequest

type EntityRequest interface{}

EntityRequest is a request for a control center object.

type FindChildRequest

type FindChildRequest struct {
	ServiceID string
	ChildName string
}

FindChildRequest is a request to locate a service's child by name.

type HostServiceRequest

type HostServiceRequest struct {
	HostID         string
	ServiceStateID string
}

HostServiceRequest is a request for the service state of a host.

type MetricRequest

type MetricRequest struct {
	StartTime time.Time
	HostID    string
	ServiceID string
	Instances []metrics.ServiceInstance
}

MetricRequest is a request for the metrics of the instances of a service.

type NullRequest

type NullRequest struct{}

NullRequest identifies a no-nothing (empty) request

type RestoreRequest

type RestoreRequest struct {
	Filename string
	Username string
}

RestoreRequest is a request to restore from a backup file.

type RollbackRequest

type RollbackRequest struct {
	SnapshotID   string
	ForceRestart bool
}

RollbackRequest is a request to apply a snapshot to the current system.

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
	Environment       []string
	Instances         int
	ImageID           string
	PoolID            string
	DesiredState      int
	ParentServiceID   string
	InstanceID        int
	RAMCommitment     utils.EngNotation
	RAMThreshold      uint
	CPUCommitment     uint64
	HostPolicy        svcdef.HostPolicy
	MonitoringProfile domain.MonitorProfile
}

RunningService this is created by selecting from service_state and joining to service

type ScheduleServiceRequest

type ScheduleServiceRequest struct {
	ServiceIDs  []string
	AutoLaunch  bool
	Synchronous bool
}

ScheduleServiceRequest specifies a request to schedule a service to run.

type ServiceCloneRequest

type ServiceCloneRequest struct {
	ServiceID string
	Suffix    string
}

ServiceCloneRequest specifies a service to clone and how to modify the clone's name.

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   svcdef.ServiceDefinition
}

ServiceDeploymentRequest is a request to deploy a service from a service definition. Pool and deployment ids are derived from the parent.

type ServiceInstanceRequest

type ServiceInstanceRequest struct {
	ServiceID  string
	InstanceID int
}

ServiceInstanceRequest requests information about a service instance given the service ID and instance ID.

type ServiceMigrationRequest

type ServiceMigrationRequest struct {
	ServiceID  string                         // The tenant service ID
	Modified   []*service.Service             // Services modified by the migration
	Added      []*service.Service             // Services added by the migration
	Deploy     []*ServiceDeploymentRequest    // ServiceDefinitions to be deployed by the migration
	LogFilters map[string]logfilter.LogFilter // LogFilters to add/replace
}

ServiceMigrationRequest is request to modify one or more services.

type ServiceRequest

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

ServiceRequest identifies a service plus some query parameters.

type ServiceStateRequest

type ServiceStateRequest struct {
	ServiceID      string
	ServiceStateID string
}

ServiceStateRequest specifies a request for a service's service state.

type SnapshotByTagRequest

type SnapshotByTagRequest struct {
	ServiceID string
	TagName   string
}

SnapshotByTagRequest is request for the snapshot idenfified by the tag name.

type SnapshotInfo

type SnapshotInfo struct {
	SnapshotID  string
	TenantID    string
	Description string
	Tags        []string
	Created     time.Time
	Invalid     bool
}

SnapshotInfo describes a snapshot

func (*SnapshotInfo) Equals

func (s *SnapshotInfo) Equals(s2 *SnapshotInfo) bool

Equals returns true if the two SnapshotInfo objects have the same values.

func (SnapshotInfo) String

func (s SnapshotInfo) String() string

type SnapshotRequest

type SnapshotRequest struct {
	ServiceID            string
	Message              string
	Tag                  string
	ContainerID          string
	SnapshotSpacePercent int
}

SnapshotRequest is a request to create a snapshot.

type TagSnapshotRequest

type TagSnapshotRequest struct {
	SnapshotID string
	TagName    string
}

TagSnapshotRequest is a request to add a tag (label) to the specified snapshot.

type User

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

User contains creditials for a user.

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
	Recursive    bool                 // Recursively wait for the desired state
}

WaitServiceRequest is a request to wait for a set of services to gain the requested status.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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