migration

package
v0.0.0-pre.5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 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) 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

	Properties api.ArtifactProperties `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

	DefaultTarget        string
	DefaultTargetProject string
	DefaultStoragePool   string

	RerunScriptlets    bool
	PlacementScriptlet string

	PostMigrationRetries int
	Constraints          []BatchConstraint               `db:"marshal=json"`
	RestrictionOverrides api.InstanceRestrictionOverride `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) HasValidWindow

func (b Batch) HasValidWindow(windows []MigrationWindow) error

func (Batch) ToAPI

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

ToAPI returns the API representation of a batch.

func (Batch) Validate

func (b Batch) Validate() error

type BatchConstraint

type BatchConstraint struct {
	// Name of the constraint.
	Name string `json:"name" yaml:"name"`

	// Description of the constraint.
	Description string `json:"description" yaml:"description"`

	// Expression used to select instances for the constraint.
	IncludeExpression string `json:"include_expression" yaml:"include_expression"`

	// Maximum amount of matched instances that can concurrently migrate, before moving to the next migration window.
	MaxConcurrentInstances int `json:"max_concurrent_instances" yaml:"max_concurrent_instances"`

	// Minimum amount of time required for an instance to boot after initial disk import. Migration window duration must be at least this much.
	MinInstanceBootTime time.Duration `json:"min_instance_boot_time" yaml:"min_instance_boot_time"`
}

func (BatchConstraint) Validate

func (b BatchConstraint) 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

	GetMigrationWindowsByBatch(ctx context.Context, batch string) (MigrationWindows, error)
	GetMigrationWindow(ctx context.Context, windowID int64) (*MigrationWindow, error)
	AssignMigrationWindows(ctx context.Context, batch string, windows MigrationWindows) error
	UnassignMigrationWindows(ctx context.Context, batch string) error
	UpdateMigrationWindows(ctx context.Context, batch string, windows MigrationWindows) 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

	AssignMigrationWindows(ctx context.Context, batch string, windows MigrationWindows) error
	ChangeMigrationWindows(ctx context.Context, queueSvc QueueService, batch string, newWindows MigrationWindows) error

	GetMigrationWindows(ctx context.Context, batch string) (MigrationWindows, error)
	GetMigrationWindow(ctx context.Context, windowID int64) (*MigrationWindow, error)
	GetEarliestWindow(ctx context.Context, batch string) (*MigrationWindow, error)

	DeterminePlacement(ctx context.Context, instance Instance, usedNetworks Networks, batch Batch, migrationWindows MigrationWindows) (*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 MigrationWindow

type MigrationWindow struct {
	ID      int64
	Start   time.Time `db:"primary=yes"`
	End     time.Time `db:"primary=yes"`
	Lockout time.Time `db:"primary=yes"`
}

func (MigrationWindow) Begun

func (w MigrationWindow) Begun() bool

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

func (MigrationWindow) Ended

func (w MigrationWindow) Ended() bool

func (MigrationWindow) FitsDuration

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

func (MigrationWindow) IsEmpty

func (w MigrationWindow) IsEmpty() bool

func (MigrationWindow) Key

func (w MigrationWindow) Key() string

Key returns an identifying key for the MigrationWindow, based on its timings.

func (MigrationWindow) Locked

func (w MigrationWindow) Locked() bool

func (MigrationWindow) Validate

func (w MigrationWindow) Validate() error

type MigrationWindows

type MigrationWindows []MigrationWindow

func (MigrationWindows) GetEarliest

func (ws MigrationWindows) GetEarliest() (*MigrationWindow, error)

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

func (MigrationWindows) Validate

func (ws MigrationWindows) Validate() error

type Network

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

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

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

func (Network) ToAPI

func (n Network) ToAPI() api.Network

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)
	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)
	Update(ctx context.Context, network *Network) error
	DeleteByNameAndSource(ctx context.Context, name string, src string) 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

	MigrationWindowID sql.NullInt64

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

func (QueueEntry) GetWindowID

func (q QueueEntry) GetWindowID() *int64

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 MigrationWindow) 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
	DeleteAllByBatch(ctx context.Context, batch string) error

	UpdateStatusByUUID(ctx context.Context, id uuid.UUID, status api.MigrationStatusType, statusMessage string, importStage ImportStage, windowID *int64) (*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) (*MigrationWindow, 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 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