xiekeyang / oci-discovery

Contain the OCI Ref-engine Discovery specification and related specifications as an extention to the image specification.
Other
2 stars 1 forks source link

*-template: Cover relative references #21

Closed wking closed 7 years ago

wking commented 7 years ago

As discussed here and here. This allows for entries that can move with the base content. For example, you could have a ref-engines object at file:///srv/app/ref-engines.json with content like:

{
  "refEngines": [
    {
      "protocol": "oci-index-template-v1",
      "uri": "index.json"
    }
  ],
  "casEngines": [
    {
      "protocol": "oci-cas-template-v1",
      "uri": "blobs/{algorithm}/{encoded}"
    }
  ]
}

that now expands to file:///srv/app/index.json, file:///srv/app/blobs/sha256/e97…, etc. And those references would still expand correctly if you moved the whole /srv/app directory to /srv/new-app and referenced the ref-engines object from file:///srv/new-app/ref-engines.json.

wking commented 7 years ago

The Go implementation of RFC 3986's relative resolution is ResolveReference.

xiekeyang commented 7 years ago

LGTM