Skip to content

Commit

Permalink
翻译包解析器
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric X committed Aug 9, 2022
1 parent dd66001 commit a7a877d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 40 deletions.
44 changes: 17 additions & 27 deletions get-started/_common/intro/_packages_intro.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,43 @@
<!-- Fuchsia software is delivered **on demand** to the system through **packages**.
Fuchsia software is delivered **on demand** to the system through **packages**.
This is a critical component to Fuchsia's core design principles of
**security** and **updatability**. Packages can be updated independently and
delivered on demand, like a web page. This enables a vulnerability patch to be
pushed to all Fuchsia products at once without the need for individual product
coordination. -->
Fuchsia 软件通过******按需**交付到系统中。这是 Fuchsia 的**安全性****可更新性**核心设计原则的关键组成部分。包可以单独更新和按需交付,就像网页一样。这使得漏洞补丁可以一次性推送到所有的 Fuchsia 产品中,而无须针对各个产品单独协调。
coordination.

<!-- A package is not a single archive or image file, but rather a tree of **Binary
A package is not a single archive or image file, but rather a tree of **Binary
Large Objects** (BLOBs). The root of the tree is a BLOB called "meta.far" which
contains metadata for the package, including a "meta/contents" file which
contains references to the rest of the BLOBs. The BLOBs inside Fuchsia packages
are **content-addressed**, meaning they are referenced using a hash of their
contents. The content address of the meta.far itself is known as the **package
hash**. -->
包不是单一文件或镜像,而是一棵**二进制大对象**(BLOBs)树。树根是一个名为“meta.far”的 BLOB,其中包含了该包的元数据,包括一个含有对其它 BLOB 引用信息的“meta/contents”文件。Fuchsia 包中的 BLOB 是**内容寻址**的,这意味着它们是使用其内容的哈希值来引用的。meta.far 本身的内容地址被称为**包哈希**
hash**.

<aside class="key-point">
<!-- </b>Merkle Roots</b> -->
<b>哈希根</b>
<!-- <p>Content addresses are computed as the root hash of a Merkle tree. This is
</b>Merkle Roots</b>
<p>Content addresses are computed as the root hash of a Merkle tree. This is
a common technique for verifying the integrity of content in transit and on
disk. This allows Fuchsia to verify the contents of an entire package using
just the package hash!</p> -->
<p>内容地址被计算成哈希树的根哈希。这是用于验证传输过程中和磁盘上内容完整性的常用技术。这允许 Fuchsia 仅使用包哈希来验证整个包的内容!</p>
just the package hash!</p>

<!-- <p>To learn more about Merkle roots and how they are used in Fuchsia, see
<a href="/concepts/packages/merkleroot.md">Fuchsia package hash</a>.</p> -->
<p>要学习更多关于哈希根及其在 Fuchsia 中的应用,请参看<a href="/concepts/packages/merkleroot.md">Fuchsia 包哈希</a>。</p>
<p>To learn more about Merkle roots and how they are used in Fuchsia, see
<a href="/concepts/packages/merkleroot.md">Fuchsia package hash</a>.</p>
</aside>

<!-- The meta.far contains a `meta/` directory with at least the
following two items: -->
meta.far 文件包含一个至少含有如下两项内容的 `meta/` 目录:
The meta.far contains a `meta/` directory with at least the
following two items:

<!-- * `meta/package`: JSON file containing the package's identity information
* `meta/package`: JSON file containing the package's identity information
such as name and version.
* `meta/contents`: A map of the human-readable file names in a package to
their content addresses. -->
* `meta/package`: 含有包名称和版本等身份信息的 JSON 文件。
* `meta/contents`: 一份人可读文件名与其内容地址的映射。
their content addresses.

<!-- ![Diagram showing the contents of a Fuchsia package consisting of "meta.far"
metadata and a collection of content BLOBs.] -->
![图表显示了由“meta.far”元数据和内容 BLOB 集合组成的 Fuchsia 包的内容。]
![Diagram showing the contents of a Fuchsia package consisting of "meta.far"
metadata and a collection of content BLOBs.]
(/get-started/images/intro/meta-far.png){: width="544"}

<!-- If two or more packages share the same content (such as a library dependency,
If two or more packages share the same content (such as a library dependency,
or font resource), their metadata will point to the same content address for
that resource. This enables Fuchsia to optimize package distribution and
storage by avoiding the need to fetch and save a content BLOB that already
exists. -->
如果两个或多个包共享相同内容(如库依赖或字体资源),则它们的元数据将指向那些相同的内容地址。这使 Fuchsia 可以避免获取和保存已经存在的内容的 BLOB ,优化包的分发和存储。
exists.
35 changes: 22 additions & 13 deletions get-started/_common/intro/_packages_serving.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,44 @@
## Hosting and serving packages
<!-- ## Hosting and serving packages -->
## 包托管和服务

Packages are hosted in **repositories** based on
<!-- Packages are hosted in **repositories** based on
[The Update Framework](https://theupdateframework.io/){:.external} (TUF).
This framework is a specification designed to enable secure delivery of software
updates. TUF repositories secure updates through signed metadata attached to
records that are verifiable against known trusted public and private keys.
This means that **any HTTP server can serve a TUF repository** without the need
for transport-level security, **_including a developer's workstation!_**
for transport-level security, **_including a developer's workstation!_** -->
包托管在位于[更新框架](https://theupdateframework.io/){:.external} (TUF)的**仓库**中。该框架是一种规范,旨在实现软件更新的安全交付。 TUF 仓库通过附加到记录的签名元数据来保护更新,这些记录可根据已知的可信公钥和私钥进行验证。

<aside class="key-point">
Developer tools such as <code>ffx</code> host a simple HTTP server locally
serving a static tree of files formatted as a TUF repository.
<!-- Developer tools such as <code>ffx</code> host a simple HTTP server locally
serving a static tree of files formatted as a TUF repository. -->
<code>ffx</code> 等开发人员工具在本地托管一个简单的 HTTP 服务器,为格式化为 TUF 仓库的静态文件树提供服务。
</aside>

Packages within a repository are identified by a URL with the
`fuchsia-pkg` scheme:
<!-- Packages within a repository are identified by a URL with the
`fuchsia-pkg` scheme: -->
仓库中的包通过 `fuchsia-pkg` 格式的 URL 标识:

```none
fuchsia-pkg://{{ '<var>' }}repo-hostname{{ '</var>' }}/{{ '<var>' }}pkg-name{{ '</var>' }}#{{ '<var>' }}resource-path{{ '</var>' }}
```

* `repo-hostname`: Hostname of a trusted package repository, such as `fuchsia.com`.
<!-- * `repo-hostname`: Hostname of a trusted package repository, such as `fuchsia.com`.
* `pkg-name`: Unique identifier for the package in this repository.
* `resource-path`: Resource contained within the package, such as a component
manifest.
manifest. -->
* `repo-hostname`:受信任的软件包仓库的主机名,比如,`fuchsia.com`
* `pkg-name`:本仓库中包的唯一标识。
* `resource-path`:包中包含的资源,比如,组件清单。

![Diagram showing how packages are resolved from a TUF repository and cached
locally on the device.]
<!-- ![Diagram showing how packages are resolved from a TUF repository and cached
locally on the device.] -->
![如何解析 TUF 仓库中的包并在设备本地缓存的示意图]
(/get-started/images/intro/package-resolver.png){: width="751"}

Requests for software on a Fuchsia device are handled by the
<!-- Requests for software on a Fuchsia device are handled by the
**package resolver**. The package resolver determines if the system already has
the package cached locally. If not, the resolver fetches the meta.far from the
repository and updates the necessary content BLOBs.
repository and updates the necessary content BLOBs. -->
Fuchsia 设备上的软件请求由**package resolver**处理。包解析器确定系统是否已经在本地缓存了包。如果没有,解析器从存储库中获取 meta.far 并更新必要的内容 BLOB。

0 comments on commit a7a877d

Please sign in to comment.