The previous recursive implementation is flawed in a few ways:
It queries the entire registry for each repo, which is horribly inefficient.
It misses cases where the repo FQDN might not exactly match the given root (e.g. trailing slashes).
It lacks decision logging, making it incredibly difficult to debug.
The New and Improved Implementation :tm: removes the need for recursion:
Since the Docker v2 API requires we list the entire catalog anyway, the new implementation parses the repos and extracts and de-dupes the registry components. Since it is impossible for a catalog entry to point to something outside of its registry, this is same to pre-compute.
Each registry is queried exactly once, and compared against the supplied root prefixes. If the catalog entry begins with the root, it is considered a valid target. This means a repo of "gcr.io/foo" lists all of gcr.io and then does client-side selection any catalog entries that begin with "gcr.io/foo".
Every action and decision is logged at the debug level, so users and maintainers can more easily identify potential issues.
The previous recursive implementation is flawed in a few ways:
It queries the entire registry for each repo, which is horribly inefficient.
It misses cases where the repo FQDN might not exactly match the given root (e.g. trailing slashes).
It lacks decision logging, making it incredibly difficult to debug.
The New and Improved Implementation :tm: removes the need for recursion:
Since the Docker v2 API requires we list the entire catalog anyway, the new implementation parses the repos and extracts and de-dupes the registry components. Since it is impossible for a catalog entry to point to something outside of its registry, this is same to pre-compute.
Each registry is queried exactly once, and compared against the supplied root prefixes. If the catalog entry begins with the root, it is considered a valid target. This means a repo of "gcr.io/foo" lists all of gcr.io and then does client-side selection any catalog entries that begin with "gcr.io/foo".
Every action and decision is logged at the debug level, so users and maintainers can more easily identify potential issues.