Google is committed to advancing racial equity for Black communities. See how.

Component resolvers (Components v2)

A component resolver is a protocol-backed capability responsible for resolving a URL to a component manifest.

Component resolver capabilities are registered with an environment for a particular URL scheme (http, fuchsia-pkg, etc) and are used by the component manager on behalf of a component to resolve its children.

Registering a component resolver

Component resolvers are registered with environments to resolve a particular URL scheme. If the environment extends from a parent environment, and the same scheme is registered in both parent and child environments, the child registration takes precedence.

environments: [
    {
        name: "my-environ",
        extends: "realm",
        resolvers: [
            {
                resolver: "my-resolver",
                scheme: "my-scheme",
                from: "parent",
            }
        ],
    }

An environment must be assigned to a child in order for the registered resolver to take effect. That child’s URL, and any descendents that do not override their environment (see environment), will be resolved with the registered resolver, if the URL scheme matches.

children: [
    {
        name: "my-child",
        url: "my-scheme://myhost.com/my-path",
        environment: "#my-environ"
    },
]

Implementing a component resolver

A component resolver can be implemented by

When the component manager is asked to resolve a component URL, it finds the component resolver registered to the URL’s scheme and asks it to resolve the URL over the [`fuchsia.sys2.ComponentResolver’] FIDL protocol.

If resolution succeeds, the component resolver must return a ComponentDecl, the FIDL representation of a component manifest. If the component being resolved has an associated package, the component resolver should also return a fuchsia.io.Directory handle that points to the package directory.

Before registering a resolver with an environment, it must be created and routed to the environment.

capabilities: [
    {
        resolver: "my-resolver",
        path: "/svc/fuchsia.sys2.ComponentResolver",
    },
],
expose: [
    {
        resolver: "my-resolver",
        from: "self",
    }
]

resolver capabilities are different from protocol capabilities in that they cannot be used directly by a component. They can only be registered with an environment. See registering a component resolver.

Built-in boot resolver

The component manager provides a built-in component resolver called boot-resolver, which is registered to the fuchsia-boot scheme in component manager's built-in environment.

This resolver can be routed, and the built-in environment can be extended. See environments.