Skip to content

Study change of Metadata format #97

@staverne

Description

@staverne

We've started to refactor Metadata and MetadataProperty, in a previous version, to avoid the use of complex ical format for metadata files.
We would like to use a more efficient parser (in C ?):

  • for better performances
  • to simplify maintainability of code
  • to use more standard format
    One of the solution would be to use GLib.KeyFile() format
from gi.repository import GLib

N = 20000

metadata_str = """
[default]
String=mystr
Bool=true
Int=300
Double=0.0
"""

for i in range(N):
    a = GLib.KeyFile()
    a.load_from_data(metadata_str, len(metadata_str), GLib.KeyFileFlags.NONE)
    a.get_value('default', 'String')
    a.set_string_list('default', 'multiple', ['1', '2', '3'])
    a.set_locale_string('default', 'title', 'fr', u'Hello')
    a.set_locale_string('default', 'title', 'en', u'Hello')
    a.save_to_file('/tmp/%s.metadata' % i)
    a.to_data()

for i in range(N):
    a = GLib.KeyFile()
    a.load_from_file('/tmp/%s.metadata' % i, GLib.KeyFileFlags.NONE)
    a.to_data()

Some remarks:

  • We should benchmark advantages in term of performances of this change
  • Maybe it would be better to avoid use of Property in Metadata to simplify API (there's bugs, for example to compare 2 Properties before a resource.set_value('name', Property).
  • We would like to add a version to Metadata 1, 2,.... to be compatible with old versions, and migrate gradually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions