<<../_v2_banner.md>>
The component topology is a general concept that expresses the set of relationships between component instances.
These relationships are the following:
A component instance is a distinct embodiment of a component running in its own sandbox that is isolated from other component instances (including other instances of the same component).
You can often use the terms component and component instance interchangeably when the context is clear. For example, it would be more precise to talk about “starting a component instance” rather than “starting a component” but you can easily infer that “starting a component” requires an instance of that component to be created first so that the instance can be started.
While components are identified by a URL, component instances are identified by a moniker. Different instances of the same component thus share the same URL but have different monikers.
The component instance tree expresses how components are assembled together to make more complex components.
Using hierarchical composition, a parent component creates instances of other components, which are known as its children. The child instances belong to the parent and depend on the parent to provide them with the capabilities that they need to run. Meanwhile, the parent gains access to the capabilities exposed by its children through capability routing.
Children can be created in two ways:
The component topology represents the structure of these parent-child relationships as a [component instance tree][glossary.component-instance-tree].
A moniker identifies a specific component instance in the component tree using a topological path. There are three types of monikers, depending on how the moniker is being used and kind of relationship it's describing: absolute, relative, and child.
See the monikers documentation for more information.
A realm is a subtree of the component instance tree. Each realm is rooted by a component instance and includes all of that instance's children and their descendants. Put another way, realms express hierarchical composition of component instances.
Realms are important encapsulation boundaries in the component topology. The root of each realm receives certain privileges to influence the behavior of components, such as:
See the realms documentation for more information.
A component acts as an encapsulation boundary. Capabilities cannot escape a component's realm unless explicitly allowed to by an expose declaration.
Children remain forever dependent upon their parent; they cannot be reparented and they cannot outlive their parent. When a parent is destroyed so are all of its children.
This model resembles composition{:.external} in object-oriented programming languages.
See the realms documentation for more information.
The capability routing graph describes how components gain access to use capabilities exposed and offered by other components in the component instance tree. For a capability provided by a component instance to be usable by a consumer component instance, there must be capability routing path between them. Such capability routes are determined by use
, offer
, and expose
declarations in component declarations.
See the capability routing documentation for more information.