summaryrefslogtreecommitdiff
path: root/obnamlib/plugins/fuse_plugin.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2015-08-19 19:12:19 +0200
committerLars Wirzenius <liw@liw.fi>2015-08-19 19:58:32 +0200
commit8b39988d0cccff274a7bf7e36448dcc7216c2ea3 (patch)
treeb3dec8118cf8540bdbf804f0cbfcf51f3dadaea4 /obnamlib/plugins/fuse_plugin.py
parent7e462bae7d53f08ed6079c522bbe237bbc1c3cc5 (diff)
downloadobnam-8b39988d0cccff274a7bf7e36448dcc7216c2ea3.tar.gz
Add get_metadata_from_file_keys and use it
Diffstat (limited to 'obnamlib/plugins/fuse_plugin.py')
-rw-r--r--obnamlib/plugins/fuse_plugin.py33
1 files changed, 2 insertions, 31 deletions
diff --git a/obnamlib/plugins/fuse_plugin.py b/obnamlib/plugins/fuse_plugin.py
index 2bf8d0a7..a52b77d6 100644
--- a/obnamlib/plugins/fuse_plugin.py
+++ b/obnamlib/plugins/fuse_plugin.py
@@ -282,8 +282,8 @@ class ObnamFuse(fuse.Fuse):
def get_metadata_in_generation(self, path):
tracing.trace('path=%r', path)
- metadata = self.construct_metadata_object(
- self.obnam.repo, *self.get_gen_path(path))
+ gen, filename = self.get_gen_path(path)
+ metadata = self.obnam.repo.get_metadata_from_file_keys(gen, filename)
# FUSE does not allow negative timestamps, truncate to zero
if metadata.st_atime_sec < 0:
@@ -293,35 +293,6 @@ class ObnamFuse(fuse.Fuse):
return metadata
- def construct_metadata_object(self, repo, gen, filename):
- allowed = set(repo.get_allowed_file_keys())
-
- def K(key):
- if key in allowed:
- return repo.get_file_key(gen, filename, key)
- else:
- return None
-
- return obnamlib.Metadata(
- st_atime_sec=K(obnamlib.REPO_FILE_ATIME_SEC),
- st_atime_nsec=K(obnamlib.REPO_FILE_ATIME_NSEC),
- st_mtime_sec=K(obnamlib.REPO_FILE_MTIME_SEC),
- st_mtime_nsec=K(obnamlib.REPO_FILE_MTIME_NSEC),
- st_blocks=K(obnamlib.REPO_FILE_BLOCKS),
- st_dev=K(obnamlib.REPO_FILE_DEV),
- st_gid=K(obnamlib.REPO_FILE_GID),
- st_ino=K(obnamlib.REPO_FILE_INO),
- st_mode=K(obnamlib.REPO_FILE_MODE),
- st_nlink=K(obnamlib.REPO_FILE_NLINK),
- st_size=K(obnamlib.REPO_FILE_SIZE),
- st_uid=K(obnamlib.REPO_FILE_UID),
- username=K(obnamlib.REPO_FILE_USERNAME),
- groupname=K(obnamlib.REPO_FILE_GROUPNAME),
- target=K(obnamlib.REPO_FILE_SYMLINK_TARGET),
- xattr=K(obnamlib.REPO_FILE_XATTR_BLOB),
- md5=K(obnamlib.REPO_FILE_MD5),
- )
-
def get_stat_in_generation(self, path):
tracing.trace('path=%r', path)
metadata = self.get_metadata_in_generation(path)