help="specify path to backup data store")
parser.add_option("--localdb", dest="localdb",
help="specify path to local database")
+parser.add_option("--intent", dest="intent", default=1.0,
+ help="give expected next snapshot type when cleaning")
(options, args) = parser.parse_args(sys.argv[1:])
# Read a passphrase from the user and store it in the LBS_GPG_PASSPHRASE
db = lbs.LocalDatabase(options.localdb)
# Delete old snapshots from the local database.
- db.garbage_collect()
- db.commit()
+ #db.garbage_collect()
+ #db.commit()
# Run the segment cleaner.
# Syntax: $0 --localdb=LOCALDB clean
db = lbs.LocalDatabase(options.localdb)
# Delete old snapshots from the local database.
- db.garbage_collect()
+ intent = float(options.intent)
+ for s in db.list_schemes():
+ db.garbage_collect(s, intent)
# Expire segments which are poorly-utilized.
for s in db.get_segment_cleaning_list():
destdir = args[1]
paths = args[2:]
+ def matchpath(path):
+ "Return true if the specified path should be included in the restore."
+
+ # No specification of what to restore => restore everything
+ if len(paths) == 0: return True
+
+ for p in paths:
+ if path == p: return True
+ if path.startswith(p + "/"): return True
+ return False
+
def warn(m, msg):
print "Warning: %s: %s" % (m.items.name, msg)
pathname = os.path.normpath(m.items.name)
while os.path.isabs(pathname):
pathname = pathname[1:]
+ if not matchpath(pathname): continue
print pathname
destpath = os.path.join(destdir, pathname)
(path, filename) = os.path.split(destpath)