backups

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupManager

type BackupManager struct {
	Config   *config.Configuration // Configuration settings for backup operations
	S3Client *s3.S3                // AWS S3 client for uploading backups to S3
}

BackupManager manages database backups, supporting both local disk and S3 storage.

func NewBackupManager

func NewBackupManager() (*BackupManager, error)

NewBackupManager initializes a BackupManager with configurations for local and S3 storage. It returns a BackupManager or an error if the configuration or AWS session creation fails.

Returns: - *BackupManager: A new instance of BackupManager with initialized configuration and S3 client. - error: An error if configuration fetching or S3 session initialization fails.

func (*BackupManager) BackupToDisk

func (bm *BackupManager) BackupToDisk(ctx context.Context) (string, error)

BackupToDisk creates a backup of the PostgreSQL database and stores it locally on disk. It creates a directory based on the current date and stores the backup as a SQL file.

Parameters: - ctx context.Context: The context for managing cancellation and deadlines.

Returns: - string: The path to the backup file. - error: An error if the backup process fails.

func (*BackupManager) BackupToS3

func (bm *BackupManager) BackupToS3(ctx context.Context) error

BackupToS3 performs a database backup and uploads the resulting file to an S3 bucket. It first calls BackupToDisk to create a local backup, then uploads the file to S3.

Parameters: - ctx context.Context: The context for managing cancellation and deadlines.

Returns: - error: An error if the backup process or upload to S3 fails.

Jump to

Keyboard shortcuts

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