| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.pkg; |
| |
| using fuchsia.io; |
| using zx; |
| |
| /// This resolves font packages from a registry. |
| /// |
| /// This is intended to be implemented by package resolver components, and used |
| /// exclusively by fuchsia.fonts.Provider. |
| /// |
| /// DEPRECATED. This is an interim solution, and will be revisited when Component Framework v2 |
| /// becomes available and allows non-component packages and easier directory routing. |
| @deprecated("For use only in Font Provider. To be replaced after Components v2 launch.") |
| @discoverable |
| protocol FontResolver { |
| /// Populates or updates the cache of a font package, fetching it if it is not present on the |
| /// local system. |
| /// |
| /// + request `package_url` the package URL of a font package. |
| /// + request `directory_request` a request for a directory that will be resolved when the |
| /// package has been successfully cached. The directory should contain a single file, |
| /// corresponding to the asset filename. The client should retain the directory handle |
| /// for as long as needed to prevent the package from being evicted from cache. |
| /// * error a zx_status value indicating failure. One of the following: |
| /// * `ZX_ERR_ACCESS_DENIED` if the resolver does not have permission to fetch a |
| /// package blob. |
| /// * `ZX_ERR_IO` if there is some other unspecified error during I/O. |
| /// * `ZX_ERR_NOT_FOUND` if the font package or a package blob does not exist, or is |
| /// not known to be a font package. |
| /// * `ZX_ERR_NO_SPACE` if there is no space available to store the package. |
| /// * `ZX_ERR_UNAVAILABLE` if the resolver is currently unable to fetch a package blob. |
| Resolve(resource struct { |
| package_url string; |
| directory_request server_end:fuchsia.io.Directory; |
| }) -> (struct {}) error zx.status; |
| }; |