[ARVADOS] created: 048821c9c8dc25c4c78c3247fd15430cbadd6190

Git user git at public.curoverse.com
Fri Jun 30 10:28:17 EDT 2017


        at  048821c9c8dc25c4c78c3247fd15430cbadd6190 (commit)


commit 048821c9c8dc25c4c78c3247fd15430cbadd6190
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Jun 29 18:28:30 2017 -0400

    8624: New behavior for by_tag/ dir.  Allow 'cd' into any tag directory that
    exists on the server, even if it isn't returned in the listing.  Also increase
    listing limit.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curoverse.com>

diff --git a/services/fuse/arvados_fuse/fusedir.py b/services/fuse/arvados_fuse/fusedir.py
index 0361ffe..399992f 100644
--- a/services/fuse/arvados_fuse/fusedir.py
+++ b/services/fuse/arvados_fuse/fusedir.py
@@ -677,6 +677,7 @@ class TagsDirectory(Directory):
         self.num_retries = num_retries
         self._poll = True
         self._poll_time = poll_time
+        self._extra = set()
 
     def want_event_subscribe(self):
         return True
@@ -685,15 +686,30 @@ class TagsDirectory(Directory):
     def update(self):
         with llfuse.lock_released:
             tags = self.api.links().list(
-                filters=[['link_class', '=', 'tag']],
-                select=['name'], distinct=True
+                filters=[['link_class', '=', 'tag'], ["name", "!=", ""]],
+                select=['name'], distinct=True, limit=1000
                 ).execute(num_retries=self.num_retries)
         if "items" in tags:
-            self.merge(tags['items'],
+            self.merge(tags['items']+[{"name": n} for n in self._extra],
                        lambda i: i['name'],
                        lambda a, i: a.tag == i['name'],
                        lambda i: TagDirectory(self.inode, self.inodes, self.api, self.num_retries, i['name'], poll=self._poll, poll_time=self._poll_time))
 
+    def __contains__(self, k):
+        if super(TagsDirectory, self).__contains__(k):
+            return True
+        else:
+            with llfuse.lock_released:
+                tags = self.api.links().list(
+                    filters=[['link_class', '=', 'tag'], ['name', '=', k]], limit=1
+                ).execute(num_retries=self.num_retries)
+            if tags["items"]:
+                self._extra.add(k)
+                self.invalidate()
+                return True
+            else:
+                return False
+
 
 class TagDirectory(Directory):
     """A special directory that contains as subdirectories all collections visible

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list