blob: 18b6c2d220a2af7fd9eb5ce997eafe6d230cce85 [file] [log] [blame]
// 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.
@available(added=7)
library fuchsia.session;
using fuchsia.url;
/// A protocol used to launch sessions.
@discoverable
protocol Launcher {
/// Launches the session detailed in `configuration`.
///
/// If a session is currently running, the component associated with the running
/// session will be destroyed.
///
/// + `configuration` describes the session to launch.
/// * error `LaunchError.INVALID_ARGS` if `configuration.session_url` is not set.
/// * error `LaunchError.NOT_FOUND` if `configuration.session_url`
/// could not be resolved.
/// * error `LaunchError.DESTROY_COMPONENT_FAILED` if an existing session component
/// could not be destroyed. The existing session remains running at this point.
/// * error `LaunchError.CREATE_COMPONENT_FAILED` if the session component
/// could not be started. No session will be running at this point.
Launch(struct {
configuration LaunchConfiguration;
}) -> (struct {}) error LaunchError;
};
/// An error that occurs when launching a session.
type LaunchError = flexible enum {
/// The session's `LaunchConfiguration` is malformed.
INVALID_ARGS = 1;
/// There was an error resolving the session's component URL.
NOT_FOUND = 2;
/// The session component could not be destroyed.
DESTROY_COMPONENT_FAILED = 3;
/// The session component could not be created.
CREATE_COMPONENT_FAILED = 4;
};
/// A protocol used to restart the currently running session.
@discoverable
protocol Restarter {
/// Restarts the session.
///
/// * error `RestartError.NOT_RUNNING` if there is no
/// currently running session to restart.
/// * error `RestartError.DESTROY_COMPONENT_FAILED` if an existing session component
/// could not be destroyed. The existing session remains running at this point.
/// * error `RestartError.CREATE_COMPONENT_FAILED` if the session component
/// could not be started. No session will be running at this point.
Restart() -> (struct {}) error RestartError;
};
/// An error that occurs when restarting a session.
type RestartError = flexible enum {
/// There is no currently running session to restart.
NOT_RUNNING = 1;
/// There was an error resolving the session's component URL.
NOT_FOUND = 2;
/// The session component could not be destroyed.
DESTROY_COMPONENT_FAILED = 3;
/// The session component could not be created.
CREATE_COMPONENT_FAILED = 4;
};
/// Describes a session to launch.
type LaunchConfiguration = table {
/// The component URL of the session.
1: session_url string:fuchsia.url.MAX_URL_LENGTH;
};