appspacestatus

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppspaceStatus

type AppspaceStatus struct {
	AppspaceModel interface {
		GetFromID(domain.AppspaceID) (*domain.Appspace, error)
	} `checkinject:"required"`
	AppModel interface {
		GetVersion(domain.AppID, domain.Version) (domain.AppVersion, error)
	} `checkinject:"required"`

	AppspaceInfoModel interface {
		GetSchema(domain.AppspaceID) (int, error)
	} `checkinject:"required"`

	AppspaceFilesEvents interface {
		Subscribe() <-chan domain.AppspaceID
	} `checkinject:"required"`
	AppspaceRouter interface {
		SubscribeLiveCount(domain.AppspaceID, chan<- int) int
		UnsubscribeLiveCount(domain.AppspaceID, chan<- int)
	} `checkinject:"required"`
	MigrationJobEvents interface {
		Subscribe() <-chan domain.MigrationJob
	} `checkinject:"required"`

	//AppVersionEvent for when an app version can change its schema/whatever live
	// This is only relevant in ds-dev and can be left nil in prod.
	AppVersionEvents interface {
		Subscribe(chan<- string)
	} `checkinject:"optional"`

	AppspaceStatusEvents interface {
		Send(domain.AppspaceID, domain.AppspaceStatusEvent)
	} `checkinject:"required"`
	// contains filtered or unexported fields
}

AppspaceStatus determines the status of an appspace

func (*AppspaceStatus) Init

func (s *AppspaceStatus) Init()

Init creates data structures and subscribes to events

func (*AppspaceStatus) IsLockedClosed

func (s *AppspaceStatus) IsLockedClosed(appspaceID domain.AppspaceID) bool

IsLockedClosed returns true if the appspace is locked and no files should be opened.

func (*AppspaceStatus) IsTempPaused

func (s *AppspaceStatus) IsTempPaused(appspaceID domain.AppspaceID) bool

IsTempPaused returns true if a temp pause is in effect It does not consider whether the appspace has effectively stopped

func (*AppspaceStatus) LockClosed

func (s *AppspaceStatus) LockClosed(appspaceID domain.AppspaceID) (chan struct{}, bool)

LockClosed sets the locked flag for the appspace until the return channel is closed. If the lock is already set, the second parameter will be false. (Actually returning a nil channel should be enough?)

func (*AppspaceStatus) PauseAppspace

func (s *AppspaceStatus) PauseAppspace(appspaceID domain.AppspaceID, pause bool)

PauseAppspace sets the pause flag on the status if it is tracked

func (*AppspaceStatus) Ready

func (s *AppspaceStatus) Ready(appspaceID domain.AppspaceID) bool

Ready returns true if there is nothing that prevents the appspace from being used right now.

func (*AppspaceStatus) SetHostStop

func (s *AppspaceStatus) SetHostStop(stop bool)

SetHostStop sets the hostStop flag. When set to true Ready() returns false for all appspaces.

func (*AppspaceStatus) Track

Track causes appspace id to monitored and future events will be sent It returns an event struct that represents the current state

func (*AppspaceStatus) WaitStopped

func (s *AppspaceStatus) WaitStopped(appspaceID domain.AppspaceID)

WaitStopped returns when an appspace has stopped Meant to be used in conjunction with an appspace blocking function (pause, tempPause, migrate, etc...) If you want more details, there are route hit events too.

func (*AppspaceStatus) WaitTempPaused

func (s *AppspaceStatus) WaitTempPaused(appspaceID domain.AppspaceID, reason string) chan struct{}

WaitTempPaused pauses the appspace and returns when appspace activity is stopped This function returns for only one caller at a time. It returns for the next caller when the returned channel is closed

type MigrationMinder

type MigrationMinder struct {
	AppModel interface {
		GetVersionsForApp(domain.AppID) ([]*domain.AppVersion, error)
		GetAppUrlListing(domain.AppID) (domain.AppListing, domain.AppURLData, error)
	} `checkinject:"required"`
}

MigrationMinder determines if there are potential migrations available for appspaces It will start the migrations (create a migration job) when we implement auto-upadte for appspaces It can return migration potential data for all or select appspaces much like a model Does it use events or polling?

func (*MigrationMinder) GetForAppspace

func (m *MigrationMinder) GetForAppspace(appspace domain.Appspace) (domain.Version, bool, error)

GetForAppspace looks at installed versions and remote listing versions and returns the latest available version for the appspace.

Jump to

Keyboard shortcuts

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