blob: e31afb5e8999b4df283ef1a200852dfc46c76428 [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.
library fuchsia.ledger.cloud.test;
using fuchsia.ledger.cloud;
/// Service providing a controller for cloud connections sharing the same
/// network state.
///
/// All connections derived from this factory share the same data, and are
/// closed when the factory is disconnected.
[Discoverable]
protocol CloudControllerFactory {
/// Builds a new controller with its own network state.
Build(request<CloudController> controller);
};
/// Possible network states.
enum NetworkState : int32 {
/// The cloud answers `NETWORK_ERROR` to requests on pages.
/// Until LE-438 is fixed, the cloud should return OK for SetWatcher.
DISCONNECTED = 1;
/// The cloud behaves normally.
CONNECTED = 2;
/// The cloud inject network errors the first few times a request is
/// attempted.
INJECT_NETWORK_ERRORS = 3;
};
/// Service controlling some CloudProvider connections sharing the same network
/// state.
///
/// Closing this interface closes the CloudProviders created from it.
protocol CloudController {
/// Sets the network state of the CloudProvider.
///
/// After this returns, all requests on the CloudProviders created from this
/// controller are guaranteed to see the network state `state`.
SetNetworkState(NetworkState state) -> ();
/// Creates a new CloudProvider managed by this controller.
///
/// This CloudProvider shares the network state of all CloudProviders
/// created from this CloudController, and the data of all CloudProviders
/// created from the same CloudControllerFactory.
Connect(request<fuchsia.ledger.cloud.CloudProvider> provider);
};