3198: Start to refactor locators_and_ranges to use for replacing ranges
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 12 Dec 2014 21:26:07 +0000 (16:26 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 12 Dec 2014 21:26:07 +0000 (16:26 -0500)
sdk/python/arvados/stream.py
services/fuse/arvados_fuse/__init__.py

index c263dd871be9d663d4aceebbfaf18f07aecd71dc..57a7a4d3d45bd3b3e4b4c6b463292684aaf4cd28 100644 (file)
@@ -16,20 +16,7 @@ BLOCKSIZE = 1
 OFFSET = 2
 SEGMENTSIZE = 3
 
-def locators_and_ranges(data_locators, range_start, range_size, debug=False):
-    '''
-    Get blocks that are covered by the range
-    data_locators: list of [locator, block_size, block_start], assumes that blocks are in order and contigous
-    range_start: start of range
-    range_size: size of range
-    returns list of [block locator, blocksize, segment offset, segment size] that satisfies the range
-    '''
-    if range_size == 0:
-        return []
-    resp = []
-    range_start = long(range_start)
-    range_size = long(range_size)
-    range_end = range_start + range_size
+def first_block(data_locators, range_start, range_size, debug=False):
     block_start = 0L
 
     # range_start/block_start is the inclusive lower bound
@@ -49,7 +36,7 @@ def locators_and_ranges(data_locators, range_start, range_size, debug=False):
     while not (range_start >= block_start and range_start < block_end):
         if lo == i:
             # must be out of range, fail
-            return []
+            return None
         if range_start > block_start:
             lo = i
         else:
@@ -60,6 +47,27 @@ def locators_and_ranges(data_locators, range_start, range_size, debug=False):
         block_start = data_locators[i][OFFSET]
         block_end = block_start + block_size
 
+    return i
+
+def locators_and_ranges(data_locators, range_start, range_size, debug=False):
+    '''
+    Get blocks that are covered by the range
+    data_locators: list of [locator, block_size, block_start], assumes that blocks are in order and contigous
+    range_start: start of range
+    range_size: size of range
+    returns list of [block locator, blocksize, segment offset, segment size] that satisfies the range
+    '''
+    if range_size == 0:
+        return []
+    resp = []
+    range_start = long(range_start)
+    range_size = long(range_size)
+    range_end = range_start + range_size
+
+    i = first_block(data_locators, range_start, range_size, debug)
+    if i is None:
+        return []
+
     while i < len(data_locators):
         locator, block_size, block_start = data_locators[i]
         block_end = block_start + block_size
index 80ad6b334392e0cb4c5cfda414acf7d84d880cda..fce0576d6c9c74b869809e290d6c987b81c860b4 100644 (file)
@@ -582,11 +582,6 @@ class ProjectDirectory(Directory):
 
             contents = arvados.util.list_all(self.api.groups().contents,
                                              self.num_retries, uuid=self.uuid)
-            # Name links will be obsolete soon, take this out when there are no more pre-#3036 in use.
-            contents += arvados.util.list_all(
-                self.api.links().list, self.num_retries,
-                filters=[['tail_uuid', '=', self.uuid],
-                         ['link_class', '=', 'name']])
 
         # end with llfuse.lock_released, re-acquire lock
 
@@ -914,5 +909,5 @@ class Operations(llfuse.Operations):
     # arv-mount.
     # The workaround is to implement it with the proper number of parameters,
     # and then everything works out.
-    def create(self, p1, p2, p3, p4, p5):
+    def create(self, inode_parent, name, mode, flags, ctx):
         raise llfuse.FUSEError(errno.EROFS)