archiver

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: Apache-2.0 Imports: 16 Imported by: 2 modules, 2 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

Overview

Package archiver manages the WAL archiving process

Package archiver contain the code relative to the barman-cloud-wal-archive command

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WALArchiver

type WALArchiver struct {
	// contains filtered or unexported fields
}

WALArchiver is a structure containing every info need to archive a set of WAL files using barman-cloud-wal-archive

func New

func New(
	ctx context.Context,
	env []string,
	spoolDirectory string,
	pgDataDirectory string,
	emptyWalArchivePath string,
) (archiver *WALArchiver, err error)

New creates a new WAL archiver

func (*WALArchiver) ArchiveList

func (archiver *WALArchiver) ArchiveList(
	ctx context.Context,
	walNames []string,
	options []string,
) (result []WALArchiverResult)

ArchiveList archives a list of WAL files in parallel

func (*WALArchiver) BarmanCloudCheckWalArchiveOptions

func (archiver *WALArchiver) BarmanCloudCheckWalArchiveOptions(
	ctx context.Context,
	configuration *api.BarmanObjectStoreConfiguration,
	clusterName string,
) ([]string, error)

BarmanCloudCheckWalArchiveOptions create the options needed for the `barman-cloud-check-wal-archive` command.

func (*WALArchiver) BarmanCloudWalArchiveOptions

func (archiver *WALArchiver) BarmanCloudWalArchiveOptions(
	ctx context.Context,
	configuration *barmanApi.BarmanObjectStoreConfiguration,
	clusterName string,
) ([]string, error)

BarmanCloudWalArchiveOptions calculates the set of options to be used with barman-cloud-wal-archive

func (*WALArchiver) CheckWalArchiveDestination

func (archiver *WALArchiver) CheckWalArchiveDestination(ctx context.Context, options []string) error

CheckWalArchiveDestination checks if the destinationObjectStore is ready perform archiving. Based on this ticket in Barman https://github.com/EnterpriseDB/barman/issues/432 and its implementation https://github.com/EnterpriseDB/barman/pull/443 The idea here is to check ONLY if we're archiving the wal files for the first time in the bucket since in this case the command barman-cloud-check-wal-archive will fail if the bucket exist and contain wal files inside

func (*WALArchiver) DeleteFromSpool

func (archiver *WALArchiver) DeleteFromSpool(walName string) (hasBeenDeleted bool, err error)

DeleteFromSpool checks if a WAL file is in the spool and, if it is, remove it

func (*WALArchiver) GatherWALFilesToArchive

func (archiver *WALArchiver) GatherWALFilesToArchive(
	ctx context.Context,
	requestedWALFile string,
	parallel int,
) (walList []string)

GatherWALFilesToArchive reads from the archived status the list of WAL files that can be archived in parallel way. `requestedWALFile` is the name of the file whose archiving was requested by PostgreSQL, and that file is always the first of the list and is always included. `parallel` is the maximum number of WALs that we can archive in parallel

type WALArchiverResult

type WALArchiverResult struct {
	// The WAL that have been archived
	WalName string

	// If not nil, this is the error that has been detected
	Err error

	// The time when we started barman-cloud-wal-archive
	StartTime time.Time

	// The time when end barman-cloud-wal-archive ended
	EndTime time.Time
}

WALArchiverResult contains the result of the archival of one WAL

Jump to

Keyboard shortcuts

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