diff --git a/docs/extrinsic-metadata-specification.rst b/docs/extrinsic-metadata-specification.rst --- a/docs/extrinsic-metadata-specification.rst +++ b/docs/extrinsic-metadata-specification.rst @@ -182,3 +182,49 @@ by the storage. Unifying these various formats into a common language is outside the scope of this specification. + +Artifact metadata +^^^^^^^^^^^^^^^^^ + +In addition to origin metadata, the storage database stores metadata on +all software artifacts supported by the data model. + +This works similarly to origin metadata, with one major difference: +as extrinsic metadata is given on an artifact within a given context, +this context is stored along the metadata itself. + +For example, two origins may develop the same file independently; +so authorship information on that file is only valid within an +``origin`` context. + +Therefore, for each artifact type ````, there are two endpoints +to manipulate metadata associated with artifacts of that type: + +* Adding metadata:: + + _metadata_add(id, context, discovery_date, + authority, fetcher, + format, metadata) + + +* Getting all metadata:: + + _metadata_get(id, context, + authority, + after, limit) + + +definited similarly to ``origin_metadata_add`` and ``origin_metadata_get``, +but with an extra ``context`` (argument when adding metadata, and dictionary +key when getting them) that is a dictionary with keys +depending on the artifact type ````: + +* for ``snapshot``: ``origin`` (an URL) and ``visit`` (an integer) +* for ``release``: those above, plus ``snapshot`` (a ``sha1_git``) +* for ``revision``: all those above, plus ``release`` (a ``sha1_git``) +* for ``directory``: all those above, plus ``revision`` (a ``sha1_git``) + and ``path`` (a byte string), representing the path to this directory + from the root of the ``revision`` +* for ``content``: all those above, plus ``directory`` (a ``sha1_git``) + +All keys are optional, but should be provided whenever possible.