| // Copyright 2016 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.internal; |
| |
| using fuchsia.ledger; |
| using fuchsia.ledger.cloud; |
| |
| // Entry interface implemented by the Ledger application, intended to be used by |
| // the process setting up the user environment to obtain repositories for |
| // individual users. |
| [Discoverable] |
| interface LedgerRepositoryFactory : fuchsia.ledger.ErrorNotifier { |
| // Binds to the directory referenced by |repository|. If this is called |
| // multiple times for the same directory, only the first instance of |
| // |server_id| / |cloud_provider| will be used. Any subsequent ones will |
| // simply be ignored. |
| // |
| // Parameters: |
| // |repository_directory| channel pointing to the disk directory where the |
| // repository is stored. At any given time, at most one repository |
| // instance backed by the same disk directory can be running |
| // concurrently. |
| // TODO(qsr): Use typed channel when remoteio has been migrated to FIDL2. |
| // |cloud_provider| is used by Ledger to synchronize data through the |
| // cloud. If |cloud_provider| is disconnected, Ledger shuts down the |
| // repository and disconnects all clients. |
| // |user_id| is a unique, not device local, user identifier. It will be |
| // used to enable Peer to Peer over NetConnector, and will be removed |
| // once Ledger uses Overnet for Peer to Peer communication. If it is |
| // empty, Ledger will not synchronize using Peer to Peer communication. |
| 1: GetRepository(handle<channel> repository_directory, |
| fuchsia.ledger.cloud.CloudProvider? cloud_provider, |
| string user_id, |
| request<LedgerRepository> repository); |
| }; |
| |
| // Controller interface for the Ledger application lifecycle. |
| [Discoverable] |
| interface LedgerController { |
| // Terminate the ledger application. |
| 1: Terminate(); |
| }; |
| |
| interface LedgerRepository : fuchsia.ledger.ErrorNotifier { |
| // Creates a new Ledger for the given |ledger_name| if it doesn't already |
| // exist. |
| 1: GetLedger(vector<uint8> ledger_name, request<fuchsia.ledger.Ledger> ledger); |
| |
| // Binds a new LedgerRepository handle to this repository. |
| 2: Duplicate(request<LedgerRepository> ledger_repository); |
| |
| // Sets a watcher to track the synchronization state of a user's Ledger. The |
| // current state is immediately sent to the watcher when this method is |
| // called. |
| 3: SetSyncStateWatcher(fuchsia.ledger.SyncWatcher watcher); |
| |
| // Returns the debugging interface for this LedgerRepository |
| 4: GetLedgerRepositoryDebug(request<LedgerRepositoryDebug> ledgerRepositoryDebug); |
| |
| // Tries to clean up disk space on the device by removing unused data that are |
| // already backed up in the cloud. |
| 5: DiskCleanUp(); |
| }; |