Skip to content

Commit

Permalink
分拆到单独分支,合并原PR中修改意见
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric X committed Aug 7, 2022
1 parent 0d6ebfb commit c06481a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 48 deletions.
49 changes: 19 additions & 30 deletions get-started/_common/intro/_components_manager.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,39 @@
<!-- ## Component manager -->
## 组件管理器
## Component manager

<!-- The heart of the component framework is the **component manager**. It is
The heart of the component framework is the **component manager**. It is
responsible for coordinating the execution of all component instances,
providing them with their capabilities, and intermediating connections between
components. -->
组件框架的核心是**组件管理器**。它负责协调所有组件实例的执行,提供相应的功能,连接各个组件。
components.

<!-- Components can be launched explicitly (from a URL, for example) or implicitly
Components can be launched explicitly (from a URL, for example) or implicitly
from a request for a particular capability. Component manager performs the
necessary resolution to determine whether to launch a new component or route
the request to an existing instance. For this routing to take place, every
component must declare any capabilities that it **provides** to the system
and any it **consumes**. -->
组件可以显示地启动(例如,通过 URL调用)或者隐式地通过响应特定功能的请求而启动。组件管理器采取必要的步骤以决定是启动一个新组件还是将请求路由到现有实例。为实现这种路由功能,组件必须先声明它能**提供**给系统和它需要**使用**的功能。
and any it **consumes**.


<aside class="key-point">
<!-- <b>Does each component run in its own process?</b> -->
<b>每个组件是否运行在各自单独的进程中?</b>
<!-- <p>Zircon defines the common kernel objects for runnable code, such as
<b>Does each component run in its own process?</b>
<p>Zircon defines the common kernel objects for runnable code, such as
processes. However, component instances do not always correlate directly
with a single process. Often the policy for how these processes are used
is defined by the runner. For example, the
<a href="/concepts/components/v2/elf_runner.md">ELF runner</a> launches
each component into a new job with a process running the executable code.</p> -->
<p>Zircon 给可执行代码定义了通用内核对象,例如,进程。然而,组件实例并不总是与单一进程直接相关。通常,如何使用进程的策略是由运行器定义的。例如,<a href="/concepts/components/v2/elf_runner.md">ELF 运行器</a>会在一个全新的任务中启动各个组件,该任务包含一个进程以运行可执行代码。</p>

<!-- <p>For more examples, see -->
<p>更多实例请参看
<!-- <a href="/concepts/components/v2/components_vs_processes.md">components
vs. processes</a>.</p> -->
<a href="/concepts/components/v2/components_vs_processes.md">组件与进程</a>。</p>
each component into a new job with a process running the executable code.</p>

<p>For more examples, see
<a href="/concepts/components/v2/components_vs_processes.md">components
vs. processes</a>.</p>
</aside>

<!-- Component manager parses each component's **declaration** to determine how to
Component manager parses each component's **declaration** to determine how to
run the component and supply the necessary capabilities. Components are
typically declared to the system through a **component manifest** file within
the component's package. -->
组件管理器解析每个组件的**声明**以决定如何运行组件并提供必要的功能。组件通常通过组件包中包含的**组件清单**
文件向系统声明自己。
the component's package.

<!-- Below is a simple example of a component manifest that describes an ELF
executable with some additional command arguments: -->
以下是一个组件清单的简单例子,它描述了一个包含一些附加命令参数的 ELF 可执行程序:
Below is a simple example of a component manifest that describes an ELF
executable with some additional command arguments:

```json5
program: {
Expand All @@ -52,8 +43,6 @@ program: {
},
```

<!-- Notice the runtime declaration telling the component manager that this
Notice the runtime declaration telling the component manager that this
component requires the [ELF runner](/concepts/components/v2/elf_runner.md).
**_This is an example of a capability!_** -->
留意这个运行时声明,它告诉组件管理器这个组件需要[ELF 运行器](/concepts/components/v2/elf_runner.md)
**_这是一个功能示例!_**
**_This is an example of a capability!_**
50 changes: 32 additions & 18 deletions get-started/_common/intro/_components_organization.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
## Component organization
<!-- ## Component organization -->
## 组件架构

All components in the system are composed into a single rooted
<!-- All components in the system are composed into a single rooted
**component instance tree**. This tree structure governs several important
aspects of component behavior.
aspects of component behavior. -->
系统中所有组件组成一棵单根**组件实例树**。这棵树结构控制着组件行为的几个重要方面。

![Tree diagram illustrating how component instances are organized. These parent
<!-- ![Tree diagram illustrating how component instances are organized. These parent
and child relationships govern several aspects of component behavior.]
(/get-started/images/intro/component-organization.png){: width="712"} -->
![树图展示了组件实例是如何组织的。这种父子结构控制组件行为的几个方面。]
(/get-started/images/intro/component-organization.png){: width="712"}

Parent components in the tree are responsible for creating instances of
<!-- Parent components in the tree are responsible for creating instances of
other components as their children and providing them with the necessary
capabilities. At the same time, child components can expose capabilities back
to the parent. Child components can be created one of two ways:
to the parent. Child components can be created one of two ways: -->
树中的父组件负责其子组件的创建并提供必要功能。与此同时,子组件向父组件公开功能。子组件可通过如下方式之一创建:

* **Statically**: The parent declares the existence of the child in its own
<!-- * **Statically**: The parent declares the existence of the child in its own
component declaration.
* **Dynamically**: The parent adds the child to a component collection at
runtime using the `fuchsia.component.Realm` protocol.
runtime using the `fuchsia.component.Realm` protocol. -->
* **静态创建** 父组件在自身组件声明中声明子组件。
* **动态创建** 父组件在运行时通过 `fuchsia.component.Realm` 协议将子组件添加到组件集中。

Any parent component and all its children form a group within the tree called
<!-- Any parent component and all its children form a group within the tree called
a **realm**. Realms enable a parent to control which capabilities flow into
and out of its sub-tree of components, creating a capability boundary.
Components decide whether to export capabilities outside their realm using the
`expose` keyword:
`expose` keyword: -->
任何一个父组件和它所有子组件在树中形成一个称之为**领地**的组,领地使父组件可以控制哪个功能流可以进出组件子树,
以此建立一个功能边界。组件自行决定是否通过 `expose` 关键字暴露其功能给领地外部:

```json5
expose: [
Expand All @@ -33,8 +42,9 @@ expose: [
],
```

Once a capability is exposed to the realm, the parent can share it with other
components within the same realm. This is done using the `offer` keyword:
<!-- Once a capability is exposed to the realm, the parent can share it with other
components within the same realm. This is done using the `offer` keyword: -->
一旦功能暴露到领地之中,父组件可以将其分享给领地内的其它组件。这可以通过使用 `offer` 关键字达成:

```json5
offer: [
Expand All @@ -45,21 +55,25 @@ offer: [
],
```

[Component manager][glossary.component-manager] is responsible for resolving
<!-- [Component manager][glossary.component-manager] is responsible for resolving
requests to access a capability (such as a directory or protocol) with the
component providing that capability. This is known as **capability routing**.
Component Manager can only resolve capabilities that are **exposed** and
**offered** within the same realm.
**offered** within the same realm. -->
[组件管理器][glossary.component-manager]负责解析与功能提供者之间的访问请求(如目录或协议)。
这就是**功能路由**。组件管理器只能解析那些在领地内**公开****提供**的功能。

![Diagram showing how components share capabilities through
<!-- ![Diagram showing how components share capabilities through
"capability routing," which describes how resources are made available within
a particular realm.]
a particular realm.] -->
![组件如何通过“功能路由”共享功能的图示,“功能路由”描述了资源如何在特定领地内变得可用。]
(/get-started/images/intro/capability-routing.png){: width="614"}

<aside class="key-point">
You will explore more about capabilities and building components later on.
<!-- You will explore more about capabilities and building components later on.
You can also find more of the technical details in the
<a href="/concepts/components/v2/introduction.md">component documentation</a>.
<a href="/concepts/components/v2/introduction.md">component documentation</a>. -->
稍后您可能想探索更多有关功能和如何构建组件的信息。您也可以在<a href="/concepts/components/v2/introduction.md">组件文档</a>中找到更多技术细节。
</aside>

[glossary.component-manager]: /glossary/README.md#component-manager

0 comments on commit c06481a

Please sign in to comment.