<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Daniel,<br>
<br>
It's stored as "JSONEncodedDict" as shown below. This is a DB model
and can accept arbitrarily large and nested data structure.<br>
<br>
Hope this helps. <br>
<br>
<blockquote>class JSONEncodedDict(TypeDecorator):<br>
"""Represents an immutable structure as a json-encoded
string"""<br>
<br>
impl = Text<br>
<br>
def process_bind_param(self, value, dialect):<br>
if value is not None:<br>
value = jsonutils.dumps(value)<br>
return value<br>
<br>
def process_result_value(self, value, dialect):<br>
if value is not None:<br>
value = jsonutils.loads(value)<br>
return value<br>
</blockquote>
<br>
Regards,<br>
Nikhil<br>
<br>
<div class="moz-cite-prefix">On 5/19/15 12:19 PM, Daniel P. Berrange
wrote:<br>
</div>
<blockquote cite="mid:20150519161927.GH8535@redhat.com" type="cite">
<pre wrap="">In Nova we are attempting to model[1] the glance image metadata and
properties using the Nova object model (now oslo.versionedobjects).
The one item I'm stuck on understanding is the 'locations' field
and more specifically the 'metadata' element in each location
entry
In the file glance/api/v2/images.py I can see this description
of the data format:
'locations': {
'type': 'array',
'items': {
'type': 'object',
'properties': {
'url': {
'type': 'string',
'maxLength': 255,
},
'metadata': {
'type': 'object',
},
},
'required': ['url', 'metadata'],
},
'description': _('A set of URLs to access the image file kept in '
'external store'),
As you can see here, 'metadata' is just said to be of type 'object'.
Is there somewhere that actually describes what is valid contents
for this field ? Is it sufficient to assume the metadata will only
ever be a dict of strings, or can the metadata be a complex type
with arbitrarily nested data structures ?
Regards,
Daniel
[1] <a class="moz-txt-link-freetext" href="https://review.openstack.org/#/c/76234/">https://review.openstack.org/#/c/76234/</a>
</pre>
</blockquote>
<br>
</body>
</html>