Skip to content

oci_discovery/fetch_json: Return the final URI along with the JSON#25

Merged
xiekeyang merged 1 commit intoxiekeyang:masterfrom
wking:base-uri-from-fetch_json
Sep 21, 2017
Merged

oci_discovery/fetch_json: Return the final URI along with the JSON#25
xiekeyang merged 1 commit intoxiekeyang:masterfrom
wking:base-uri-from-fetch_json

Conversation

@wking
Copy link
Copy Markdown
Contributor

@wking wking commented Sep 20, 2017

From here:

Note that if the retrieval was the result of a redirected request, the last URI used (i.e., the URI that resulted in the actual retrieval of the representation) is the base URI.

This fills in remaining Python functionality left off from #21. Ref-engine discovery and ref-engine APIs now also return dicts that include a uri key representing this URI, which allows their consumers to also perform reference resolution. For example, tools consuming the Merkle roots may need the URI from which those roots were extracted in order to resolve a CAS-engine URI reference.

From [1]:

  Note that if the retrieval was the result of a redirected request,
  the last URI used (i.e., the URI that resulted in the actual
  retrieval of the representation) is the base URI.

This fills in remaining Python functionality left off from 5b75a01
(*-template: Cover relative references, 2017-09-18, xiekeyang#21).  Ref-engine
discovery and ref-engine APIs now also return dicts that include a
'uri' key representing this URI, which allows their consumers to also
perform reference resolution.  For example, tools consuming the Merkle
roots may need the URI from which those roots were extracted in order
to resolve a CAS-engine URI reference.

[1]: https://tools.ietf.org/html/rfc3986#section-5.1.3
"os": "linux"
},
"size": 799
"uri": "http://example.com/oci-index/app"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here needn't protocol entry? Maybe both uri and protocol are all necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here needn't protocol entry?

This isn't an engine config, it's the location from which this root was extracted. It would be passed into a subsequent CAS-engine initialization as base, although in this case

.["example.com/app#1.0"].roots[0].root.casEngines[0].uri is a full URI (not a reference), so the base URI won't be needed. It helps with things like:

{
  "example.com/app#1.0": {
    "roots": [
      {
        "root": {
          ...,
          "casEngines": [
            {
              "protocol": "oci-cas-template-v1",
              "uri": "../cas/{algorithm}/{encoded:2}/{encoded}"
            }
          ]
        },
        "uri": "http://example.com/oci-index/app"
      }
    ]
  }
}

So I don't think we need protocol here; just the base URI(s) for resolving any references in the returned root(s).

@xiekeyang
Copy link
Copy Markdown
Owner

LGTM

@xiekeyang xiekeyang merged commit 7eb2a5c into xiekeyang:master Sep 21, 2017
@wking wking deleted the base-uri-from-fetch_json branch September 21, 2017 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants