mediachain / oldchain-client

[DEPRECATED] old mediachain client experiments
MIT License
4 stars 2 forks source link

inject translator version hash in get_translator #75

Closed yusefnapora closed 8 years ago

yusefnapora commented 8 years ago

this adds a versioned_id() class method that checks the __version__ property of a translator and returns e.g. getty@QmWsU4MrF28SrYz5Kwdd2i1d1fUozakdUUuHaSUHjNrBcT. The version is set in get_translator, and the versioned_id is used by the writer, so you get e.g.:

  "meta": {
    "translator": "getty@QmWsU4MrF28SrYz5Kwdd2i1d1fUozakdUUuHaSUHjNrBcT",
    "raw_ref": {
      "@link": "QmNpndJVVS79PyavnLbpaD9BgLBF5akv9NQR7PPjXBKo6D"
    },
   "..."
}

It occurs to me that it would be cool if we update the write to output resolvable links to the translators, e.g.

  "meta": {
    "translator": {
      "id": "getty",
      "version": "QmWsU4MrF28SrYz5Kwdd2i1d1fUozakdUUuHaSUHjNrBcT",
      "link": { "@link": "QmWsU4MrF28SrYz5Kwdd2i1d1fUozakdUUuHaSUHjNrBcT" }
    },
    "..."
}

or something. But happy to defer that for now.

parkan commented 8 years ago

I think no need to duplicate the value, link can be version?

yusefnapora commented 8 years ago

yeah, good point about the duplication.