Documentation
¶
Index ¶
- Variables
- func NewBatchService(repo BatchRepo, instance InstanceService) batchService
- func NewInstanceService(repo InstanceRepo, opts ...InstanceServiceOption) instanceService
- func NewNetworkService(repo NetworkRepo) networkService
- func NewQueueService(repo QueueRepo, batch BatchService, instance InstanceService, ...) queueService
- func NewSourceService(repo SourceRepo) sourceService
- func NewTargetService(repo TargetRepo) targetService
- func NewValidationErrf(format string, a ...any) error
- func NewWarningService(repo WarningRepo) warningService
- type Artifact
- type ArtifactRepo
- type ArtifactService
- type Artifacts
- type Batch
- type BatchRepo
- type BatchService
- type Batches
- type ErrValidation
- type ImportStage
- type Instance
- func (i Instance) DisabledReason(overrides api.InstanceRestrictionOverride) error
- func (i Instance) GetName() string
- func (i *Instance) GetOSType() api.OSType
- func (i Instance) MatchesCriteria(expression string) (bool, error)
- func (i Instance) ToAPI() api.Instance
- func (i Instance) ToFilterable() InstanceFilterable
- func (i Instance) Validate() error
- type InstanceFilterable
- type InstanceRepo
- type InstanceService
- type InstanceServiceOption
- type Instances
- type Network
- type NetworkRepo
- type NetworkService
- type Networks
- type QueueEntries
- type QueueEntry
- func (q QueueEntry) GetWindowName() *string
- func (q QueueEntry) IsCommitted() bool
- func (q QueueEntry) IsMigrating() bool
- func (q QueueEntry) StatusBeforeMigrationWindow() bool
- func (q QueueEntry) ToAPI(instanceName string, lastWorkerUpdate time.Time, migrationWindow Window) api.QueueEntry
- func (q QueueEntry) Validate() error
- type QueueRepo
- type QueueService
- type Source
- func (s Source) GetExternalConnectivityStatus() api.ExternalConnectivityStatus
- func (s Source) GetServerCertificate() *x509.Certificate
- func (s Source) GetTrustedServerCertificateFingerprint() string
- func (s *Source) SetExternalConnectivityStatus(status api.ExternalConnectivityStatus)
- func (s *Source) SetServerCertificate(cert *x509.Certificate)
- func (s Source) ToAPI() api.Source
- func (s Source) Validate() error
- type SourceEndpoint
- type SourceRepo
- type SourceService
- type Sources
- type Target
- func (t Target) GetEndpoint() string
- func (t Target) GetExternalConnectivityStatus() api.ExternalConnectivityStatus
- func (t Target) GetServerCertificate() *x509.Certificate
- func (t Target) GetTrustedServerCertificateFingerprint() string
- func (t *Target) SetExternalConnectivityStatus(status api.ExternalConnectivityStatus)
- func (t *Target) SetOIDCTokens(tokens *oidc.Tokens[*oidc.IDTokenClaims])
- func (t *Target) SetServerCertificate(cert *x509.Certificate)
- func (t Target) ToAPI() api.Target
- func (t Target) Validate() error
- type TargetEndpoint
- type TargetRepo
- type TargetService
- type Targets
- type Warning
- type WarningRepo
- type WarningService
- type Warnings
- type Window
- type WindowRepo
- type WindowService
- type Windows
- type WorkerCommand
Constants ¶
This section is empty.
Variables ¶
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 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"`
}
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 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.
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 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 ¶
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) GetOSType ¶
GetOSType returns the OS type, as determined from https://dp-downloads.broadcom.com/api-content/apis/API_VWSA_001/8.0U3/html/ReferenceGuides/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html
func (Instance) MatchesCriteria ¶
func (Instance) ToFilterable ¶
func (i Instance) ToFilterable() InstanceFilterable
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 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"`
}
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 ¶
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 (*Source) SetExternalConnectivityStatus ¶
func (s *Source) SetExternalConnectivityStatus(status api.ExternalConnectivityStatus)
func (*Source) SetServerCertificate ¶
func (s *Source) SetServerCertificate(cert *x509.Certificate)
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 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 (Target) GetExternalConnectivityStatus ¶
func (t Target) GetExternalConnectivityStatus() api.ExternalConnectivityStatus
func (Target) GetServerCertificate ¶
func (t Target) GetServerCertificate() *x509.Certificate
func (Target) GetTrustedServerCertificateFingerprint ¶
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)
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 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.
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 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 ¶
Begun returns whether the migration window has begun (whether its start time is in the past).
func (Window) FitsDuration ¶
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) ToAPI ¶
func (w Window) ToAPI() api.MigrationWindow
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 ¶
GetEarliest returns the earliest valid migration window, or an error if none are found.
func (Windows) HasValidWindow ¶
HasValidWindow returns whether the set of windows has windows that are still valid. If the supplied set is empty, that is also considered valid.
type WorkerCommand ¶
Source Files
¶
- artifact_model.go
- artifact_ports.go
- artifact_service.go
- batch_model.go
- batch_ports.go
- batch_service.go
- errors.go
- instance_model.go
- instance_ports.go
- instance_service.go
- network_model.go
- network_ports.go
- network_service.go
- queue_model.go
- queue_ports.go
- queue_service.go
- source_model.go
- source_ports.go
- source_service.go
- target_model.go
- target_ports.go
- target_service.go
- warning_model.go
- warning_ports.go
- warning_service.go
- window_model.go
- window_ports.go
- window_service.go