Revision d2fc71c9
b/snf-pithos-backend/pithos/backends/lib/sqlalchemy/node.py | ||
---|---|---|
779 | 779 |
r.close() |
780 | 780 |
return (tuple(row.values()) for row in rproxy) |
781 | 781 |
|
782 |
def version_get_properties(self, serial, keys=(), propnames=_propnames): |
|
782 |
def version_get_properties(self, serial, keys=(), propnames=_propnames, |
|
783 |
node=None): |
|
783 | 784 |
"""Return a sequence of values for the properties of |
784 | 785 |
the version specified by serial and the keys, in the order given. |
785 | 786 |
If keys is empty, return all properties in the order |
... | ... | |
791 | 792 |
v.c.size, v.c.type, v.c.source, |
792 | 793 |
v.c.mtime, v.c.muser, v.c.uuid, |
793 | 794 |
v.c.checksum, v.c.cluster], v.c.serial == serial) |
795 |
if node is not None: |
|
796 |
s = s.where(v.c.node == node) |
|
794 | 797 |
rp = self.conn.execute(s) |
795 | 798 |
r = rp.fetchone() |
796 | 799 |
rp.close() |
b/snf-pithos-backend/pithos/backends/lib/sqlite/node.py | ||
---|---|---|
623 | 623 |
self.execute(q, args) |
624 | 624 |
return self.fetchall() |
625 | 625 |
|
626 |
def version_get_properties(self, serial, keys=(), propnames=_propnames): |
|
626 |
def version_get_properties(self, serial, keys=(), propnames=_propnames, |
|
627 |
node=None): |
|
627 | 628 |
"""Return a sequence of values for the properties of |
628 | 629 |
the version specified by serial and the keys, in the order given. |
629 | 630 |
If keys is empty, return all properties in the order |
... | ... | |
632 | 633 |
|
633 | 634 |
q = ("select serial, node, hash, size, type, source, mtime, muser, uuid, checksum, cluster " |
634 | 635 |
"from versions " |
635 |
"where serial = ?") |
|
636 |
self.execute(q, (serial,)) |
|
636 |
"where serial = ? ") |
|
637 |
args = [serial] |
|
638 |
if node is not None: |
|
639 |
q += ("and node = ?") |
|
640 |
args += [node] |
|
641 |
self.execute(q, args) |
|
637 | 642 |
r = self.fetchone() |
638 | 643 |
if r is None: |
639 | 644 |
return r |
b/snf-pithos-backend/pithos/backends/modular.py | ||
---|---|---|
1300 | 1300 |
version = int(version) |
1301 | 1301 |
except ValueError: |
1302 | 1302 |
raise VersionNotExists('Version does not exist') |
1303 |
props = self.node.version_get_properties(version) |
|
1303 |
props = self.node.version_get_properties(version, node=node)
|
|
1304 | 1304 |
if props is None or props[self.CLUSTER] == CLUSTER_DELETED: |
1305 | 1305 |
raise VersionNotExists('Version does not exist') |
1306 | 1306 |
return props |
Also available in: Unified diff