will appear if it exists.
""".lstrip()
- def __init__(self, parent_inode, inodes, api, num_retries):
+ def __init__(self, parent_inode, inodes, api, num_retries, by_pdh=False):
super(MagicDirectory, self).__init__(parent_inode, inodes)
self.api = api
self.num_retries = num_retries
+ self.by_pdh = by_pdh
def __setattr__(self, name, value):
super(MagicDirectory, self).__setattr__(name, value)
if k in self._entries:
return True
+ if self.by_pdh and uuid_pattern.match(k):
+ raise llfuse.FUSEError(errno.ENOENT)
+
if not portable_data_hash_pattern.match(k) and not uuid_pattern.match(k):
return False
mount_mode = parser.add_mutually_exclusive_group()
- mount_mode.add_argument('--all', action='store_true', help="""Mount a subdirectory for each mode: home, shared, by_tag, by_id (default).""")
+ mount_mode.add_argument('--all', action='store_true', help="""Mount a subdirectory for each mode: home, shared, by_tag, by_pdh, by_id (default).""")
mount_mode.add_argument('--home', action='store_true', help="""Mount only the user's home project.""")
mount_mode.add_argument('--shared', action='store_true', help="""Mount only list of projects shared with the user.""")
mount_mode.add_argument('--by-tag', action='store_true',
help="""Mount subdirectories listed by tag.""")
mount_mode.add_argument('--by-id', action='store_true',
help="""Mount subdirectories listed by portable data hash or uuid.""")
+ mount_mode.add_argument('--by-pdh', action='store_true',
+ help="""Mount subdirectories listed by portable data hash.""")
mount_mode.add_argument('--project', type=str, help="""Mount a specific project.""")
mount_mode.add_argument('--collection', type=str, help="""Mount only the specified collection.""")
now = time.time()
dir_class = None
dir_args = [llfuse.ROOT_INODE, operations.inodes, api, args.retries]
- if args.by_id:
+ if args.by_id or args.by_pdh:
# Set up the request handler with the 'magic directory' at the root
dir_class = MagicDirectory
elif args.by_tag:
e = operations.inodes.add_entry(Directory(llfuse.ROOT_INODE, operations.inodes))
dir_args[0] = e.inode
- e._entries['by_id'] = operations.inodes.add_entry(MagicDirectory(*dir_args))
+ e._entries['by_id'] = operations.inodes.add_entry(MagicDirectory(*dir_args, by_pdh=True if args.by_pdh else False))
+
e._entries['by_tag'] = operations.inodes.add_entry(TagsDirectory(*dir_args))
dir_args.append(usr)
llfuse.init(operations, args.mountpoint, opts)
# Subscribe to change events from API server
- operations.listen_for_events(api)
+ if not args.by_pdh:
+ operations.listen_for_events(api)
t = threading.Thread(None, lambda: llfuse.main())
t.start()