From 3fbe1158b89552b2861af9735985844e3d45c904 Mon Sep 17 00:00:00 2001 From: Miguel Flores Ruiz de Eguino <miguelfrde@google.com> Date: Mon, 13 May 2019 18:13:26 +0000 Subject: [PATCH] [discover] Add DiscoverManager and ModuleOutput FIDL protocols MI4-2399 #done TESTED=build Change-Id: I349581101aa35e29e14dee3058b62bcde963cbd9 --- sdk/fidl/fuchsia.app.discover/BUILD.gn | 18 +++++++++++++ sdk/fidl/fuchsia.app.discover/OWNERS | 2 ++ sdk/fidl/fuchsia.app.discover/README.md | 18 +++++++++++++ .../discover_manager.fidl | 24 +++++++++++++++++ .../fuchsia.app.discover/module_output.fidl | 27 +++++++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 sdk/fidl/fuchsia.app.discover/BUILD.gn create mode 100644 sdk/fidl/fuchsia.app.discover/OWNERS create mode 100644 sdk/fidl/fuchsia.app.discover/README.md create mode 100644 sdk/fidl/fuchsia.app.discover/discover_manager.fidl create mode 100644 sdk/fidl/fuchsia.app.discover/module_output.fidl diff --git a/sdk/fidl/fuchsia.app.discover/BUILD.gn b/sdk/fidl/fuchsia.app.discover/BUILD.gn new file mode 100644 index 00000000000..53080293a96 --- /dev/null +++ b/sdk/fidl/fuchsia.app.discover/BUILD.gn @@ -0,0 +1,18 @@ +# Copyright 2019 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. + +import("//build/fidl/fidl.gni") + +fidl("fuchsia.app.discover") { + sdk_category = "partner" + + sources = [ + "discover_manager.fidl", + "module_output.fidl", + ] + + deps = [ + "//sdk/fidl/fuchsia.app", + ] +} diff --git a/sdk/fidl/fuchsia.app.discover/OWNERS b/sdk/fidl/fuchsia.app.discover/OWNERS new file mode 100644 index 00000000000..ea3f4ae6efc --- /dev/null +++ b/sdk/fidl/fuchsia.app.discover/OWNERS @@ -0,0 +1,2 @@ +miguelfrde@google.com +schilit@google.com diff --git a/sdk/fidl/fuchsia.app.discover/README.md b/sdk/fidl/fuchsia.app.discover/README.md new file mode 100644 index 00000000000..aceff3e69ab --- /dev/null +++ b/sdk/fidl/fuchsia.app.discover/README.md @@ -0,0 +1,18 @@ +# Discover FIDL API + +Experimental. + +## DiscoverManager + +Sessionmgr routes modules' requests for ModuleOutputWriter to discovermgr via +the DiscoverRegistry protocol. While doing so, it provides the discovermgr with +a unique identifier for the module. + +This interface is meant to be used only by sessionmgr. + +## ModuleOutputWriter + +Provided to modules to write to output parameters. Entities written to these outputs +will be used in suggested action inputs by the discovermgr. + +This interface is meant to be used by modules. diff --git a/sdk/fidl/fuchsia.app.discover/discover_manager.fidl b/sdk/fidl/fuchsia.app.discover/discover_manager.fidl new file mode 100644 index 00000000000..f3486b95c14 --- /dev/null +++ b/sdk/fidl/fuchsia.app.discover/discover_manager.fidl @@ -0,0 +1,24 @@ +// Copyright 2019 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.app.discover; + +using fuchsia.app; + +/// Interface between sessionmgr and discovermgr to route service connections +/// requests that require module scoping. +[Discoverable] +protocol DiscoverRegistry { + /// Retrieves a module output writer for the module identified by |module|. + RegisterModuleOutputWriter(ModuleIdentifier module, request<ModuleOutputWriter> request); +}; + +table ModuleIdentifier { + /// The ID of the story to which the module belongs. + 1: fuchsia.app.StoryId story_id; + + /// The named path leading up to this module instance. This path is a unique + /// identifier of the module in the story. + 2: vector<string> module_path; +}; diff --git a/sdk/fidl/fuchsia.app.discover/module_output.fidl b/sdk/fidl/fuchsia.app.discover/module_output.fidl new file mode 100644 index 00000000000..4db150450e5 --- /dev/null +++ b/sdk/fidl/fuchsia.app.discover/module_output.fidl @@ -0,0 +1,27 @@ +// Copyright 2019 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.app.discover; + +[Discoverable] +protocol ModuleOutputWriter { + /// Writes the |entity_reference| to the module's |output_parameter_name| + /// output. If no entity is provided, the output will be unset. + /// Return happens upon completion of a successful write. + Write(string output_name, string? entity_reference) -> () error OutputError; +}; + +/// Errors that can occur when writing to an output. +enum OutputError : int32 { + /// If the output doesn't match a parameter defined in the module manifest + /// for the action currently being handled by the module. + UNKNOWN_NAME = 1; + + /// If the entity reference couldn't be resolved. + UNKNOWN_ENTITY_REFERENCE = 2; + + /// If the entity type written doesn't match the type defined in the module + /// manifest for the action currently being handled by the module.. + INVALID_ENTITY_TYPE = 3; +}; -- GitLab