Commit 6dc72114 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

pithos: Fix access object version data/metadata

parent b22db69a
......@@ -779,7 +779,8 @@ class Node(DBWorker):
r.close()
return (tuple(row.values()) for row in rproxy)
def version_get_properties(self, serial, keys=(), propnames=_propnames):
def version_get_properties(self, serial, keys=(), propnames=_propnames,
node=None):
"""Return a sequence of values for the properties of
the version specified by serial and the keys, in the order given.
If keys is empty, return all properties in the order
......@@ -791,6 +792,8 @@ class Node(DBWorker):
v.c.size, v.c.type, v.c.source,
v.c.mtime, v.c.muser, v.c.uuid,
v.c.checksum, v.c.cluster], v.c.serial == serial)
if node is not None:
s = s.where(v.c.node == node)
rp = self.conn.execute(s)
r = rp.fetchone()
rp.close()
......
......@@ -623,7 +623,8 @@ class Node(DBWorker):
self.execute(q, args)
return self.fetchall()
def version_get_properties(self, serial, keys=(), propnames=_propnames):
def version_get_properties(self, serial, keys=(), propnames=_propnames,
node=None):
"""Return a sequence of values for the properties of
the version specified by serial and the keys, in the order given.
If keys is empty, return all properties in the order
......@@ -632,8 +633,12 @@ class Node(DBWorker):
q = ("select serial, node, hash, size, type, source, mtime, muser, uuid, checksum, cluster "
"from versions "
"where serial = ?")
self.execute(q, (serial,))
"where serial = ? ")
args = [serial]
if node is not None:
q += ("and node = ?")
args += [node]
self.execute(q, args)
r = self.fetchone()
if r is None:
return r
......
......@@ -1300,7 +1300,7 @@ class ModularBackend(BaseBackend):
version = int(version)
except ValueError:
raise VersionNotExists('Version does not exist')
props = self.node.version_get_properties(version)
props = self.node.version_get_properties(version, node=node)
if props is None or props[self.CLUSTER] == CLUSTER_DELETED:
raise VersionNotExists('Version does not exist')
return props
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment