blob: 3f52fad8350f94e1485a44c82667af9a6e6031b5 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.modular;
/// Information about a Module instance in a story.
table ModuleData {
/// The URL of the Module binary.
1: string module_url;
/// The named path leading up to this Module instance. The last name in this
/// array is the name by which the Module was started by the parent Module
/// instance calling StartModule().
2: vector<string> module_path;
/// Contains the mapping of Mod parameter name to Link instances for this mod.
3: ModuleParameterMap parameter_map;
/// The way in which this Module instance was first started in the story,
/// either by request from another Module instance (INTERNAL) or by request
/// from outside the story (i.e. by suggestion from an agent - EXTERNAL).
4: ModuleSource module_source;
/// The `surface_relation` that was used to start this Module instance with.
/// The same is used when re-inflating the Module instance when the story is
/// resumed. A SurfaceRelation value of null represents an embedded Module
/// instance (started by EmbedModule()) that is not managed by the story shell.
5: SurfaceRelation surface_relation;
/// True if this module was removed from its story either through
/// ModuleController.Stop() or ModuleContext.RemoveSelfFromStory().
6: bool module_deleted;
/// The intent that was issued to start add this Module instance to the story.
/// Some Module instances may have been added not by an Intent, for example as
/// the initial module of a story. For those the field may be null.
///
/// TODO(thatguy,mesch): This field should now always be set, so make it
/// required once the framework is cleaned up enough to guarantee this
/// statement.
7: Intent intent;
/// If true, this module was started by a parent module using
/// ModuleContext.EmbedModule(), and its view is not managed by the
/// StoryShell.
8: bool is_embedded;
/// Collection of user-defined key-value attributes that describe this surface (module).
///
/// The `Annotation.value` field of each `Annotation` is always set.
9: vector<Annotation>:MAX_ANNOTATIONS_PER_MODULE annotations;
};
enum ModuleSource {
/// Module that was added to the story from within the story by another
/// module using ModuleContext.AddModuleToStory() or
/// ModuleContext.EmbedModule().
INTERNAL = 0;
/// Module that was added to the story from outside the story using
/// PuppetMaster.
EXTERNAL = 1;
};
struct ModuleParameterMap {
vector<ModuleParameterMapEntry> entries;
};
struct ModuleParameterMapEntry {
/// A null [name] is allowed for backwards compatibility with default links.
/// TODO(thatguy); When no modules use null link names any more, make this
/// required.
string? name;
LinkPath link_path;
};