barman.clients.cloud_walarchive module#
- class barman.clients.cloud_walarchive.CloudWalUploader(cloud_interface, server_name, compression=None)View on GitHub#
Bases:
object
Cloud storage upload client
- __init__(cloud_interface, server_name, compression=None)View on GitHub#
Object responsible for handling interactions with cloud storage
- Parameters:
cloud_interface (CloudInterface) – The interface to use to upload the backup
server_name (str) – The name of the server as configured in Barman
compression (str) – Compression algorithm to use
- retrieve_file_obj(wal_path)View on GitHub#
Create the correct type of file object necessary for the file transfer.
If no compression is required a simple File object is returned.
In case of compression, a BytesIO object is returned, containing the result of the compression.
NOTE: the Wal files are actually compressed straight into memory, thanks to the usual small dimension of the WAL. This could change in the future because the WAL files dimension could be more than 16MB on some postgres install.
TODO: Evaluate using tempfile if the WAL is bigger than 16MB
- Parameters:
wal_path (str)
- Return File:
simple or compressed file object
- retrieve_wal_name(wal_path)View on GitHub#
Extract the name of the WAL file from the complete path.
If no compression is specified, then the simple file name is returned.
In case of compression, the correct file extension is applied to the WAL file name.
- Parameters:
wal_path (str) – the WAL file complete path
- Return str:
WAL file name
- upload_wal(wal_path, override_tags=None)View on GitHub#
Upload a WAL file from postgres to cloud storage
- barman.clients.cloud_walarchive.__is_hook_script()View on GitHub#
Check the environment and determine if we are running as a hook script
- barman.clients.cloud_walarchive.main(args=None)View on GitHub#
The main script entry point
- barman.clients.cloud_walarchive.parse_arguments(args=None)View on GitHub#
Parse command line arguments
- Returns:
The options parsed