Skip to content

Instantly share code, notes, and snippets.

@flavianmissi
Last active December 11, 2015 10:38
Show Gist options
  • Save flavianmissi/4587616 to your computer and use it in GitHub Desktop.
Save flavianmissi/4587616 to your computer and use it in GitHub Desktop.
backuper structure for tsuru
class Backuper(object):
def __init__(access, secret):
pass
def backup(self, instances):
image_id = self.snapshot(instances)
self.remove_old()
self.save_current(image_id)
def snapshot(self, instances):
"""takes a snapshot of the given VMs"""
pass
def remove_old(self):
"""removes the old image (which is the only one for an instance)
from the database"""
pass
def save_current(self, image_id):
"""stores the image id in the databse"""
pass
def cleaner(self):
"""compares the images on s3 with the images on database,
if there are extra images in the database, delete them"""
pass
def backup(access, secret, instances):
Backuper(access, secret).backup(instances)
def backup(access, secret, instances):
image_id = snapshot()
remove_old()
save_current(image_id)
def snapshot(self, instances):
"""takes a snapshot of the given VMs"""
pass
def remove_old(self):
"""removes the old image (which is the only one for an instance)
from the database"""
pass
def save_current(self, image_id):
"""stores the image id in the databse"""
pass
def clean(self):
"""compares the images on s3 with the images on database,
if there are extra images in the database, delete them"""
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment