1 import exceptions, re, urlparse
4 'checksums': re.compile(r"^snapshot-(.*)\.(\w+)sums$"),
5 'segments': re.compile(r"^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(\.\S+)?$"),
6 'snapshots': re.compile(r"^snapshot-(.*)\.lbs$")
9 class NotFoundError(exceptions.KeyError):
10 """Exception thrown when a file is not found in a repository."""
15 """Base class for all cumulus storage backends."""
18 raise NotImplementedException
20 def get(self, type, name):
21 raise NotImplementedException
23 def put(self, type, name, fp):
24 raise NotImplementedException
26 def delete(self, type, name):
27 raise NotImplementedException
30 (scheme, netloc, path, params, query, fragment) \
31 = urlparse.urlparse(url)
34 import cumulus.store.file
35 return cumulus.store.file.FileStore(path)
37 import cumulus.store.s3
38 while path.startswith("/"): path = path[1:]
39 (bucket, path) = path.split("/", 1)
40 return cumulus.store.s3.S3Store(bucket, path)
42 raise NotImplementedException