Documentation
¶
Overview ¶
Package volume owns Docker volumes: CRUD and pruning, the helper-container file browser, backup and restore, and the HTTP surface for all of it.
Index ¶
- Variables
- func RegisterVolumes(api huma.API, dockerService *docker.DockerClientService, ...)
- type BackupHasPathInput
- type BackupHasPathResponse
- type BrowseBackupFilesInput
- type CreateBackupInput
- type CreateVolumeInput
- type DeleteBackupInput
- type Dependencies
- type DownloadBackupInput
- type GetVolumeBackupPolicyInput
- type GetVolumeInput
- type GetVolumeSizesInput
- type GetVolumeUsageCountsInput
- type GetVolumeUsageInput
- type GetVolumeWorkspaceFileInput
- type GetVolumeWorkspaceInput
- type ListBackupFilesInput
- type ListBackupsInput
- type ListBackupsOutput
- type ListVolumesInput
- type ListVolumesOutput
- type Module
- type PruneVolumesInput
- type RemoveVolumeInput
- type RenameVolumeInput
- type RestoreBackupFilesInput
- type RestoreBackupInput
- type UpdateVolumeBackupPolicyInput
- type UpdateVolumeWorkspaceInput
- type UploadAndRestoreInput
- type UploadBackupInput
- type VolumeBackup
- type VolumeBackupFormat
- type VolumeBackupPaginatedResponse
- type VolumeBackupPolicy
- type VolumeBackupStatus
- type VolumeBackupTrigger
- type VolumeHandler
- func (h *VolumeHandler) BackupHasPath(ctx context.Context, input *BackupHasPathInput) (*handlerutil.Out[BackupHasPathResponse], error)
- func (h *VolumeHandler) BrowseBackupFiles(ctx context.Context, input *BrowseBackupFilesInput) (*handlerutil.Page[backuptypes.BackupFileEntry], error)
- func (h *VolumeHandler) CreateBackup(ctx context.Context, input *CreateBackupInput) (*handlerutil.Out[volumetypes.BackupEntry], error)
- func (h *VolumeHandler) CreateVolume(ctx context.Context, input *CreateVolumeInput) (*handlerutil.Out[*volumetypes.Volume], error)
- func (h *VolumeHandler) DeleteBackup(ctx context.Context, input *DeleteBackupInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *VolumeHandler) DownloadBackup(ctx context.Context, input *DownloadBackupInput) (*huma.StreamResponse, error)
- func (h *VolumeHandler) DownloadVolumeWorkspaceFile(ctx context.Context, input *GetVolumeWorkspaceFileInput) (*huma.StreamResponse, error)
- func (h *VolumeHandler) GetBackupPolicy(ctx context.Context, input *GetVolumeBackupPolicyInput) (*handlerutil.Out[volumetypes.BackupPolicyCollection], error)
- func (h *VolumeHandler) GetVolume(ctx context.Context, input *GetVolumeInput) (*handlerutil.Out[*volumetypes.Volume], error)
- func (h *VolumeHandler) GetVolumeSizes(ctx context.Context, input *GetVolumeSizesInput) (*handlerutil.Out[[]VolumeSizeInfo], error)
- func (h *VolumeHandler) GetVolumeUsage(ctx context.Context, input *GetVolumeUsageInput) (*handlerutil.Out[VolumeUsageResponse], error)
- func (h *VolumeHandler) GetVolumeUsageCounts(ctx context.Context, input *GetVolumeUsageCountsInput) (*handlerutil.Out[VolumeUsageCountsData], error)
- func (h *VolumeHandler) GetVolumeWorkspace(ctx context.Context, input *GetVolumeWorkspaceInput) (*handlerutil.Out[workspacetypes.Workspace], error)
- func (h *VolumeHandler) GetVolumeWorkspaceFile(ctx context.Context, input *GetVolumeWorkspaceFileInput) (*handlerutil.Out[workspacetypes.FileContent], error)
- func (h *VolumeHandler) ListBackupFiles(ctx context.Context, input *ListBackupFilesInput) (*handlerutil.Out[[]string], error)
- func (h *VolumeHandler) ListBackups(ctx context.Context, input *ListBackupsInput) (*ListBackupsOutput, error)
- func (h *VolumeHandler) ListVolumes(ctx context.Context, input *ListVolumesInput) (*ListVolumesOutput, error)
- func (h *VolumeHandler) PruneVolumes(ctx context.Context, input *PruneVolumesInput) (*handlerutil.Out[VolumePruneReportData], error)
- func (h *VolumeHandler) RemoveVolume(ctx context.Context, input *RemoveVolumeInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *VolumeHandler) RenameVolume(ctx context.Context, input *RenameVolumeInput) (*handlerutil.Out[*volumetypes.Volume], error)
- func (h *VolumeHandler) RestoreBackup(ctx context.Context, input *RestoreBackupInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *VolumeHandler) RestoreBackupFiles(ctx context.Context, input *RestoreBackupFilesInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *VolumeHandler) UpdateBackupPolicy(ctx context.Context, input *UpdateVolumeBackupPolicyInput) (*handlerutil.Out[volumetypes.BackupPolicyCollection], error)
- func (h *VolumeHandler) UpdateVolumeWorkspace(ctx context.Context, input *UpdateVolumeWorkspaceInput) (*handlerutil.Out[workspacetypes.Workspace], error)
- func (h *VolumeHandler) UploadAndRestore(ctx context.Context, input *UploadAndRestoreInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *VolumeHandler) UploadBackup(ctx context.Context, input *UploadBackupInput) (*handlerutil.Out[*VolumeBackup], error)
- type VolumePruneReportData
- type VolumeService
- func (s *VolumeService) BackupHasPath(ctx context.Context, backupID, filePath string) (bool, error)
- func (s *VolumeService) BackupMountWarning(ctx context.Context) string
- func (s *VolumeService) BackupStorageMount(ctx context.Context, dockerClient *client.Client, target string, readOnly bool) (mount.Mount, error)
- func (s *VolumeService) BrowseBackupFiles(ctx context.Context, backupID, requestedPath string, ...) ([]backuptypes.BackupFileEntry, pagination.Response, error)
- func (s *VolumeService) CleanupHelperContainers(ctx context.Context)
- func (s *VolumeService) CleanupOrphanedVolumeHelpers(ctx context.Context) (int, error)
- func (s *VolumeService) CountUsageFromSnapshot(volumes []volume.Volume, containers []container.Summary) volumetypes.UsageCounts
- func (s *VolumeService) CreateBackup(ctx context.Context, volumeName string, user common.User, ...) (_ *VolumeBackup, err error)
- func (s *VolumeService) CreateSystemManagedBackup(ctx context.Context, volumeName string, user common.User, ...) (*VolumeBackup, error)
- func (s *VolumeService) CreateVolume(ctx context.Context, options client.VolumeCreateOptions, user common.User) (*volumetypes.Volume, error)
- func (s *VolumeService) DeleteBackup(ctx context.Context, backupID string, user *common.User) error
- func (s *VolumeService) DeleteVolume(ctx context.Context, name string, force bool, user common.User) error
- func (s *VolumeService) DownloadBackup(ctx context.Context, backupID string, user *common.User) (io.ReadCloser, int64, error)
- func (s *VolumeService) DownloadVolumeWorkspaceFile(ctx context.Context, volumeName, relativePath string) (io.ReadCloser, int64, error)
- func (s *VolumeService) GetBackupPolicies(ctx context.Context, volumeName string) (*volumetypes.BackupPolicyCollection, error)
- func (s *VolumeService) GetVolumeByName(ctx context.Context, name string) (*volumetypes.Volume, error)
- func (s *VolumeService) GetVolumeSizes(ctx context.Context) (map[string]VolumeSizeData, error)
- func (s *VolumeService) GetVolumeUsage(ctx context.Context, name string) (bool, []string, error)
- func (s *VolumeService) GetVolumeWorkspace(ctx context.Context, volumeName string) (*workspacetypes.Workspace, error)
- func (s *VolumeService) GetVolumeWorkspaceFile(ctx context.Context, volumeName, relativePath string) (*workspacetypes.FileContent, error)
- func (s *VolumeService) HasEnabledBackupPolicy(ctx context.Context, volumeName string) (bool, error)
- func (s *VolumeService) ListBackupFiles(ctx context.Context, backupID string) ([]string, error)
- func (s *VolumeService) ListBackupVolumeOptions(ctx context.Context) ([]backuptypes.SystemVolumeBackupOption, error)
- func (s *VolumeService) ListBackups(ctx context.Context, volumeName string) ([]VolumeBackup, error)
- func (s *VolumeService) ListBackupsPaginated(ctx context.Context, volumeName string, params pagination.QueryParams) ([]VolumeBackup, pagination.Response, error)
- func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params pagination.QueryParams, includeInternal bool) ([]volumetypes.Volume, pagination.Response, volumetypes.UsageCounts, error)
- func (s *VolumeService) PruneVolumes(ctx context.Context) (*volumetypes.PruneReport, error)
- func (s *VolumeService) PruneVolumesWithOptions(ctx context.Context, all bool) (*volumetypes.PruneReport, error)
- func (s *VolumeService) ReapIdleHelpers(ctx context.Context, idleTimeout time.Duration) (int, error)
- func (s *VolumeService) ReconcileInterruptedBackups(ctx context.Context) error
- func (s *VolumeService) RegisterBackupJobsOnStartup(ctx context.Context)
- func (s *VolumeService) RenameVolume(ctx context.Context, oldName, newName string, user common.User) (*volumetypes.Volume, error)
- func (s *VolumeService) RestoreBackup(ctx context.Context, volumeName, backupID string, user common.User) (err error)
- func (s *VolumeService) RestoreBackupFiles(ctx context.Context, volumeName, backupID string, ...) (err error)
- func (s *VolumeService) SetScheduler(ctx context.Context, scheduler schedulertypes.DynamicScheduler, ...) error
- func (s *VolumeService) StartBackup(ctx context.Context, environmentID, volumeName string, user common.User, ...) (volumetypes.BackupEntry, error)
- func (s *VolumeService) StopHelper(ctx context.Context, volumeName string) error
- func (s *VolumeService) UpdateBackupPolicies(ctx context.Context, volumeName string, ...) (*volumetypes.BackupPolicyCollection, error)
- func (s *VolumeService) UpdateVolumeWorkspace(ctx context.Context, volumeName string, ...) (*workspacetypes.Workspace, error)
- func (s *VolumeService) UploadAndRestore(ctx context.Context, volumeName string, archive io.ReadSeeker, filename string, ...) error
- func (s *VolumeService) UploadBackup(ctx context.Context, backupID, s3DestinationID string) (*VolumeBackup, error)
- type VolumeSizeData
- type VolumeSizeInfo
- type VolumeUsageCountsData
- type VolumeUsageResponse
Constants ¶
This section is empty.
Variables ¶
var ErrVolumeBackupAlreadyRunning = errors.New("a backup is already running for this volume")
Functions ¶
func RegisterVolumes ¶
func RegisterVolumes(api huma.API, dockerService *docker.DockerClientService, volumeService *VolumeService, activityService *activity.ActivityService, environmentService *environment.EnvironmentService, uploadService *upload.UploadService, appCtx handlerutil.ActivityAppContext)
RegisterVolumes registers volume management routes using Huma.
Types ¶
type BackupHasPathInput ¶
type BackupHasPathResponse ¶
type BackupHasPathResponse struct {
Exists bool `json:"exists"`
}
type BrowseBackupFilesInput ¶ added in v2.10.0
type BrowseBackupFilesInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
BackupID string `path:"backupId" doc:"Backup ID"`
Path string `query:"path" doc:"Folder path relative to the backup root"`
Search string `query:"search" doc:"Case-insensitive full-path search"`
Start int `query:"start" default:"0" doc:"Start index for the page"`
Limit int `query:"limit" default:"20" doc:"Requested page size"`
}
type CreateBackupInput ¶
type CreateBackupInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
VolumeName string `path:"volumeName" doc:"Volume name"`
Body *volumetypes.CreateBackupRequest `json:"body,omitempty"`
}
type CreateVolumeInput ¶
type CreateVolumeInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Body volumetypes.Create `doc:"Volume creation data"`
}
type DeleteBackupInput ¶
type Dependencies ¶
type Dependencies struct {
DB *database.DB
Docker *docker.DockerClientService
Event *event.EventService
Settings *settings.SettingsService
Image *image.ImageService
Activity *activity.ActivityService
Environment *environment.EnvironmentService
Container *container.ContainerService
Engine *backup.Engine
S3 *s3domain.S3DestinationService
Config *config.Config
Upload *upload.UploadService
}
Dependencies are the collaborators the volume domain needs.
type DownloadBackupInput ¶
type GetVolumeBackupPolicyInput ¶ added in v2.9.0
type GetVolumeInput ¶
type GetVolumeSizesInput ¶
type GetVolumeSizesInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
}
type GetVolumeUsageInput ¶
type GetVolumeWorkspaceInput ¶
type ListBackupFilesInput ¶
type ListBackupsInput ¶
type ListBackupsInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
VolumeName string `path:"volumeName" doc:"Volume name"`
Search string `query:"search" doc:"Search query"`
Sort string `query:"sort" doc:"Column to sort by"`
Order string `query:"order" default:"asc" doc:"Sort direction"`
Start int `query:"start" default:"0" doc:"Start index"`
Limit int `query:"limit" default:"20" doc:"Limit"`
Type string `query:"type" doc:"Management origin filter"`
}
type ListBackupsOutput ¶
type ListBackupsOutput struct {
Body VolumeBackupPaginatedResponse
}
type ListVolumesInput ¶
type ListVolumesInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Search string `query:"search" doc:"Search query"`
Sort string `query:"sort" doc:"Column to sort by"`
Order string `query:"order" default:"asc" doc:"Sort direction (asc or desc)"`
Start int `query:"start" default:"0" doc:"Start index for pagination"`
Limit int `query:"limit" default:"20" doc:"Number of items per page"`
InUse string `query:"inUse" doc:"Filter by in-use status (true/false)"`
IncludeInternal bool `query:"includeInternal" default:"false" doc:"Include internal volumes"`
}
type ListVolumesOutput ¶
type ListVolumesOutput struct {
Body base.PaginatedWithCounts[volumetypes.Volume, VolumeUsageCountsData]
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module wires the volume domain and mounts its routes.
func (*Module) RegisterRoutes ¶
func (m *Module) RegisterRoutes(api huma.API, appCtx handlerutil.ActivityAppContext)
RegisterRoutes mounts the volume endpoints. A nil module still registers, so OpenAPI spec generation can discover the routes without a service graph.
func (*Module) Service ¶
func (m *Module) Service() *VolumeService
Service exposes the volume service to collaborators that use it directly, such as the helper-container reaper job.
type PruneVolumesInput ¶
type PruneVolumesInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
}
type RemoveVolumeInput ¶
type RenameVolumeInput ¶ added in v2.9.0
type RenameVolumeInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
VolumeName string `path:"volumeName" doc:"Current volume name"`
Body volumetypes.Rename `doc:"Volume rename data"`
}
type RestoreBackupFilesInput ¶
type RestoreBackupFilesInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
VolumeName string `path:"volumeName" doc:"Volume name"`
BackupID string `path:"backupId" doc:"Backup ID"`
Body backuptypes.RestoreSelection
}
type RestoreBackupInput ¶
type UpdateVolumeBackupPolicyInput ¶ added in v2.9.0
type UpdateVolumeBackupPolicyInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
VolumeName string `path:"volumeName" doc:"Volume name"`
Body volumetypes.UpdateBackupPolicies `doc:"Scheduled volume backup policies"`
}
type UploadAndRestoreInput ¶
type UploadAndRestoreInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
VolumeName string `path:"volumeName" doc:"Volume name"`
Body uploadtypes.ConsumeRequest
}
type UploadBackupInput ¶ added in v2.9.0
type UploadBackupInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
BackupID string `path:"backupId" doc:"Backup ID"`
Body volumetypes.UploadBackupRequest
}
type VolumeBackup ¶ added in v2.8.1
type VolumeBackup struct {
database.BaseModel
VolumeName string `json:"volumeName" gorm:"column:volume_name;index"`
Size int64 `json:"size" gorm:"column:size"`
CreatedAt time.Time `json:"createdAt" gorm:"column:created_at"`
Status VolumeBackupStatus `json:"status" gorm:"column:status;type:text;not null;default:succeeded"`
Trigger VolumeBackupTrigger `json:"trigger" gorm:"column:trigger;type:text;not null;default:manual"`
Destination volume.BackupDestination `json:"destination" gorm:"column:destination;type:text;not null;default:local"`
Format VolumeBackupFormat `json:"format" gorm:"column:format;type:text;not null;default:archive"`
LocalSnapshotID string `json:"localSnapshotId,omitempty" gorm:"column:local_snapshot_id;type:text"`
RemoteSnapshotID string `json:"remoteSnapshotId,omitempty" gorm:"column:remote_snapshot_id;type:text"`
S3DestinationID string `json:"s3DestinationId,omitempty" gorm:"column:s3_destination_id;type:text;index"`
S3DestinationName string `json:"s3DestinationName,omitempty" gorm:"-"`
PolicyID string `json:"policyId,omitempty" gorm:"column:policy_id;type:text;index"`
Error string `json:"error,omitempty" gorm:"column:error;type:text"`
ActivityID *string `json:"activityId,omitempty" gorm:"-"`
Type backuptypes.ManagementType `json:"type" gorm:"-"`
}
func (*VolumeBackup) TableName ¶ added in v2.8.1
func (*VolumeBackup) TableName() string
func (*VolumeBackup) ToDTO ¶ added in v2.8.1
func (b *VolumeBackup) ToDTO() volume.BackupEntry
type VolumeBackupFormat ¶ added in v2.9.0
type VolumeBackupFormat string
const ( VolumeBackupFormatArchive VolumeBackupFormat = "archive" VolumeBackupFormatRustic VolumeBackupFormat = "rustic" )
type VolumeBackupPaginatedResponse ¶
type VolumeBackupPaginatedResponse struct {
Success bool `json:"success"`
Data []VolumeBackup `json:"data"`
Pagination base.PaginationResponse `json:"pagination"`
Warnings []string `json:"warnings,omitempty"`
}
type VolumeBackupPolicy ¶ added in v2.9.0
type VolumeBackupPolicy struct {
database.BaseModel
VolumeName string `json:"volumeName" gorm:"column:volume_name;not null;index"`
Enabled bool `json:"enabled" gorm:"column:enabled;not null;default:false"`
Schedule string `json:"schedule" gorm:"column:schedule;type:text;not null"`
RetentionCount int `json:"retentionCount" gorm:"column:retention_count;not null;default:7"`
StopContainers bool `json:"stopContainers" gorm:"column:stop_containers;not null;default:false"`
LocalEnabled bool `json:"localEnabled" gorm:"column:local_enabled;not null"`
S3Enabled bool `json:"s3Enabled" gorm:"column:s3_enabled;not null;default:false"`
S3DestinationID string `json:"s3DestinationId,omitempty" gorm:"column:s3_destination_id;type:text;index"`
}
func (VolumeBackupPolicy) TableName ¶ added in v2.9.0
func (VolumeBackupPolicy) TableName() string
func (VolumeBackupPolicy) ToDTO ¶ added in v2.9.0
func (p VolumeBackupPolicy) ToDTO(lastRun *VolumeBackup) volume.BackupPolicy
type VolumeBackupStatus ¶ added in v2.9.0
type VolumeBackupStatus string
const ( VolumeBackupStatusRunning VolumeBackupStatus = "running" VolumeBackupStatusSucceeded VolumeBackupStatus = "succeeded" VolumeBackupStatusFailed VolumeBackupStatus = "failed" )
type VolumeBackupTrigger ¶ added in v2.9.0
type VolumeBackupTrigger string
const ( VolumeBackupTriggerManual VolumeBackupTrigger = "manual" VolumeBackupTriggerScheduled VolumeBackupTrigger = "scheduled" VolumeBackupTriggerSafety VolumeBackupTrigger = "safety" )
type VolumeHandler ¶
type VolumeHandler struct {
// contains filtered or unexported fields
}
VolumeHandler provides Huma-based volume management endpoints.
func (*VolumeHandler) BackupHasPath ¶
func (h *VolumeHandler) BackupHasPath(ctx context.Context, input *BackupHasPathInput) (*handlerutil.Out[BackupHasPathResponse], error)
func (*VolumeHandler) BrowseBackupFiles ¶ added in v2.10.0
func (h *VolumeHandler) BrowseBackupFiles(ctx context.Context, input *BrowseBackupFilesInput) (*handlerutil.Page[backuptypes.BackupFileEntry], error)
func (*VolumeHandler) CreateBackup ¶
func (h *VolumeHandler) CreateBackup(ctx context.Context, input *CreateBackupInput) (*handlerutil.Out[volumetypes.BackupEntry], error)
func (*VolumeHandler) CreateVolume ¶
func (h *VolumeHandler) CreateVolume(ctx context.Context, input *CreateVolumeInput) (*handlerutil.Out[*volumetypes.Volume], error)
CreateVolume creates a new Docker volume.
func (*VolumeHandler) DeleteBackup ¶
func (h *VolumeHandler) DeleteBackup(ctx context.Context, input *DeleteBackupInput) (*handlerutil.Out[base.MessageResponse], error)
func (*VolumeHandler) DownloadBackup ¶
func (h *VolumeHandler) DownloadBackup(ctx context.Context, input *DownloadBackupInput) (*huma.StreamResponse, error)
func (*VolumeHandler) DownloadVolumeWorkspaceFile ¶
func (h *VolumeHandler) DownloadVolumeWorkspaceFile(ctx context.Context, input *GetVolumeWorkspaceFileInput) (*huma.StreamResponse, error)
func (*VolumeHandler) GetBackupPolicy ¶ added in v2.9.0
func (h *VolumeHandler) GetBackupPolicy(ctx context.Context, input *GetVolumeBackupPolicyInput) (*handlerutil.Out[volumetypes.BackupPolicyCollection], error)
func (*VolumeHandler) GetVolume ¶
func (h *VolumeHandler) GetVolume(ctx context.Context, input *GetVolumeInput) (*handlerutil.Out[*volumetypes.Volume], error)
GetVolume returns a volume by name.
func (*VolumeHandler) GetVolumeSizes ¶
func (h *VolumeHandler) GetVolumeSizes(ctx context.Context, input *GetVolumeSizesInput) (*handlerutil.Out[[]VolumeSizeInfo], error)
GetVolumeSizes returns disk usage sizes for all volumes. This is a slow operation as it requires calculating disk usage.
func (*VolumeHandler) GetVolumeUsage ¶
func (h *VolumeHandler) GetVolumeUsage(ctx context.Context, input *GetVolumeUsageInput) (*handlerutil.Out[VolumeUsageResponse], error)
GetVolumeUsage returns containers using a specific volume.
func (*VolumeHandler) GetVolumeUsageCounts ¶
func (h *VolumeHandler) GetVolumeUsageCounts(ctx context.Context, input *GetVolumeUsageCountsInput) (*handlerutil.Out[VolumeUsageCountsData], error)
GetVolumeUsageCounts returns counts of volumes by usage status.
func (*VolumeHandler) GetVolumeWorkspace ¶
func (h *VolumeHandler) GetVolumeWorkspace(ctx context.Context, input *GetVolumeWorkspaceInput) (*handlerutil.Out[workspacetypes.Workspace], error)
func (*VolumeHandler) GetVolumeWorkspaceFile ¶
func (h *VolumeHandler) GetVolumeWorkspaceFile(ctx context.Context, input *GetVolumeWorkspaceFileInput) (*handlerutil.Out[workspacetypes.FileContent], error)
func (*VolumeHandler) ListBackupFiles ¶
func (h *VolumeHandler) ListBackupFiles(ctx context.Context, input *ListBackupFilesInput) (*handlerutil.Out[[]string], error)
func (*VolumeHandler) ListBackups ¶
func (h *VolumeHandler) ListBackups(ctx context.Context, input *ListBackupsInput) (*ListBackupsOutput, error)
func (*VolumeHandler) ListVolumes ¶
func (h *VolumeHandler) ListVolumes(ctx context.Context, input *ListVolumesInput) (*ListVolumesOutput, error)
ListVolumes returns a paginated list of volumes.
func (*VolumeHandler) PruneVolumes ¶
func (h *VolumeHandler) PruneVolumes(ctx context.Context, input *PruneVolumesInput) (*handlerutil.Out[VolumePruneReportData], error)
PruneVolumes removes all unused Docker volumes.
func (*VolumeHandler) RemoveVolume ¶
func (h *VolumeHandler) RemoveVolume(ctx context.Context, input *RemoveVolumeInput) (*handlerutil.Out[base.MessageResponse], error)
RemoveVolume removes a Docker volume.
func (*VolumeHandler) RenameVolume ¶ added in v2.9.0
func (h *VolumeHandler) RenameVolume(ctx context.Context, input *RenameVolumeInput) (*handlerutil.Out[*volumetypes.Volume], error)
RenameVolume renames an unused Docker volume.
func (*VolumeHandler) RestoreBackup ¶
func (h *VolumeHandler) RestoreBackup(ctx context.Context, input *RestoreBackupInput) (*handlerutil.Out[base.MessageResponse], error)
func (*VolumeHandler) RestoreBackupFiles ¶
func (h *VolumeHandler) RestoreBackupFiles(ctx context.Context, input *RestoreBackupFilesInput) (*handlerutil.Out[base.MessageResponse], error)
func (*VolumeHandler) UpdateBackupPolicy ¶ added in v2.9.0
func (h *VolumeHandler) UpdateBackupPolicy(ctx context.Context, input *UpdateVolumeBackupPolicyInput) (*handlerutil.Out[volumetypes.BackupPolicyCollection], error)
func (*VolumeHandler) UpdateVolumeWorkspace ¶
func (h *VolumeHandler) UpdateVolumeWorkspace(ctx context.Context, input *UpdateVolumeWorkspaceInput) (*handlerutil.Out[workspacetypes.Workspace], error)
func (*VolumeHandler) UploadAndRestore ¶
func (h *VolumeHandler) UploadAndRestore(ctx context.Context, input *UploadAndRestoreInput) (*handlerutil.Out[base.MessageResponse], error)
func (*VolumeHandler) UploadBackup ¶ added in v2.9.0
func (h *VolumeHandler) UploadBackup(ctx context.Context, input *UploadBackupInput) (*handlerutil.Out[*VolumeBackup], error)
type VolumePruneReportData ¶
type VolumePruneReportData struct {
VolumesDeleted []string `json:"volumesDeleted,omitempty"`
SpaceReclaimed uint64 `json:"spaceReclaimed"`
ActivityID *string `json:"activityId,omitempty"`
}
VolumePruneReportData represents the result of a volume prune operation. This is a local type to avoid schema naming conflicts with image.PruneReport.
type VolumeService ¶
type VolumeService struct {
// contains filtered or unexported fields
}
func NewVolumeService ¶
func NewVolumeService(db *database.DB, dockerService *docker.DockerClientService, eventService *event.EventService, activityService *activity.ActivityService, settingsService *settings.SettingsService, containerService *container.ContainerService, imageService *image.ImageService, engine *backup.Engine, s3Destinations *s3domain.S3DestinationService, cfg *config.Config) *VolumeService
func (*VolumeService) BackupHasPath ¶
func (*VolumeService) BackupMountWarning ¶
func (s *VolumeService) BackupMountWarning(ctx context.Context) string
func (*VolumeService) BackupStorageMount ¶ added in v2.9.0
func (s *VolumeService) BackupStorageMount(ctx context.Context, dockerClient *client.Client, target string, readOnly bool) (mount.Mount, error)
BackupStorageMount resolves the repository mount shared with system-backup operations.
func (*VolumeService) BrowseBackupFiles ¶ added in v2.10.0
func (s *VolumeService) BrowseBackupFiles(ctx context.Context, backupID, requestedPath string, params pagination.QueryParams) ([]backuptypes.BackupFileEntry, pagination.Response, error)
BrowseBackupFiles returns one lazy-loaded page from a volume backup tree.
func (*VolumeService) CleanupHelperContainers ¶
func (s *VolumeService) CleanupHelperContainers(ctx context.Context)
func (*VolumeService) CleanupOrphanedVolumeHelpers ¶
func (s *VolumeService) CleanupOrphanedVolumeHelpers(ctx context.Context) (int, error)
func (*VolumeService) CountUsageFromSnapshot ¶
func (s *VolumeService) CountUsageFromSnapshot(volumes []volume.Volume, containers []container.Summary) volumetypes.UsageCounts
CountUsageFromSnapshot derives volume usage counts from an already-fetched volume and container listing. It mirrors the semantics of ListVolumesPaginated — internal volumes are excluded and a volume counts as in use when any container mounts it — so dashboard tile numbers agree with the volumes page.
func (*VolumeService) CreateBackup ¶
func (s *VolumeService) CreateBackup(ctx context.Context, volumeName string, user common.User, trigger VolumeBackupTrigger, request volumetypes.CreateBackupRequest) (_ *VolumeBackup, err error)
func (*VolumeService) CreateSystemManagedBackup ¶ added in v2.10.0
func (s *VolumeService) CreateSystemManagedBackup(ctx context.Context, volumeName string, user common.User, trigger VolumeBackupTrigger, policyID string, policy backuptypes.UpdateBackupPolicy) (*VolumeBackup, error)
CreateSystemManagedBackup runs the existing volume backup workflow with a transient centralized policy.
func (*VolumeService) CreateVolume ¶
func (s *VolumeService) CreateVolume(ctx context.Context, options client.VolumeCreateOptions, user common.User) (*volumetypes.Volume, error)
func (*VolumeService) DeleteBackup ¶
func (*VolumeService) DeleteVolume ¶
func (*VolumeService) DownloadBackup ¶
func (s *VolumeService) DownloadBackup(ctx context.Context, backupID string, user *common.User) (io.ReadCloser, int64, error)
DownloadBackup streams a backup as a tar.gz archive. Legacy archive rows stream their stored file; local Rustic rows are restored into a scratch volume and packaged on the fly.
func (*VolumeService) DownloadVolumeWorkspaceFile ¶
func (s *VolumeService) DownloadVolumeWorkspaceFile(ctx context.Context, volumeName, relativePath string) (io.ReadCloser, int64, error)
func (*VolumeService) GetBackupPolicies ¶ added in v2.9.0
func (s *VolumeService) GetBackupPolicies(ctx context.Context, volumeName string) (*volumetypes.BackupPolicyCollection, error)
func (*VolumeService) GetVolumeByName ¶
func (s *VolumeService) GetVolumeByName(ctx context.Context, name string) (*volumetypes.Volume, error)
func (*VolumeService) GetVolumeSizes ¶
func (s *VolumeService) GetVolumeSizes(ctx context.Context) (map[string]VolumeSizeData, error)
GetVolumeSizes returns disk usage data for all volumes. This is a slow operation as it calls Docker's DiskUsage API.
func (*VolumeService) GetVolumeUsage ¶
func (*VolumeService) GetVolumeWorkspace ¶
func (s *VolumeService) GetVolumeWorkspace(ctx context.Context, volumeName string) (*workspacetypes.Workspace, error)
func (*VolumeService) GetVolumeWorkspaceFile ¶
func (s *VolumeService) GetVolumeWorkspaceFile(ctx context.Context, volumeName, relativePath string) (*workspacetypes.FileContent, error)
func (*VolumeService) HasEnabledBackupPolicy ¶ added in v2.10.0
func (s *VolumeService) HasEnabledBackupPolicy(ctx context.Context, volumeName string) (bool, error)
HasEnabledBackupPolicy reports whether a volume-level schedule takes precedence over centralized backups.
func (*VolumeService) ListBackupFiles ¶
func (*VolumeService) ListBackupVolumeOptions ¶ added in v2.10.0
func (s *VolumeService) ListBackupVolumeOptions(ctx context.Context) ([]backuptypes.SystemVolumeBackupOption, error)
ListBackupVolumeOptions returns the current non-internal volumes used by centralized backup selection.
func (*VolumeService) ListBackups ¶
func (s *VolumeService) ListBackups(ctx context.Context, volumeName string) ([]VolumeBackup, error)
func (*VolumeService) ListBackupsPaginated ¶
func (s *VolumeService) ListBackupsPaginated(ctx context.Context, volumeName string, params pagination.QueryParams) ([]VolumeBackup, pagination.Response, error)
func (*VolumeService) ListVolumesPaginated ¶
func (s *VolumeService) ListVolumesPaginated(ctx context.Context, params pagination.QueryParams, includeInternal bool) ([]volumetypes.Volume, pagination.Response, volumetypes.UsageCounts, error)
func (*VolumeService) PruneVolumes ¶
func (s *VolumeService) PruneVolumes(ctx context.Context) (*volumetypes.PruneReport, error)
func (*VolumeService) PruneVolumesWithOptions ¶
func (s *VolumeService) PruneVolumesWithOptions(ctx context.Context, all bool) (*volumetypes.PruneReport, error)
func (*VolumeService) ReapIdleHelpers ¶
func (s *VolumeService) ReapIdleHelpers(ctx context.Context, idleTimeout time.Duration) (int, error)
ReapIdleHelpers removes reused helper containers that have not serviced a request within idleTimeout. It is map-driven (orphaned helpers not tracked in helperByVolume are left to the startup orphan sweep). Entries are removed from the map before the container is removed, so a concurrent request simply gets a cache miss and re-creates a fresh helper.
func (*VolumeService) ReconcileInterruptedBackups ¶ added in v2.10.2
func (s *VolumeService) ReconcileInterruptedBackups(ctx context.Context) error
ReconcileInterruptedBackups runs before this process can accept backup work.
func (*VolumeService) RegisterBackupJobsOnStartup ¶ added in v2.9.0
func (s *VolumeService) RegisterBackupJobsOnStartup(ctx context.Context)
func (*VolumeService) RenameVolume ¶ added in v2.9.0
func (s *VolumeService) RenameVolume(ctx context.Context, oldName, newName string, user common.User) (*volumetypes.Volume, error)
RenameVolume copies an unused volume to a new name and removes the source.
func (*VolumeService) RestoreBackup ¶
func (*VolumeService) RestoreBackupFiles ¶
func (s *VolumeService) RestoreBackupFiles(ctx context.Context, volumeName, backupID string, selection backuptypes.RestoreSelection, user common.User) (err error)
func (*VolumeService) SetScheduler ¶ added in v2.9.0
func (s *VolumeService) SetScheduler(ctx context.Context, scheduler schedulertypes.DynamicScheduler, admissionGate *actors.Gate[actors.AdmissionKey]) error
SetScheduler injects the dynamic scheduler and admission gate for per-policy backup jobs. Agent mode passes them too: agents run their own volume backups.
func (*VolumeService) StartBackup ¶ added in v2.10.2
func (s *VolumeService) StartBackup(ctx context.Context, environmentID, volumeName string, user common.User, request volumetypes.CreateBackupRequest) (volumetypes.BackupEntry, error)
StartBackup persists a running backup and submits application-owned work.
func (*VolumeService) StopHelper ¶
func (s *VolumeService) StopHelper(ctx context.Context, volumeName string) error
StopHelper removes the reused helper for a single volume, if one exists. It is idempotent: stopping a volume with no active helper returns nil.
func (*VolumeService) UpdateBackupPolicies ¶ added in v2.9.0
func (s *VolumeService) UpdateBackupPolicies(ctx context.Context, volumeName string, updates []volumetypes.UpdateBackupPolicy) (*volumetypes.BackupPolicyCollection, error)
func (*VolumeService) UpdateVolumeWorkspace ¶
func (s *VolumeService) UpdateVolumeWorkspace(ctx context.Context, volumeName string, manifest volumetypes.WorkspaceUpdateManifest, uploads map[int][]byte, user common.User) (*workspacetypes.Workspace, error)
func (*VolumeService) UploadAndRestore ¶
func (s *VolumeService) UploadAndRestore(ctx context.Context, volumeName string, archive io.ReadSeeker, filename string, user common.User) error
func (*VolumeService) UploadBackup ¶ added in v2.9.0
func (s *VolumeService) UploadBackup(ctx context.Context, backupID, s3DestinationID string) (*VolumeBackup, error)
type VolumeSizeData ¶
VolumeSizeData holds size information for a volume.
type VolumeSizeInfo ¶
type VolumeSizeInfo struct {
Name string `json:"name"`
Size int64 `json:"size"`
RefCount int64 `json:"refCount"`
}
VolumeSizeInfo represents size information for a single volume.
type VolumeUsageCountsData ¶
type VolumeUsageCountsData struct {
Inuse int `json:"inuse"`
Unused int `json:"unused"`
Total int `json:"total"`
}
VolumeUsageCountsData represents the counts of volumes by usage status. This is a local type to avoid schema naming conflicts with image.UsageCounts.
type VolumeUsageResponse ¶
type VolumeUsageResponse struct {
InUse bool `json:"inUse"`
Containers []string `json:"containers"`
}
VolumeUsageResponse represents volume usage information.