import os, re, sha, tarfile, tempfile, thread
from pysqlite2 import dbapi2 as sqlite3
+# The largest supported snapshot format that can be understood.
+FORMAT_VERSION = (0, 2) # LBS Snapshot v0.2
+
# Maximum number of nested indirect references allowed in a snapshot.
MAX_RECURSION_DEPTH = 3
def load_object(self, segment, object):
path = os.path.join(self.get_cachedir(), segment, object)
if not os.access(path, os.R_OK):
- print "Extracting", segment
self.extract_segment(segment)
if segment in self.lru_list: self.lru_list.remove(segment)
self.lru_list.append(segment)
except StopIteration:
return {}
+def parse_metadata_version(s):
+ """Convert a string with the snapshot version format to a tuple."""
+
+ m = re.match(r"^LBS Snapshot v(\d+(\.\d+)*)$", s)
+ if m is None:
+ return ()
+ else:
+ return tuple([int(d) for d in m.group(1).split(".")])
+
def read_metadata(object_store, root):
"""Iterate through all lines in the metadata log, following references."""