Skip to content

Commit

Permalink
分拆到单独分支
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric X committed Aug 7, 2022
1 parent c06481a commit 14f3edf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 41 deletions.
23 changes: 14 additions & 9 deletions get-started/_common/intro/_components_capabilities.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
## Component capabilities
<!-- ## Component capabilities -->
## 组件功能

Components obtain privileges to access various parts of the wider system
<!-- Components obtain privileges to access various parts of the wider system
through **capabilities**. Each component can declare new capabilities that
they offer to the system and capabilities provided by other components
(or the framework) that they require to function.
(or the framework) that they require to function. -->
组件通过**功能**获得访问更大系统的各个部分的权限。每个组件都可以声明它能提供给系统的新功能以及所需的由其他组件(或框架)提供的功能。

As you just saw, `runner` is an example of a capability declaring the runtime
<!-- As you just saw, `runner` is an example of a capability declaring the runtime
used by the component. Other examples of common capability types are
`directory` to access filesystem resources and `protocol` for communicating
with other components.
with other components. -->
如您所见,`runner` 是一个声明组件运行时所需功能的例子。其它通用功能类型的例子是访问文件系统资源的 `directory` 和与其它组件通信的 `protocol`(协议)。

Developers declare the capability types required by the component using the
<!-- Developers declare the capability types required by the component using the
component manifest. Below is an example of a component manifest requesting
two capabilities: read access to an `example-data` directory and a service
described by the `fuchsia.example.Foo` FIDL protocol.
described by the `fuchsia.example.Foo` FIDL protocol. -->
开发者在组件清单声明组件所需要的功能类型。以下是一个需要两个功能的组件清单示例:对 `example-data` 目录的读权限和以 FIDL 协议描述的名为 `fuchsia.example.Foo` 的服务。

```json5
use: [
Expand All @@ -28,6 +32,7 @@ use: [
]
```

Component manager uses the capability declarations to populate each component's
<!-- Component manager uses the capability declarations to populate each component's
namespace with the necessary directory handles. For this example, the component
would receive `/example/data` and `/svc/fuchsia.example.Foo` in their namespace.
would receive `/example/data` and `/svc/fuchsia.example.Foo` in their namespace. -->
组件管理器依据功能声明将各个组件所需的目录处理句柄填入各自的命名空间。对于本例子而言,组件将在其命名空间中接收 `/example/data``/svc/fuchsia.example.Foo`
50 changes: 18 additions & 32 deletions get-started/_common/intro/_components_organization.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
<!-- ## 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. -->
* **静态创建** 父组件在自身组件声明中声明子组件。
* **动态创建** 父组件在运行时通过 `fuchsia.component.Realm` 协议将子组件添加到组件集中。
runtime using the `fuchsia.component.Realm` protocol.

<!-- 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` 关键字暴露其功能给领地外部:
`expose` keyword:

```json5
expose: [
Expand All @@ -42,9 +33,8 @@ 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: -->
一旦功能暴露到领地之中,父组件可以将其分享给领地内的其它组件。这可以通过使用 `offer` 关键字达成:
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:

```json5
offer: [
Expand All @@ -55,25 +45,21 @@ 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. -->
[组件管理器][glossary.component-manager]负责解析与功能提供者之间的访问请求(如目录或协议)。
这就是**功能路由**。组件管理器只能解析那些在领地内**公开****提供**的功能。
**offered** within the same realm.

<!-- ![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">组件文档</a>中找到更多技术细节。
<a href="/concepts/components/v2/introduction.md">component documentation</a>.
</aside>

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

0 comments on commit 14f3edf

Please sign in to comment.