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

appdelete

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package appdelete deletes an app: settles its storage (R-204), archives it and starts its teardown.

One path for a person's delete through the API and Pando's own deletion of an idle app (R-398), so host policy's require_backup_before_destroy (R-284) holds for both. It used to be handler code, which is how the setting came to be read nowhere.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Apps

type Apps interface {
	VolumeCount(ctx context.Context, appID string) (int, error)
	RevisionByID(ctx context.Context, specID string) (state.Revision, bool, error)
	DiscardStorage(ctx context.Context, appID string) error
	Archive(ctx context.Context, appID string) error
}

Apps is the app store's part.

type Auditor

type Auditor interface {
	Write(ctx context.Context, e audit.Event) error
}

Auditor writes audit events.

type BackupCreator

type BackupCreator interface {
	CreateForApp(ctx context.Context, id string, req backup.AppCreateRequest) (backup.Created, error)
}

BackupCreator takes the backup itself.

type Backups

type Backups interface {
	NewID() string
	Record(ctx context.Context, rec state.Backup) error
}

Backups takes and records the final backup.

type PolicyLoader

type PolicyLoader interface {
	Load(ctx context.Context) (policy.Document, error)
}

PolicyLoader reads host policy.

type Request

type Request struct {
	Storage Storage

	// Actor is who is deleting, for the audit events: the principal fields
	// and request ID. Action and detail are filled in here.
	Actor audit.Event

	// Reason, when set, goes into the app.delete event's detail — "idle" for
	// the idle pass — so the log says why an app went with nobody's name on it.
	Reason string
}

Request is one deletion.

type Result

type Result struct {
	VolumesDiscarded int
	// BackupID is the final backup holding the app's data, when one was kept.
	BackupID string
}

Result is what a deletion did.

type Service

type Service struct {
	Apps    Apps
	Volumes VolumeDeleter

	// Backups, Backup and BundleSource take the final backup. Nil leaves
	// backups unavailable, and a delete that needs one is refused.
	Backups      Backups
	Backup       BackupCreator
	BundleSource VolumeResolver

	// Policy is host policy. Nil requires no backup.
	Policy PolicyLoader

	Auditor Auditor

	// TeardownNow asks for the deleted app's bundle to be torn down now
	// rather than at the next pass. Optional.
	TeardownNow func()
}

Service deletes apps.

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, app state.App, req Request) (Result, error)

Delete deletes app, settling its storage as req says.

Refused, with nothing changed, when the app has volumes and req does not say what to do with them (STATE_BACKUP_DECISION_REQUIRED), when it says to discard them and host policy requires a backup (POLICY_BACKUP_REQUIRED), and when the backup fails: a failed backup means the data is not safe, so deleting is the one thing not to do.

type Storage

type Storage string

Storage is what to do with an app's volumes.

const (
	// StorageUndecided: the caller has not said. Refused for an app with
	// volumes, so nobody discards data by leaving a parameter out.
	StorageUndecided Storage = ""
	// StorageBackUp keeps a final backup, until somebody discards it.
	StorageBackUp Storage = "backup"
	// StorageDiscard deletes the volumes with no backup.
	StorageDiscard Storage = "discard"
	// StoragePolicy lets host policy answer: back up when it requires a
	// backup, discard otherwise. Pando's own deletions, with nobody present
	// to be asked (R-398).
	StoragePolicy Storage = "policy"
)

type VolumeDeleter

type VolumeDeleter interface {
	DeleteForApp(ctx context.Context, appID string) error
}

VolumeDeleter removes an app's volume rows once its storage is settled.

type VolumeResolver

type VolumeResolver interface {
	VolumesForApp(ctx context.Context, appID string) ([]backup.VolumeRef, error)
}

VolumeResolver resolves an app's volumes to their runtime handles.

Jump to

Keyboard shortcuts

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