fuchsia.component

Added: 7

PROTOCOLS

Binder

Defined in fuchsia.component/binder.fidl

A framework-provided protocol that allows components that use it to bind to the component that exposes it. The act of connecting to this protocol will trigger the bind. Thus, this protocol contains no methods. For more details on binding, see https://fuchsia.dev/fuchsia-src/concepts/components/v2/lifecycle#binding.

When a component connects to protocol, the component exposing this capability will be started if it's not already running. Upon a failure to start, the component framework will close the server end of the channel with a zx.Status epitaph.

ChildIterator

Defined in fuchsia.component/realm.fidl

A protocol to iterate over the list of children in a realm.

Next

Advance the iterator and return the next batch of children.

Returns a vector of ChildRef. Returns an empty vector when there are no more children.

Request

<EMPTY>

Response

NameType
childrenvector<fuchsia.component.decl/ChildRef>:128

Controller

Defined in fuchsia.component/controller.fidl

A protocol used to operate on a component.

One may get access to a Controller when creating a component with the Realm.CreateChild method. You may also obtain a Controller for an existing child component with the Realm.OpenController method.

Added: 14

Destroy

Destroys this component. When this method returns, either:

  • Ok was returned, indicating destruction has begun.
  • An error was returned, and destruction will not be attempted.

If Ok was returned, destruction will proceed in the background, but it hasn't necessarily completed yet. When it completes, the framework will close this [Controller] channel.

Errors:

  • ACCESS_DENIED: Destruction of this component is not allowed. Currently, this can happen if the component is a static child of its parent.
Added: HEAD

Request

<EMPTY>

Response

NameType
payloadController_Destroy_Result

GetExposedDictionary

Returns the dictionary containing the component's exposed capabilities.

Added: HEAD

Request

<EMPTY>

Response

NameType
payloadController_GetExposedDictionary_Result

IsStarted

Returns true if this instance is currently running.

Request

<EMPTY>

Response

NameType
payloadController_IsStarted_Result

Start

Start the component, optionally providing additional handles to be given to the component. Returns INSTANCE_ALREADY_RUNNING if the instance is currently running.

Request

NameType
argsStartChildArgs
execution_controllerserver_end:ExecutionController

Response

NameType
payloadController_Start_Result

EventStream

Defined in fuchsia.component/events.fidl

Listener for events on the component hierarchy. Can't be used outside of the platform.

Added: 11

GetNext

Request

<EMPTY>

Response

NameType
eventsvector<Event>

WaitForReady

Returns immediately. Used to indicate that the FIDL connection completed. This is needed for non-static streams to verify that subscribe has completed before components are started.

Request

<EMPTY>

Response

<EMPTY>

ExecutionController

Defined in fuchsia.component/controller.fidl

Added: 14

OnStop

When the child is stopped due to Stop being called, the child exiting on its own, or for any other reason, OnStop is called and then this channel is closed.

Response

NameType
stopped_payloadStoppedPayload

Stop

Initiates a stop action on this component. Once complete, OnStop will be called with the stopped payload and this channel is closed.

Note that a component may stop running on its own at any time, so it is possible for OnStop to be received before Stop is called.

Request

<EMPTY>

Introspector

Defined in fuchsia.component/introspector.fidl

A protocol used by a component instance to obtain information about components in its own realm.

This protocol only supports getting the moniker at the moment but could expand to other privileged information such as the URL of a component.

The component framework provides this capability to components that use fuchsia.component.Introspector from framework.

Added: HEAD

GetMoniker

Obtains the moniker relative to this realm of the component corresponding to the provided token. Runners may obtain the token via fuchsia.component.runner/ComponentStartInfo.component_instance.

Returns Error.INSTANCE_NOT_FOUND if the token is invalid, or does not correspond to a component under this realm.

Request

NameType
component_instancehandle<event>

Response

NameType
payloadIntrospector_GetMoniker_Result

Namespace

Defined in fuchsia.component/namespace.fidl

Protocol for performing namespace operations.

Added: 20

Create

Request

NameType
entriesvector<NamespaceInputEntry>

Response

NameType
payloadNamespace_Create_Result

Realm

Defined in fuchsia.component/realm.fidl

A protocol used by a component instance to manage its own realm, such as for binding to its children.

Requests to this protocol are processed in the order they are received. Clients that wish to send requests in parallel should open multiple connections.

The component framework provides this service to components that use fuchsia.component.Realm.

CreateChild

Creates a child component instance dynamically. When this function returns successfully, the instance exists, but it may not be running.

The environment of the child instance is determined by the environment of the collection. decl must not set environment.

If decl.startup == EAGER, or collection.durability == SINGLE_RUN, [CreateChild] will start the component and return once the component is started. Otherwise, [CreateChild] will return immediately after creating the component and will not start or resolve it.

Errors:

  • INVALID_ARGUMENTS: collection is not a valid reference or child is not a valid declaration.
  • COLLECTION_NOT_FOUND: collection does not exist.
  • INSTANCE_ALREADY_EXISTS: decl.name already exists in collection.
  • INSTANCE_CANNOT_RESOLVE: child's component declaration failed to resolve in a SingleRun collection.
  • NO_SPACE: Could not allocate storage for the new instance.
  • INSTANCE_DIED: This realm no longer exists.

Request

NameType
collectionfuchsia.component.decl/CollectionRef
declfuchsia.component.decl/Child
argsCreateChildArgs

Response

NameType
payloadRealm_CreateChild_Result

DestroyChild

Destroys a dynamically-created component instance. When this function returns, the instance is destroyed and has stopped running. However, cleanup of the component's resources (such as its isolated storage) may happen in the background after this function returns.

Errors:

  • INVALID_ARGUMENTS: child is not a valid reference or does not refer to a dynamic instance.
  • INSTANCE_NOT_FOUND: child does not exist.
  • COLLECTION_NOT_FOUND: collection does not exist.
  • INSTANCE_DIED: This realm no longer exists.

Request

NameType
childfuchsia.component.decl/ChildRef

Response

NameType
payloadRealm_DestroyChild_Result

GetChildOutputDictionary

Added: HEAD

Request

NameType
childfuchsia.component.decl/ChildRef

Response

NameType
payloadRealm_GetChildOutputDictionary_Result

GetResolvedInfo

Returns the set of information that was given to the component framework by this component's resolver.

Added: HEAD

Request

<EMPTY>

Response

NameType
payloadRealm_GetResolvedInfo_Result

ListChildren

Returns an iterator that lists all instances in a collection.

NOTE: The results are not guaranteed to be consistent. Instances may be created or destroyed while the iterator is live, but those changes won't be observed by the iterator after this method returns.

Errors:

  • INVALID_ARGUMENTS: collection is not a valid reference or iter does not have ZX_RIGHT_WAIT.
  • COLLECTION_NOT_FOUND: collection does not exist.
  • INSTANCE_DIED: This realm no longer exists.
  • If iter does not have standard channel rights, this function may return ACCESS_DENIED or component manager may close iter.

Request

NameType
collectionfuchsia.component.decl/CollectionRef
iterserver_end:ChildIterator

Response

NameType
payloadRealm_ListChildren_Result

OpenController

Operate on a child component. See documentation for Controller.

Errors:

  • INVALID_ARGUMENTS: child is not a valid child reference.
  • INSTANCE_NOT_FOUND: child does not exist.
  • INSTANCE_DIED: This realm no longer exists.
Added: HEAD

Request

NameType
childfuchsia.component.decl/ChildRef
controllerserver_end:Controller

Response

NameType
payloadRealm_OpenController_Result

OpenExposedDir

Opens the exposed directory of a child component instance. When this function successfully returns, exposed_dir is bound to a directory that contains the capabilities which the child exposed to its realm via ComponentDecl.exposes (specified via "expose" declarations in the component's manifest). The child component will not start as a result of this call. Instead, starting will occur iff the parent binds to one of the capabilities contained within exposed_dir.

exposed_dir is open as long as child exists.

Errors:

  • INVALID_ARGUMENTS: child is not a valid child reference.
  • INSTANCE_NOT_FOUND: child does not exist.
  • INSTANCE_CANNOT_RESOLVE: child's component declaration failed to resolve.
  • INSTANCE_DIED: This realm no longer exists.

Request

NameType
childfuchsia.component.decl/ChildRef
exposed_dirserver_end:fuchsia.io/Directory

Response

NameType
payloadRealm_OpenExposedDir_Result

STRUCTS

Controller_Destroy_Response

Defined in fuchsia.component/controller.fidl

<EMPTY>

Controller_GetExposedDictionary_Response resource

Defined in fuchsia.component/controller.fidl

FieldTypeDescriptionDefault
dictionaryfuchsia.component.sandbox/DictionaryRefNo default

Controller_IsStarted_Response resource

Defined in fuchsia.component/controller.fidl

FieldTypeDescriptionDefault
is_startedboolNo default

Controller_Start_Response

Defined in fuchsia.component/controller.fidl

<EMPTY>

Introspector_GetMoniker_Response

Defined in fuchsia.component/introspector.fidl

FieldTypeDescriptionDefault
monikerstring:4096No default

NamespaceInputEntry resource

Defined in fuchsia.component/namespace.fidl

Added: 20

FieldTypeDescriptionDefault
pathstring:4095No default
dictionaryclient_end:fuchsia.component.sandbox/DictionaryNo default

Namespace_Create_Response resource

Defined in fuchsia.component/namespace.fidl

FieldTypeDescriptionDefault
entriesvector<NamespaceEntry>No default

Realm_CreateChild_Response

Defined in fuchsia.component/realm.fidl

<EMPTY>

Realm_DestroyChild_Response

Defined in fuchsia.component/realm.fidl

<EMPTY>

Realm_GetChildOutputDictionary_Response resource

Defined in fuchsia.component/realm.fidl

FieldTypeDescriptionDefault
dictionaryfuchsia.component.sandbox/DictionaryRefNo default

Realm_GetResolvedInfo_Response resource

Defined in fuchsia.component/realm.fidl

FieldTypeDescriptionDefault
resolved_infofuchsia.component.resolution/ComponentNo default

Realm_ListChildren_Response

Defined in fuchsia.component/realm.fidl

<EMPTY>

Realm_OpenController_Response

Defined in fuchsia.component/realm.fidl

<EMPTY>

Realm_OpenExposedDir_Response

Defined in fuchsia.component/realm.fidl

<EMPTY>

ENUMS

Error flexible

Type: uint32

Defined in fuchsia.component/error.fidl

Standard error codes for component framework protocols.

NameValueDescription
1

Component manager encountered an otherwise unspecified error while performing the operation.

2

At least one argument had an invalid format.

3

The feature is not yet supported.

4

The caller did not have permission to perform the specified operation, or one of the handles provided to the call had insufficient rights.

5

The component instance was not found.

6

The component instance already exists.

7

The component instance could not be started.

8

Failed to resolve the component's declaration.

9

The component collection was not found.

10

There were insufficient resources to perform the operation.

11

The component instance died unexpectedly.

12

The requested resource does not exist.

13

Failed to unresolve the component.

14

The component instance has already been started.

Added: 14

EventType strict

Type: uint32

Defined in fuchsia.component/events.fidl

These EventTypes are used for the EventStream protocol. They are FIDL versions of the EventType enum in hooks.rs and have the same meaning.

Added: 11

NameValueDescription
1

A capability provided by this component has been requested. The event payload carries the request channel.

2

A directory exposed to the framework by a component is available.

Removed: 20
3

A component instance was discovered. This is the first stage in the lifecycle of components. Dised for dynamic children when they're created, for static children when their parent is resolved, and for the root when the component manager starts.

4

The instance is destroyed and no longer exists.

5

An instance's declaration was resolved successfully for the first time.

6

This instance has started, according to component manager. However, if this is an executable component, the runner has further work to do to launch the component.

7

An instance was stopped successfully.

8

Similar to STARTED, except the payload will carry an eventpair that the subscriber could use to defer the launch of the component. This allows, e.g., a debugger to perform some setup before any processes are created.

9

An instance was unresolved successfully.

NamespaceError flexible

Type: uint32

Defined in fuchsia.component/namespace.fidl

Error returned from methods in Namespace.

Added: 20

NameValueDescription
1

The parent of a parent shares a prefix with another namespace entry

2

Two entries have the same namespace path.

3

Failed to convert a namespace dictionary to a directory.

BAD_ENTRY

4

A namespace entry was invalid.

5

There was an error reading from one of the dictionaries.

TABLES

CapabilityRequestedPayload resource

Defined in fuchsia.component/events.fidl

Payload for CapabilityRequested events

Added: 11

OrdinalFieldTypeDescription
namename

The name of the capability.

capabilityhandle<channel>

A handle to the server end of the channel to host capability.

CreateChildArgs resource

Defined in fuchsia.component/realm.fidl

OrdinalFieldTypeDescription
numbered_handlesvector<fuchsia.process/HandleInfo>:128

The numbered handles to pass to the component instance.

If the runner for the component does not support the numbered handles it is expected to close the handles.

dynamic_offersvector<fuchsia.component.decl/Offer>:128

Dynamic offers that will target the component instance.

Including OfferDecls in this vector will cause additional capabilities to be offered to the newly created child, beyond the OfferDecls in the parent's ComponentDecl that target the collection.

Any kind of offer (e.g., protocol, directory) can be used as a dynamic offer. Any source that would be valid for a static offer is also valid for a dynamic offer. Additionally, unlike static offers, dynamic offers can use a "sibling" dynamic child component as a source by setting the source to a ChildRef that sets the collection field.

Dynamic offers always target the newly created child component. As a result, OfferDecls in dynamic_offers must not set the target field, as its value is implied.

If either the source (that is, the component named in the source field of the OfferDecl) or the target of a dynamic offer is destroyed, the offer itself is destroyed simultaneously.

In order to set this field to a non-empty value, the collection in which the child component is being created must specify ComponentDecl.allowed_offers = STATIC_AND_DYNAMIC.

controllerserver_end:Controller

The controller for this component, which may be used to influence the component's lifecycle.

Added: 14
dictionaryfuchsia.component.sandbox/DictionaryRef

A dictionary that contains extra capabilities for the component instance.

Added: HEAD

DebugStartedPayload resource

Defined in fuchsia.component/events.fidl

Payload for DebugStarted events.

Added: 11

OrdinalFieldTypeDescription
runtime_dirclient_end:fuchsia.io/Directory

The directory served by the runner to present runtime and runner-specific information about the component. The other side is sent to the runner in ComponentStartInfo. For example, it can be queried to know whether the component is an ELF component and supports the break_on_start protocol below.

break_on_starthandle<eventpair>

An eventpair that can be used by debuggers to defer the launch of the component, e.g., ELF debuggers can setup the exception channel on the job while holding the eventpair, then drop the eventpair to notify the runner that processes could be created. The other side is sent to the runner in ComponentStartInfo.

DestroyedPayload

Defined in fuchsia.component/events.fidl

Payload for Destroyed events.

Added: 11

OrdinalFieldTypeDescription

DirectoryReadyPayload resource

Defined in fuchsia.component/events.fidl

Payload for DirectoryReady events

Removed: 20 Deprecated: 19 Added: 11

OrdinalFieldTypeDescription
namename

The name of the capability.

nodeclient_end:fuchsia.io/Node

Channel to the directory capability.

DiscoveredPayload

Defined in fuchsia.component/events.fidl

Payload for Discovered events.

Added: 11

OrdinalFieldTypeDescription

Event resource

Defined in fuchsia.component/events.fidl

Contains all information about a single event

Added: 11

OrdinalFieldTypeDescription
headerEventHeader

Information about the component for which this event was generated.

payloadEventPayload

Optional payload for some event types

EventHeader

Defined in fuchsia.component/events.fidl

A head providing metadata about a target component instance.

Added: 11

OrdinalFieldTypeDescription
event_typeEventType

Event type corresponding to the event

monikerstring:4096

Relative moniker identifying the component instance. Relative to the scope of the event.

component_urlfuchsia.url/Url

URL used to resolve the component.

timestampzx/InstantBoot

Boot time when the event occurred.

Added: 25

NamespaceEntry resource

Defined in fuchsia.component/controller.fidl

A single component namespace entry, which describes a namespace mount point (path) and the directory backing it (directory). This type is usually composed inside a vector. See ComponentStartInfo.ns for more details.

Added: 14

OrdinalFieldTypeDescription
pathstring:4095

The mount point for the directory, including a leading slash. For example: "/pkg", "/svc", or "/config/data".

directoryclient_end:fuchsia.io/Directory

The directory mounted at the above path.

PurgedPayload

Defined in fuchsia.component/events.fidl

Payload for Purged events.

Added: 11

OrdinalFieldTypeDescription

ResolvedPayload

Defined in fuchsia.component/events.fidl

Payload for Resolved events.

Added: 11

OrdinalFieldTypeDescription

StartChildArgs resource

Defined in fuchsia.component/controller.fidl

Added: 14

OrdinalFieldTypeDescription
numbered_handlesvector<fuchsia.process/HandleInfo>:128

The numbered handles to pass to the component instance.

If the runner for the component does not support the numbered handles it is expected to close the handles.

If set, the values given here will override the handles given in CreateChildArgs.

namespace_entriesvector<NamespaceEntry>:32

The namespace generated by component manager will be extended to include any namespace entries listed here before being given to the component's runner.

If there are any conflicting entries, an error will occur when starting the component.

dictionaryfuchsia.component.sandbox/DictionaryRef

A dictionary that contains extra capabilities for the component instance.

Added: HEAD

StartedPayload

Defined in fuchsia.component/events.fidl

Payload for Started events.

Added: 11

OrdinalFieldTypeDescription

StoppedPayload

Defined in fuchsia.component/events.fidl

Payload for Stopped events.

Added: 11

OrdinalFieldTypeDescription
statuszx/Status

The epitaph set on the fuchsia.component.runner/ComponentController protocol channel. This is the exit status of the component. The possible status values and their meaning are described in the definition of the ComponentController protocol.

exit_codeint64

The exit code of the component instance. Note that not all components will stop with an exit code.

Many program runtimes have the concept of an exit code. Runners may map that value to this field when applicable. For example, the ELF runner will publish the Zircon process return code here.

Added: 23

UnresolvedPayload

Defined in fuchsia.component/events.fidl

Payload for Unresolved events.

Added: 11

OrdinalFieldTypeDescription

UNIONS

Controller_Destroy_Result strict

Defined in fuchsia.component/controller.fidl

OrdinalVariantTypeDescription
responseController_Destroy_Response
errError
framework_errinternal

Controller_GetExposedDictionary_Result strict resource

Defined in fuchsia.component/controller.fidl

OrdinalVariantTypeDescription
responseController_GetExposedDictionary_Response
errError
framework_errinternal

Controller_IsStarted_Result strict resource

Defined in fuchsia.component/controller.fidl

OrdinalVariantTypeDescription
responseController_IsStarted_Response
errError
framework_errinternal

Controller_Start_Result strict

Defined in fuchsia.component/controller.fidl

OrdinalVariantTypeDescription
responseController_Start_Response
errError
framework_errinternal

EventPayload flexible resource

Defined in fuchsia.component/events.fidl

Encapsulates additional data/protocols for some event types.

Added: 11
OrdinalVariantTypeDescription
capability_requestedCapabilityRequestedPayload

Payload for CapabilityRequested events

purgedPurgedPayload

Payload for Purged events.

directory_readyDirectoryReadyPayload

Payload for DirectoryReady events

Removed: 20 Deprecated: 19
discoveredDiscoveredPayload

Payload for Discovered events.

Deprecated: 22
destroyedDestroyedPayload

Payload for Destroyed events.

resolvedResolvedPayload

Payload for Resolved events

startedStartedPayload

Payload for Started events

stoppedStoppedPayload

Payload for Stopped events

debug_startedDebugStartedPayload

Payload for DebugStarted events

unresolvedUnresolvedPayload

Payload for Unresolved events

Introspector_GetMoniker_Result strict

Defined in fuchsia.component/introspector.fidl

OrdinalVariantTypeDescription
responseIntrospector_GetMoniker_Response
errError
framework_errinternal

Namespace_Create_Result strict resource

Defined in fuchsia.component/namespace.fidl

OrdinalVariantTypeDescription
responseNamespace_Create_Response
errNamespaceError
framework_errinternal

Realm_CreateChild_Result strict

Defined in fuchsia.component/realm.fidl

OrdinalVariantTypeDescription
responseRealm_CreateChild_Response
errError

Realm_DestroyChild_Result strict

Defined in fuchsia.component/realm.fidl

OrdinalVariantTypeDescription
responseRealm_DestroyChild_Response
errError

Realm_GetChildOutputDictionary_Result strict resource

Defined in fuchsia.component/realm.fidl

OrdinalVariantTypeDescription
responseRealm_GetChildOutputDictionary_Response
errError

Realm_GetResolvedInfo_Result strict resource

Defined in fuchsia.component/realm.fidl

OrdinalVariantTypeDescription
responseRealm_GetResolvedInfo_Response
errError

Realm_ListChildren_Result strict

Defined in fuchsia.component/realm.fidl

OrdinalVariantTypeDescription
responseRealm_ListChildren_Response
errError

Realm_OpenController_Result strict

Defined in fuchsia.component/realm.fidl

OrdinalVariantTypeDescription
responseRealm_OpenController_Response
errError

Realm_OpenExposedDir_Result strict

Defined in fuchsia.component/realm.fidl

OrdinalVariantTypeDescription
responseRealm_OpenExposedDir_Response
errError

CONSTANTS

NameValueTypeDescription
MAX_CAPABILITY_ID_LENGTH50uint64

The maximum string length of a capability ID. This value is currently set arbitrarily.

Added: 11
MAX_CHILD_COUNT128uint32

The maximum number of children that the a call ChildIterator.Next can return. Note, this is not a limit on the number of children that can be added to a component. This is merely a limit for a single invocation of the Next method.

MAX_CHILD_NAME_LENGTH1024uint32
MAX_DYNAMIC_OFFER_COUNT128uint32

The maximum number of dynamic offers that can target a created component.

MAX_ERROR_DESCRIPTION_LENGTH100uint64

The maximum string length of an error description.

Added: 11
MAX_HANDLE_COUNT128uint32

The maximum number of handles that can be passed to a created component.

MAX_MONIKER_LENGTH4096uint32
MAX_NAMESPACE_COUNT32uint32
Added: 14
MAX_NAME_LENGTHfuchsia.io/MAX_NAME_LENGTHuint64
Added: 19
MAX_NUM_EVENTS_RECEIVED100uint64

The maximum number of events that a receiver can listen to.

MAX_PATH_LENGTHfuchsia.io/MAX_PATH_LENGTHuint64
Added: 15
MAX_SUBSCRIPTION_REQUESTS2uint32

The maximum number of requests per event subscription.

MAX_URL_SCHEME_LENGTHMAX_NAME_LENGTHuint64
Added: 19

ALIASES

NameValueDescription
child_namestring[MAX_CHILD_NAME_LENGTH]
namestring[MAX_NAME_LENGTH]
url_schemestring[MAX_URL_SCHEME_LENGTH]