Help us shape the future of Go! Take the 2026 Go Developer Survey

appspaceops

package
v0.14.5 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Avatars

type Avatars struct {
	Config                *domain.RuntimeConfig `checkinject:"required"`
	AppspaceLocation2Path interface {
		Avatar(string, string) string
	}
}

func (*Avatars) Remove

func (a *Avatars) Remove(locationKey string, fn string) error

func (*Avatars) Save

func (a *Avatars) Save(locationKey string, proxyID domain.ProxyID, img io.Reader) (string, error)

Save cuts the image down to size and saves it in appspace data dir It returns the filename of the image as a string

type BackupAppspace

type BackupAppspace struct {
	AppspaceModel interface {
		GetFromID(appspaceID domain.AppspaceID) (*domain.Appspace, error)
	} `checkinject:"required"`
	SandboxManager interface {
		StopAppspace(domain.AppspaceID)
	} `checkinject:"required"`
	AppspaceStatus interface {
		WaitTempPaused(appspaceID domain.AppspaceID, reason string) chan struct{}
		IsTempPaused(appspaceID domain.AppspaceID) bool
		LockClosed(appspaceID domain.AppspaceID) (chan struct{}, bool)
	} `checkinject:"required"`
	AppspaceMetaDB interface {
		CloseConn(appspaceID domain.AppspaceID) error
	} `checkinject:"required"`
	AppspaceLogger interface {
		Log(appspaceID domain.AppspaceID, source string, message string)
		Close(appspaceID domain.AppspaceID)
	} `checkinject:"required"`
	AppspaceLocation2Path interface {
		Data(string) string
		Backups(string) string
		Backup(string, string) string
	} `checkinject:"required"`
}

func (*BackupAppspace) BackupNoPause

func (e *BackupAppspace) BackupNoPause(appspaceID domain.AppspaceID) (string, error)

BackupNoPause creates a backup zip file like CreateBackup but it expects the appspace to be already paused

func (*BackupAppspace) CreateBackup

func (e *BackupAppspace) CreateBackup(appspaceID domain.AppspaceID) (string, error)

CreateBackup everything that an appspace might need to be re-created somewhere. Useful for making backups and export / transfers of appspace CreateBackup fetches its own pause.

type CreateAppspace added in v0.9.0

type CreateAppspace struct {
	AppspaceModel interface {
		Create(domain.Appspace) (*domain.Appspace, error)
		Delete(domain.AppspaceID) error
	} `checkinject:"required"`
	AppspaceFilesModel interface {
		CreateLocation() (string, error)
		DeleteLocation(string) error
	} `checkinject:"required"`
	AppspaceMetaDB interface {
		Create(domain.AppspaceID) error
	} `checkinject:"required"`
	AppspaceUserModel interface {
		Create(appspaceID domain.AppspaceID, displayName string, avatar string, auths []domain.EditAppspaceUserAuth) (domain.ProxyID, error)
	} `checkinject:"required"`
	UserModel interface {
		GetFromID(domain.UserID) (domain.User, error)
	} `checkinject:"required"`
	DomainController interface {
		CheckAppspaceDomain(userID domain.UserID, dom string, subdomain string) (domain.DomainCheckResult, error)
		StartManaging(dom string) error
	} `checkinject:"required"`
	MigrationJobModel interface {
		Create(domain.UserID, domain.AppspaceID, domain.Version, bool) (*domain.MigrationJob, error)
	} `checkinject:"required"`
	MigrationJobController interface {
		WakeUp()
	} `checkinject:"required"`
}

func (*CreateAppspace) Create added in v0.9.0

func (c *CreateAppspace) Create(dropID domain.DropID, appVersion domain.AppVersion, baseDomain, subDomain string) (domain.AppspaceID, domain.JobID, error)

Create a new appspace

type DeleteAppspace

type DeleteAppspace struct {
	AppspaceStatus interface {
		WaitTempPaused(appspaceID domain.AppspaceID, reason string) chan struct{}
		LockClosed(appspaceID domain.AppspaceID) (chan struct{}, bool)
	} `checkinject:"required"`
	AppspaceModel interface {
		Delete(domain.AppspaceID) error
	} `checkinject:"required"`
	AppspaceFilesModel interface {
		DeleteLocation(string) error
	} `checkinject:"required"`
	AppspaceTSNetModel interface {
		Delete(appspaceID domain.AppspaceID) error
	} `checkinject:"required"`
	AppspaceTSNet interface {
		Delete(appspaceID domain.AppspaceID) error
	} `checkinject:"required"`
	DomainController interface {
		StopManaging(string)
	} `checkinject:"required"`
	MigrationJobModel interface {
		DeleteForAppspace(domain.AppspaceID) error
	} `checkinject:"required"`
	SandboxManager interface {
		StopAppspace(domain.AppspaceID)
	} `checkinject:"required"`
	AppspaceLogger interface {
		Forget(domain.AppspaceID)
	} `checkinject:"required"`
}

func (*DeleteAppspace) Delete

func (d *DeleteAppspace) Delete(appspace domain.Appspace) error

Delete permanently deletes all data associated with an appspace

type ManageUsers added in v0.14.0

type ManageUsers struct {
	AppspaceModel interface {
	} `checkinject:"required"`
	AppspaceUserModel interface {
		GetAll(appspaceID domain.AppspaceID) ([]domain.AppspaceUser, error)
		Create(appspaceID domain.AppspaceID, displayName string, avatar string, auths []domain.EditAppspaceUserAuth) (domain.ProxyID, error)
		Update(appspaceID domain.AppspaceID, proxyID domain.ProxyID, displayName string, avatar string, auths []domain.EditAppspaceUserAuth) error
	} `checkinject:"required"`
	Avatars interface {
		Save(locationKey string, proxyID domain.ProxyID, img io.Reader) (string, error)
	} `checkinject:"required"`
	AppspaceTSNet interface {
		GetPeerUsers(appspaceID domain.AppspaceID) []domain.TSNetPeerUser
	} `checkinject:"required"`
	AppspaceTSNetPeersEvents interface {
		Subscribe() <-chan domain.AppspaceID
		Unsubscribe(ch <-chan domain.AppspaceID)
	} `checkinject:"required"`
	// contains filtered or unexported fields
}

func (*ManageUsers) Init added in v0.14.0

func (m *ManageUsers) Init()

type MigrationJobController

type MigrationJobController struct {
	MigrationJobModel interface {
		GetPending() ([]*domain.MigrationJob, error)
		SetStarted(domain.JobID) (bool, error)
		SetFinished(domain.JobID, nulltypes.NullString) error
	} `checkinject:"required"`
	AppModel interface {
		GetVersion(domain.AppID, domain.Version) (domain.AppVersion, error)
	} `checkinject:"required"`
	AppspaceModel interface {
		GetFromID(domain.AppspaceID) (*domain.Appspace, error)
		SetVersion(domain.AppspaceID, domain.Version) error
	} `checkinject:"required"`
	AppspaceInfoModel interface {
		GetSchema(domain.AppspaceID) (int, error)
		SetSchema(domain.AppspaceID, int) error
	} `checkinject:"required"`
	AppspaceLogger interface {
		Log(appspaceID domain.AppspaceID, source string, message string)
	} `checkinject:"required"`
	AppspaceStatus interface {
		WaitTempPaused(appspaceID domain.AppspaceID, reason string) chan struct{}
	} `checkinject:"required"`
	BackupAppspace interface {
		BackupNoPause(appspaceID domain.AppspaceID) (string, error)
	} `checkinject:"optional"`
	RestoreAppspace interface {
		PrepareBackup(appspaceID domain.AppspaceID, backupFile string) (string, error)
		ReplaceData(tok string, appspaceID domain.AppspaceID) error
	} `checkinject:"optional"`
	SandboxManager interface {
		StopAppspace(domain.AppspaceID)
		ForMigration(appVersion domain.AppVersion, appspace *domain.Appspace) (domain.SandboxI, error)
	} `checkinject:"required"`
	// contains filtered or unexported fields
}

MigrationJobController handles appspace functionality

func (*MigrationJobController) Start

func (c *MigrationJobController) Start()

Start allows jobs to run and can start the first job with a delay (in the future)

func (*MigrationJobController) Stop

func (c *MigrationJobController) Stop()

Stop blocks further jobs from starting and waits for the last job to finish before returning.

func (*MigrationJobController) WakeUp

func (c *MigrationJobController) WakeUp()

WakeUp tells the job controller to immediately look for a job to process Call this after inserting a new job with high priority to start that job right away (if possible, depending on load and other jobs in the queue)

type PauseAppspace

type PauseAppspace struct {
	AppspaceModel interface {
		Pause(appspaceID domain.AppspaceID, pause bool) error
	} `checkinject:"required"`
	AppspaceStatus interface {
		PauseAppspace(domain.AppspaceID, bool)
	} `checkinject:"required"`
	SandboxManager interface {
		StopAppspace(domain.AppspaceID)
	} `checkinject:"required"`
	AppspaceLogger interface {
		Log(appspaceID domain.AppspaceID, source string, message string)
	} `checkinject:"required"`
}

func (*PauseAppspace) Pause

func (p *PauseAppspace) Pause(appspaceID domain.AppspaceID, pause bool) error

Pause the appspace

type RestoreAppspace

type RestoreAppspace struct {
	InfoModel interface {
		GetAppspaceMetaInfo(dataPath string) (domain.AppspaceMetaInfo, error)
	} `checkinject:"required"`
	AppspaceModel interface {
		GetFromID(appspaceID domain.AppspaceID) (*domain.Appspace, error)
	} `checkinject:"required"`
	AppspaceFilesModel interface {
		CheckDataFiles(dataDir string) error
		ReplaceData(appspace domain.Appspace, source string) error
	} `checkinject:"required"`
	SandboxManager interface {
		StopAppspace(domain.AppspaceID)
	} `checkinject:"required"`
	AppspaceStatus interface {
		WaitTempPaused(appspaceID domain.AppspaceID, reason string) chan struct{}
		IsTempPaused(appspaceID domain.AppspaceID) bool
		LockClosed(appspaceID domain.AppspaceID) (chan struct{}, bool)
	} `checkinject:"required"`
	AppspaceMetaDB interface {
		OfflineMigrate(appspaceID domain.AppspaceID) error
		CloseConn(appspaceID domain.AppspaceID) error
	} `checkinject:"required"`
	AppspaceLogger interface {
		Log(appspaceID domain.AppspaceID, source string, message string)
		Close(appspaceID domain.AppspaceID)
	} `checkinject:"required"`
	AppspaceLocation2Path interface {
		Backup(string, string) string
	} `checkinject:"required"`
	// contains filtered or unexported fields
}

RestoreBackup replaces an appspace's data files

func (*RestoreAppspace) CheckAppspaceDataValid

func (r *RestoreAppspace) CheckAppspaceDataValid(tok string) error

CheckAppspaceDataValid does basic checking of uploaded data

func (*RestoreAppspace) DeleteAll

func (r *RestoreAppspace) DeleteAll()

func (*RestoreAppspace) GetMetaInfo

func (r *RestoreAppspace) GetMetaInfo(tok string) (domain.AppspaceMetaInfo, error)

GetMetaInfo gets the info stored in appspace data Any error can be assumed to be the result of bad input

func (*RestoreAppspace) Init

func (r *RestoreAppspace) Init()

func (*RestoreAppspace) Prepare

func (r *RestoreAppspace) Prepare(reader io.Reader) (string, error)

Prepare an io.Reader pointing to a zip file to restore to an appspace

func (*RestoreAppspace) PrepareBackup

func (r *RestoreAppspace) PrepareBackup(appspaceID domain.AppspaceID, backupFile string) (string, error)

PrepareBackup prepares an appspace's existing backup to restore

func (*RestoreAppspace) ReplaceData

func (r *RestoreAppspace) ReplaceData(tok string, appspaceID domain.AppspaceID) error

ReplaceData stops the appspace and replaces the data files

Jump to

Keyboard shortcuts

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