Revision 4d15c94e snf-pithos-backend/pithos/backends/lib/sqlite/node.py

b/snf-pithos-backend/pithos/backends/lib/sqlite/node.py
201 201
            return r[0]
202 202
        return None
203 203
    
204
    def node_lookup_bulk(self, paths):
205
    	"""Lookup the current nodes for the given paths.
206
           Return () if the path is not found.
207
        """
208
        
209
        placeholders = ','.join('?' for path in paths)
210
        q = "select path, node from nodes where path in (%s)" % placeholders
211
        self.execute(q, paths)
212
        return self.fetchall()
213
    
204 214
    def node_get_properties(self, node):
205 215
        """Return the node's (parent, path).
206 216
           Return None if the node is not found.
......
500 510
        if props is not None:
501 511
            return props
502 512
        return None
513

  
514
    def version_lookup_bulk(self, nodes, before=inf, cluster=0):
515
        """Lookup the current versions of the given nodes.
516
           Return a list with their properties:
517
           (serial, node, hash, size, type, source, mtime, muser, uuid, checksum, cluster).
518
        """
519
        
520
        placeholders = ','.join('?' for node in nodes)
521
        q = ("select serial, node, hash, size, type, source, mtime, muser, uuid, checksum, cluster "
522
             "from versions "
523
             "where serial in (select max(serial) "
524
                             "from versions "
525
                             "where node in (%s) and mtime < ? group by node) "
526
             "and cluster = ?" % placeholders)
527
        args = nodes
528
        args.extend((before, cluster))
529
        self.execute(q, args)
530
        return self.fetchall()
503 531
    
504 532
    def version_get_properties(self, serial, keys=(), propnames=_propnames):
505 533
        """Return a sequence of values for the properties of
......
656 684
        
657 685
        subqlist = []
658 686
        args = []
659
        print pathq
660 687
        for path, match in pathq:
661 688
            if match == MATCH_PREFIX:
662 689
                subqlist.append("n.path like ? escape '\\'")

Also available in: Unified diff