Documentation
¶
Overview ¶
Package archive creates compressed tar archives of context data with optional SMB backup.
Index ¶
- func BackupGlobal(w io.Writer, home, timestamp string, smb *SMBConfig) (entity.BackupResult, error)
- func BackupProject(w io.Writer, home, timestamp string, smb *SMBConfig) (entity.BackupResult, error)
- func CheckBackupMarker(markerPath string, warnings []string) []string
- func CheckSMBMountWarnings(smbURL string, warnings []string) []string
- func CopyToSMB(cfg *SMBConfig, localPath string) error
- func CreateArchive(archivePath string, entries []entity.ArchiveEntry, w io.Writer) error
- func EnsureSMBMount(cfg *SMBConfig) error
- type SMBConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackupGlobal ¶
func BackupGlobal( w io.Writer, home, timestamp string, smb *SMBConfig, ) (entity.BackupResult, error)
BackupGlobal creates a global-scoped backup archive.
Parameters:
- w: writer for diagnostic output (typically stderr)
- home: user home directory
- timestamp: formatted timestamp for the archive filename
- smb: optional SMB configuration (nil to skip remote copy)
Returns:
- BackupResult: archive path, size, and optional SMB destination
- error: non-nil on archive or SMB failure
func BackupProject ¶
func BackupProject( w io.Writer, home, timestamp string, smb *SMBConfig, ) (entity.BackupResult, error)
BackupProject creates a project-scoped backup archive.
Parameters:
- w: writer for diagnostic output (typically stderr)
- home: user home directory
- timestamp: formatted timestamp for the archive filename
- smb: optional SMB configuration (nil to skip remote copy)
Returns:
- BackupResult: archive path, size, and optional SMB destination
- error: non-nil on archive or SMB failure
func CheckBackupMarker ¶
CheckBackupMarker checks the backup marker file age and appends warnings when the marker is missing or older than config.BackupMaxAgeDays.
Parameters:
- markerPath: absolute path to the backup marker file
- warnings: existing warning slice to append to
Returns:
- []string: the warnings slice, possibly with staleness warnings appended
func CheckSMBMountWarnings ¶
CheckSMBMountWarnings checks whether the GVFS mount for the given SMB URL exists and appends warning strings if the share is not mounted.
Parameters:
- smbURL: the SMB share URL from the environment
- warnings: existing warning slice to append to
Returns:
- []string: the warnings slice, possibly with SMB mount warnings appended
func CopyToSMB ¶
CopyToSMB copies a local file to the SMB share destination directory.
Parameters:
- cfg: SMB configuration
- localPath: Path to the local file to copy
Returns:
- error: Non-nil on copy failure
func CreateArchive ¶
CreateArchive builds a tar.gz archive from the given entries.
Parameters:
- archivePath: output file path for the archive
- entries: directories and files to include
- w: writer for diagnostic output (typically stderr)
Returns:
- error: non-nil on file creation or tar writing failure
func EnsureSMBMount ¶
EnsureSMBMount checks if the GVFS mount exists and attempts gio mount if not.
Parameters:
- cfg: SMB configuration
Returns:
- error: Non-nil if mount fails
Types ¶
type SMBConfig ¶
SMBConfig holds parsed SMB share connection details.
func ParseSMBConfig ¶
ParseSMBConfig parses an SMB URL and subdirectory into a config struct with the derived GVFS mount path.
Parameters:
- smbURL: SMB share URL (e.g. smb://host/share)
- subdir: Subdirectory on share (empty uses default)
Returns:
- *SMBConfig: Parsed config
- error: Non-nil on invalid URL