migration

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2025 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("Not found")

	ErrConstraintViolation = errors.New("Constraint violation")

	ErrOperationNotPermitted = errors.New("Operation not permitted")
)

Functions

func NewBatchService

func NewBatchService(repo BatchRepo, instance InstanceService) batchService

func NewInstanceService

func NewInstanceService(repo InstanceRepo, opts ...InstanceServiceOption) instanceService

func NewNetworkService

func NewNetworkService(repo NetworkRepo) networkService

func NewQueueService

func NewQueueService(repo QueueRepo, batch BatchService, instance InstanceService, source SourceService, target TargetService, window WindowService) queueService

func NewSourceService

func NewSourceService(repo SourceRepo) sourceService

func NewTargetService

func NewTargetService(repo TargetRepo) targetService

func NewValidationErrf

func NewValidationErrf(format string, a ...any) error

func NewWarningService

func NewWarningService(repo WarningRepo) warningService

Types

type Artifact

type Artifact struct {
	ID   int64
	UUID uuid.UUID `db:"primary=yes"`

	Type        api.ArtifactType
	LastUpdated time.Time `db:"update_timestamp"`

	Properties api.ArtifactPut `db:"marshal=json"`

	Files []string `db:"ignore"`
}

func (Artifact) ToAPI

func (a Artifact) ToAPI() api.Artifact

func (Artifact) Validate

func (a Artifact) Validate() error

type ArtifactRepo

type ArtifactRepo interface {
	Create(ctx context.Context, artifact Artifact) (int64, error)
	GetAll(ctx context.Context) (Artifacts, error)
	GetAllByType(ctx context.Context, artType api.ArtifactType) (Artifacts, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Artifact, error)
	Update(ctx context.Context, id uuid.UUID, artifact *Artifact) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error
}

type ArtifactService

type ArtifactService interface {
	Create(ctx context.Context, artifact Artifact) (Artifact, error)
	GetAll(ctx context.Context) (Artifacts, error)
	GetAllByType(ctx context.Context, artType api.ArtifactType) (Artifacts, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Artifact, error)
	Update(ctx context.Context, id uuid.UUID, artifact *Artifact) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error

	WriteFile(id uuid.UUID, fileName string, reader io.ReadCloser) error
	DeleteFile(id uuid.UUID, fileName string) error
	GetFiles(id uuid.UUID) ([]string, error)
	FileDirectory(id uuid.UUID) string
	HasRequiredArtifactsForInstance(artifacts Artifacts, inst Instance) error
}

func NewArtifactService

func NewArtifactService(repo ArtifactRepo, sysOS *sys.OS) ArtifactService

type Artifacts

type Artifacts []Artifact

type Batch

type Batch struct {
	ID                int64
	Name              string `db:"primary=yes"`
	Status            api.BatchStatusType
	StatusMessage     string
	IncludeExpression string

	StartDate time.Time

	Constraints []api.BatchConstraint `db:"marshal=json"`
	Config      api.BatchConfig       `db:"marshal=json"`
	Defaults    api.BatchDefaults     `db:"marshal=json"`
}

func (*Batch) GetIncusPlacement

func (b *Batch) GetIncusPlacement(instance Instance, usedNetworks Networks, placement api.Placement) (*api.Placement, error)

GetIncusPlacement returns a TargetPlacement for the given instance and its networks. It defaults to the batch-level definitions unless the given TargetPlacement has overridden them.

func (Batch) ToAPI

func (b Batch) ToAPI(windows Windows) api.Batch

ToAPI returns the API representation of a batch.

func (Batch) Validate

func (b Batch) Validate() error

type BatchRepo

type BatchRepo interface {
	Create(ctx context.Context, batch Batch) (int64, error)
	GetAll(ctx context.Context) (Batches, error)
	GetAllByState(ctx context.Context, status api.BatchStatusType) (Batches, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetAllNamesByState(ctx context.Context, status api.BatchStatusType) ([]string, error)
	GetByName(ctx context.Context, name string) (*Batch, error)
	Update(ctx context.Context, name string, batch Batch) error
	Rename(ctx context.Context, oldName string, newName string) error
	DeleteByName(ctx context.Context, name string) error
	AssignBatch(ctx context.Context, batchName string, instanceUUID uuid.UUID) error
	UnassignBatch(ctx context.Context, batchName string, instanceUUID uuid.UUID) error
}

type BatchService

type BatchService interface {
	Create(ctx context.Context, batch Batch) (Batch, error)
	GetAll(ctx context.Context) (Batches, error)
	GetAllByState(ctx context.Context, status api.BatchStatusType) (Batches, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetAllNamesByState(ctx context.Context, status api.BatchStatusType) ([]string, error)
	GetByName(ctx context.Context, name string) (*Batch, error)
	Update(ctx context.Context, queueSvc QueueService, name string, batch *Batch) error
	UpdateStatusByName(ctx context.Context, name string, status api.BatchStatusType, statusMessage string) (*Batch, error)
	Rename(ctx context.Context, oldName string, newName string) error
	DeleteByName(ctx context.Context, name string) error
	StartBatchByName(ctx context.Context, name string) error
	StopBatchByName(ctx context.Context, name string) error
	ResetBatchByName(ctx context.Context, name string, queueSvc QueueService, sourceSvc SourceService, targetSvc TargetService) error

	DeterminePlacement(ctx context.Context, instance Instance, usedNetworks Networks, batch Batch, windows Windows) (*api.Placement, error)
}

type Batches

type Batches []Batch

type ErrValidation

type ErrValidation string

func (ErrValidation) Error

func (e ErrValidation) Error() string

type ImportStage

type ImportStage string
const (
	IMPORTSTAGE_BACKGROUND ImportStage = "background"
	IMPORTSTAGE_FINAL      ImportStage = "final"
	IMPORTSTAGE_COMPLETE   ImportStage = "complete"
)

func (ImportStage) Validate

func (m ImportStage) Validate() error

type Instance

type Instance struct {
	ID   int64
	UUID uuid.UUID `db:"primary=yes"`

	Source               string         `db:"join=sources.name&order=yes"`
	SourceType           api.SourceType `db:"join=sources.source_type&omit=create,update"`
	LastUpdateFromSource time.Time

	Overrides  api.InstanceOverride   `db:"marshal=json"`
	Properties api.InstanceProperties `db:"marshal=json"`
}

func (Instance) DisabledReason

func (i Instance) DisabledReason(overrides api.InstanceRestrictionOverride) error

DisabledReason returns the underlying reason for why the instance is disabled.

func (Instance) GetName

func (i Instance) GetName() string

GetName returns the name of the instance, which may not be unique among all instances for a given source. If a unique, human-readable identifier is needed, use the Location property.

func (Instance) MatchesCriteria

func (i Instance) MatchesCriteria(expression string) (bool, error)

func (Instance) ToAPI

func (i Instance) ToAPI() api.Instance

func (Instance) ToFilterable

func (i Instance) ToFilterable() InstanceFilterable

func (Instance) Validate

func (i Instance) Validate() error

type InstanceFilterable

type InstanceFilterable struct {
	api.InstanceProperties

	Source               string         `expr:"source"`
	SourceType           api.SourceType `expr:"source_type"`
	LastUpdateFromSource time.Time      `expr:"last_update_from_source"`
}

func (InstanceFilterable) CompileIncludeExpression

func (i InstanceFilterable) CompileIncludeExpression(expression string) (*vm.Program, error)

type InstanceRepo

type InstanceRepo interface {
	Create(ctx context.Context, instance Instance) (int64, error)
	GetAll(ctx context.Context) (Instances, error)
	GetAllByBatch(ctx context.Context, batch string) (Instances, error)
	GetAllBySource(ctx context.Context, source string) (Instances, error)
	GetAllByUUIDs(ctx context.Context, id ...uuid.UUID) (Instances, error)
	GetAllUUIDs(ctx context.Context) ([]uuid.UUID, error)
	GetAllUUIDsBySource(ctx context.Context, source string) ([]uuid.UUID, error)
	GetAllAssigned(ctx context.Context) (Instances, error)
	GetAllUnassigned(ctx context.Context) (Instances, error)
	GetBatchesByUUID(ctx context.Context, instanceUUID uuid.UUID) (Batches, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Instance, error)
	Update(ctx context.Context, instance Instance) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error

	RemoveFromQueue(ctx context.Context, id uuid.UUID) error
}

type InstanceService

type InstanceService interface {
	Create(ctx context.Context, instance Instance) (Instance, error)
	GetAll(ctx context.Context) (Instances, error)
	GetAllByBatch(ctx context.Context, batch string) (Instances, error)
	GetAllBySource(ctx context.Context, source string) (Instances, error)
	GetAllUUIDs(ctx context.Context) ([]uuid.UUID, error)
	GetAllUUIDsBySource(ctx context.Context, source string) ([]uuid.UUID, error)
	GetAllAssigned(ctx context.Context) (Instances, error)
	GetAllUnassigned(ctx context.Context) (Instances, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Instance, error)

	GetAllQueued(ctx context.Context, queue QueueEntries) (Instances, error)
	GetBatchesByUUID(ctx context.Context, id uuid.UUID) (Batches, error)

	Update(ctx context.Context, instance *Instance) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error

	RemoveFromQueue(ctx context.Context, id uuid.UUID) error

	GetPostMigrationRetries(id uuid.UUID) int
	RecordPostMigrationRetry(id uuid.UUID)
}

type InstanceServiceOption

type InstanceServiceOption func(s *instanceService)

type Instances

type Instances []Instance

type Network

type Network struct {
	ID               int64
	UUID             uuid.UUID
	Type             api.NetworkType
	SourceSpecificID string `db:"primary=yes"`
	Location         string
	Source           string `db:"primary=yes&join=sources.name"`

	Properties json.RawMessage `db:"marshal=json"`

	Overrides api.NetworkPlacement `db:"marshal=json"`
}

func (Network) ToAPI

func (n Network) ToAPI() (*api.Network, error)

ToAPI returns the API representation of a network.

func (Network) Validate

func (n Network) Validate() error

type NetworkRepo

type NetworkRepo interface {
	Create(ctx context.Context, network Network) (int64, error)
	GetAll(ctx context.Context) (Networks, error)
	GetAllBySource(ctx context.Context, src string) (Networks, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Network, error)
	GetByNameAndSource(ctx context.Context, name string, src string) (*Network, error)
	Update(ctx context.Context, network Network) error
	DeleteByNameAndSource(ctx context.Context, name string, src string) error
}

type NetworkService

type NetworkService interface {
	Create(ctx context.Context, network Network) (Network, error)
	GetAll(ctx context.Context) (Networks, error)
	GetAllBySource(ctx context.Context, src string) (Networks, error)
	GetByNameAndSource(ctx context.Context, name string, src string) (*Network, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Network, error)
	Update(ctx context.Context, network *Network) error
	DeleteByNameAndSource(ctx context.Context, name string, src string) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error
}

type Networks

type Networks []Network

func FilterUsedNetworks

func FilterUsedNetworks(nets Networks, vms Instances) Networks

FilterUsedNetworks returns the subset of supplied networks that are in use by the supplied instances.

type QueueEntries

type QueueEntries []QueueEntry

type QueueEntry

type QueueEntry struct {
	ID                     int64
	InstanceUUID           uuid.UUID `db:"primary=yes&join=instances.uuid"`
	BatchName              string    `db:"join=batches.name"`
	SecretToken            uuid.UUID
	ImportStage            ImportStage
	MigrationStatus        api.MigrationStatusType
	MigrationStatusMessage string
	LastWorkerStatus       api.WorkerResponseType
	LastBackgroundSync     time.Time

	MigrationWindowName sql.NullString `db:"leftjoin=migration_windows.name"`

	Placement api.Placement `db:"marshal=json"`
}

func (QueueEntry) GetWindowName

func (q QueueEntry) GetWindowName() *string

func (QueueEntry) IsCommitted

func (q QueueEntry) IsCommitted() bool

IsCommitted returns whether the queue entry is past the point of no return (the source VM has been powered off, or is about to be by some concurrent task).

func (QueueEntry) IsMigrating

func (q QueueEntry) IsMigrating() bool

func (QueueEntry) StatusBeforeMigrationWindow

func (q QueueEntry) StatusBeforeMigrationWindow() bool

StatusBeforeMigrationWindow returns whether the migration status of the queue entry places it before a migration window can be assigned.

func (QueueEntry) ToAPI

func (q QueueEntry) ToAPI(instanceName string, lastWorkerUpdate time.Time, migrationWindow Window) api.QueueEntry

func (QueueEntry) Validate

func (q QueueEntry) Validate() error

type QueueRepo

type QueueRepo interface {
	Create(ctx context.Context, queue QueueEntry) (int64, error)
	GetAll(ctx context.Context) (QueueEntries, error)
	GetAllByState(ctx context.Context, status ...api.MigrationStatusType) (QueueEntries, error)
	GetAllByBatch(ctx context.Context, batch string) (QueueEntries, error)
	GetAllByBatchAndState(ctx context.Context, batch string, statuses ...api.MigrationStatusType) (QueueEntries, error)
	GetAllNeedingImport(ctx context.Context, batch string, importStage ImportStage) (QueueEntries, error)
	GetByInstanceUUID(ctx context.Context, id uuid.UUID) (*QueueEntry, error)
	Update(ctx context.Context, entry QueueEntry) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error
	DeleteAllByBatch(ctx context.Context, batch string) error
}

type QueueService

type QueueService interface {
	CreateEntry(ctx context.Context, queue QueueEntry) (QueueEntry, error)
	GetAll(ctx context.Context) (QueueEntries, error)
	GetAllByState(ctx context.Context, status ...api.MigrationStatusType) (QueueEntries, error)
	GetAllByBatch(ctx context.Context, batch string) (QueueEntries, error)
	GetAllByBatchAndState(ctx context.Context, batch string, status ...api.MigrationStatusType) (QueueEntries, error)
	GetAllNeedingImport(ctx context.Context, batch string, importStage ImportStage) (QueueEntries, error)
	GetByInstanceUUID(ctx context.Context, id uuid.UUID) (*QueueEntry, error)
	Update(ctx context.Context, entry *QueueEntry) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error
	CancelByUUID(ctx context.Context, id uuid.UUID) (bool, error)
	RetryByUUID(ctx context.Context, id uuid.UUID) error
	DeleteAllByBatch(ctx context.Context, batch string) error

	UpdateStatusByUUID(ctx context.Context, id uuid.UUID, status api.MigrationStatusType, statusMessage string, importStage ImportStage, windowID *string) (*QueueEntry, error)
	UpdatePlacementByUUID(ctx context.Context, id uuid.UUID, placement api.Placement) (*QueueEntry, error)

	NewWorkerCommandByInstanceUUID(ctx context.Context, id uuid.UUID) (WorkerCommand, error)
	ProcessWorkerUpdate(ctx context.Context, id uuid.UUID, workerResponseTypeArg api.WorkerResponseType, statusMessage string) (QueueEntry, error)
	GetNextWindow(ctx context.Context, q QueueEntry) (*Window, error)
}

type Source

type Source struct {
	ID         int64
	Name       string `db:"primary=yes"`
	SourceType api.SourceType

	Properties json.RawMessage

	EndpointFunc func(api.Source) (SourceEndpoint, error) `json:"-" db:"ignore"`
}

func (Source) GetExternalConnectivityStatus

func (s Source) GetExternalConnectivityStatus() api.ExternalConnectivityStatus

func (Source) GetServerCertificate

func (s Source) GetServerCertificate() *x509.Certificate

func (Source) GetTrustedServerCertificateFingerprint

func (s Source) GetTrustedServerCertificateFingerprint() string

func (*Source) SetExternalConnectivityStatus

func (s *Source) SetExternalConnectivityStatus(status api.ExternalConnectivityStatus)

func (*Source) SetServerCertificate

func (s *Source) SetServerCertificate(cert *x509.Certificate)

func (Source) ToAPI

func (s Source) ToAPI() api.Source

ToAPI returns the API representation of a source.

func (Source) Validate

func (s Source) Validate() error

type SourceEndpoint

type SourceEndpoint interface {
	Connect(ctx context.Context) error
	DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)
}

type SourceRepo

type SourceRepo interface {
	Create(ctx context.Context, source Source) (int64, error)
	GetAll(ctx context.Context, sourceTypes ...api.SourceType) (Sources, error)
	GetAllNames(ctx context.Context, sourceTypes ...api.SourceType) ([]string, error)
	GetByName(ctx context.Context, name string) (*Source, error)
	Update(ctx context.Context, name string, source Source) error
	Rename(ctx context.Context, oldName string, newName string) error
	DeleteByName(ctx context.Context, name string) error
}

type SourceService

type SourceService interface {
	Create(ctx context.Context, source Source) (Source, error)
	GetAll(ctx context.Context, sourceTypes ...api.SourceType) (Sources, error)
	GetAllNames(ctx context.Context, sourceTypes ...api.SourceType) ([]string, error)
	GetByName(ctx context.Context, name string) (*Source, error)
	Update(ctx context.Context, name string, source *Source, instanceService InstanceService) error
	DeleteByName(ctx context.Context, name string, instanceService InstanceService) error

	InitImportCache(initial map[string]int) error
	GetCachedImports(sourceName string) int
	RecordActiveImport(sourceName string)
	RemoveActiveImport(sourceName string)
}

type Sources

type Sources []Source

type Target

type Target struct {
	ID         int64
	Name       string `db:"primary=yes"`
	TargetType api.TargetType

	Properties json.RawMessage

	EndpointFunc func(api.Target) (TargetEndpoint, error) `json:"-" db:"ignore"`
}

func (Target) GetEndpoint

func (t Target) GetEndpoint() string

func (Target) GetExternalConnectivityStatus

func (t Target) GetExternalConnectivityStatus() api.ExternalConnectivityStatus

func (Target) GetServerCertificate

func (t Target) GetServerCertificate() *x509.Certificate

func (Target) GetTrustedServerCertificateFingerprint

func (t Target) GetTrustedServerCertificateFingerprint() string

func (*Target) SetExternalConnectivityStatus

func (t *Target) SetExternalConnectivityStatus(status api.ExternalConnectivityStatus)

func (*Target) SetOIDCTokens

func (t *Target) SetOIDCTokens(tokens *oidc.Tokens[*oidc.IDTokenClaims])

func (*Target) SetServerCertificate

func (t *Target) SetServerCertificate(cert *x509.Certificate)

func (Target) ToAPI

func (t Target) ToAPI() api.Target

ToAPI returns the API representation of a target.

func (Target) Validate

func (t Target) Validate() error

type TargetEndpoint

type TargetEndpoint interface {
	Connect(ctx context.Context) error
	DoBasicConnectivityCheck() (api.ExternalConnectivityStatus, *x509.Certificate)
	IsWaitingForOIDCTokens() bool
}

type TargetRepo

type TargetRepo interface {
	Create(ctx context.Context, target Target) (int64, error)
	GetAll(ctx context.Context) (Targets, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetByName(ctx context.Context, name string) (*Target, error)
	Update(ctx context.Context, name string, target Target) error
	Rename(ctx context.Context, oldName string, newName string) error
	DeleteByName(ctx context.Context, name string) error
}

type TargetService

type TargetService interface {
	Create(ctx context.Context, target Target) (Target, error)
	GetAll(ctx context.Context) (Targets, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetByName(ctx context.Context, name string) (*Target, error)
	Update(ctx context.Context, name string, target *Target) error
	DeleteByName(ctx context.Context, name string) error

	InitImportCache(initial map[string]int) error
	GetCachedImports(targetName string) int
	RecordActiveImport(targetName string)
	RemoveActiveImport(targetName string)

	InitCreateCache(initial map[string]int) error
	GetCachedCreations(targetName string) int
	RecordCreation(targetName string)
	RemoveCreation(targetName string)
}

type Targets

type Targets []Target

type Warning

type Warning struct {
	ID   int64
	UUID uuid.UUID `db:"primary=yes"`

	Type       api.WarningType
	Scope      string
	EntityType string
	Entity     string
	Status     api.WarningStatus

	FirstSeenDate time.Time
	LastSeenDate  time.Time
	UpdatedDate   time.Time
	Messages      []string `db:"marshal=json"`
	Count         int
}

func NewSyncWarning

func NewSyncWarning(wType api.WarningType, sourceName string, message string) Warning

NewSyncWarning creates a sync-scoped warning for the given type, source, and message.

func (Warning) ToAPI

func (w Warning) ToAPI() api.Warning

func (Warning) Validate

func (w Warning) Validate() error

type WarningRepo

type WarningRepo interface {
	Upsert(ctx context.Context, w Warning) (int64, error)
	GetAll(ctx context.Context) (Warnings, error)
	GetByScopeAndType(ctx context.Context, scope api.WarningScope, wType api.WarningType) (Warnings, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Warning, error)
	Update(ctx context.Context, id uuid.UUID, w Warning) error
	DeleteByUUID(ctx context.Context, id uuid.UUID) error
}

type WarningService

type WarningService interface {
	GetAll(ctx context.Context) (Warnings, error)
	GetByScopeAndType(ctx context.Context, scope api.WarningScope, wType api.WarningType) (Warnings, error)
	GetByUUID(ctx context.Context, id uuid.UUID) (*Warning, error)
	Update(ctx context.Context, id uuid.UUID, w *Warning) error
	UpdateStatusByUUID(ctx context.Context, id uuid.UUID, status api.WarningStatus) (*Warning, error)
	DeleteByUUID(ctx context.Context, id uuid.UUID) error

	Emit(ctx context.Context, w Warning) (Warning, error)
	RemoveStale(ctx context.Context, scope api.WarningScope, newWarnings Warnings) error
}

type Warnings

type Warnings []Warning

type Window

type Window struct {
	ID   int64
	Name string `db:"primary=yes"`

	Start   time.Time `db:"order=yes"`
	End     time.Time
	Lockout time.Time

	Batch string `db:"join=batches.name&primary=yes"`

	Config api.MigrationWindowConfig `db:"marshal=json"`
}

Window defines the scheduling of a batch migration.

func (Window) Begun

func (w Window) Begun() bool

Begun returns whether the migration window has begun (whether its start time is in the past).

func (Window) Ended

func (w Window) Ended() bool

func (Window) FitsDuration

func (w Window) FitsDuration(duration time.Duration) bool

FitsDuration checks if a window is valid and unlocked, and that the time between the window start time (or now if the window has started), plus the given duration is still before the window's end time.

func (Window) IsEmpty

func (w Window) IsEmpty() bool

func (Window) Locked

func (w Window) Locked() bool

func (Window) ToAPI

func (w Window) ToAPI() api.MigrationWindow

func (Window) Validate

func (w Window) Validate() error

type WindowRepo

type WindowRepo interface {
	Create(ctx context.Context, window Window) (int64, error)
	GetByNameAndBatch(ctx context.Context, name string, batchName string) (*Window, error)
	GetAll(ctx context.Context) (Windows, error)
	GetAllByBatch(ctx context.Context, batchName string) (Windows, error)
	Update(ctx context.Context, window Window) error
	DeleteByNameAndBatch(ctx context.Context, name string, batchName string) error
}

type WindowService

type WindowService interface {
	Create(ctx context.Context, window Window) (Window, error)
	GetByNameAndBatch(ctx context.Context, name string, batchName string) (*Window, error)
	GetAll(ctx context.Context) (Windows, error)
	GetAllByBatch(ctx context.Context, batchName string) (Windows, error)
	Update(ctx context.Context, window *Window) error
	ReplaceByBatch(ctx context.Context, queueSvc QueueService, batchName string, windows Windows) error
	DeleteByNameAndBatch(ctx context.Context, queueSvc QueueService, name string, batchName string) error
}

func NewWindowService

func NewWindowService(repo WindowRepo) WindowService

type Windows

type Windows []Window

func (Windows) GetEarliest

func (ws Windows) GetEarliest(minDuration time.Duration) (*Window, error)

GetEarliest returns the earliest valid migration window, or an error if none are found.

func (Windows) HasValidWindow

func (ws Windows) HasValidWindow() error

HasValidWindow returns whether the set of windows has windows that are still valid. If the supplied set is empty, that is also considered valid.

func (Windows) Validate

func (ws Windows) Validate() error

type WorkerCommand

type WorkerCommand struct {
	Command      api.WorkerCommandType
	Location     string
	SourceType   api.SourceType
	Source       Source
	OS           string
	OSVersion    string
	OSType       api.OSType
	Architecture string
}

Directories

Path Synopsis
endpoint

Jump to

Keyboard shortcuts

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