The freezer.engine.engine
Module¶
- Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
class
freezer.engine.engine.
BackupEngine
(storage)[source]¶ Bases:
object
The main part of making a backup and making a restore is the mechanism of implementing it. For a long time Freezer had only one mechanism of doing it - invoking gnutar and it was heavy hard-coded.
Currently we are going to support many different approaches. One of them is rsync. Having many different implementations requires to have an abstraction level
This class is an abstraction over all implementations.
Workflow: 1) invoke backup
1.1) try to download metadata for incremental 1.2) create a dataflow between backup_stream and storage.write_backup
Backup_stream is producer of data, for tar backup it creates a gnutar subprocess and start to read data from stdout Storage write_backup is consumer of data, it creates a thread that store data in storage. Both streams communicate in non-blocking mode1.3) invoke post_backup - now it uploads metadata file
- restore backup
2.1) define all incremental backups 2.2) for each incremental backup create a dataflow between
storage.read_backup and restore_stream Read_backup is data producer, it reads data chunk by chunk from the specified storage and pushes the chunks into a queue. Restore stream is a consumer, that is actually does restore (for tar it is a thread that creates gnutar subprocess and feeds chunks to stdin of this thread.
-
backup
(backup_path, hostname_backup_name, no_incremental, max_level, always_level, restart_always_level, queue_size=2)[source]¶ Here we now location of all interesting artifacts like metadata Should return stream for storing data. :return: stream
-
backup_stream
(backup_path, rich_queue, manifest_path)[source]¶ Parameters: - rich_queue (freezer.streaming.RichQueue) –
- manifest_path (list[str]) –
Returns:
-
name
¶ Return type: str Returns: Engine name