Documentation ¶
Index ¶
- type Avatars
- type BackupAppspace
- type CreateAppspace
- type DeleteAppspace
- type MigrationJobController
- type PauseAppspace
- type RestoreAppspace
- func (r *RestoreAppspace) CheckAppspaceDataValid(tok string) error
- func (r *RestoreAppspace) DeleteAll()
- func (r *RestoreAppspace) GetMetaInfo(tok string) (domain.AppspaceMetaInfo, error)
- func (r *RestoreAppspace) Init()
- func (r *RestoreAppspace) Prepare(reader io.Reader) (string, error)
- func (r *RestoreAppspace) PrepareBackup(appspaceID domain.AppspaceID, backupFile string) (string, error)
- func (r *RestoreAppspace) ReplaceData(tok string, appspaceID domain.AppspaceID) error
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 } }
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, int) error } `checkinject:"required"` AppspaceUserModel interface { Create(appspaceID domain.AppspaceID, authType string, authID string) (domain.ProxyID, 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"` 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"` }
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 { 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