blob: 582a9a749ce926b796883f8cf1f10491aa3fd828 [file] [log] [blame] [edit]
// Copyright 2021 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.
deprecated_syntax;
library fuchsia.developer.bridge;
using fuchsia.device;
const uint64 MAX_NAME = 255;
const uint64 MAX_PATH = 4095;
const uint64 MAX_REPOS = 512;
const uint64 MAX_ALIASES = 32;
/// Describes all the possible repositories that could be managed by this service.
flexible union RepositorySpec {
1: FileSystemRepositorySpec file_system;
2: PmRepositorySpec pm;
};
/// [FileSystemRepositorySpec] describes a TUF repository found on the local filesystem.
table FileSystemRepositorySpec {
/// File system path to the location of the repository.
1: string:MAX_PATH path;
};
/// [PmRepositorySpec] describes a TUF repository created by pm found on the local filesystem.
table PmRepositorySpec {
/// File system path to the location of the pm repository.
1: string:MAX_PATH path;
};
[Discoverable]
protocol RepositoryRegistry {
/// Add a repository named `name` that has the following [RepositorySpec].
AddRepository(string:MAX_NAME name, RepositorySpec repository) -> () error RepositoryError;
/// Returns true if the repository was removed, or false if there is no
/// repository named `name`.
RemoveRepository(string:MAX_NAME name) -> (bool found);
ListRepositories(request<RepositoryIterator> iterator);
RegisterTarget(RepositoryTarget target_info) -> () error RepositoryError;
/// List the packages in the repository named `name`.
ListPackages(string:MAX_NAME name, request<RepositoryPackagesIterator> iterator) -> () error RepositoryError;
};
struct RepositoryConfig {
string:MAX_NAME name;
RepositorySpec spec;
};
protocol RepositoryIterator {
Next() -> (vector<RepositoryConfig>:MAX_REPOS repos);
};
protocol RepositoryPackagesIterator {
Next() -> (vector<RepositoryPackage>:MAX packages);
};
table RepositoryPackage {
/// Package name
1: string:2048 name;
/// Package's merkle hash
2: string:2048 hash;
/// Size in bytes of all blobs in this package.
3: uint64 size;
// TODO: add `components` here.
};
table RepositoryTarget {
/// The configured name of the repository
1: string:MAX_NAME repo_name;
/// The target on which to configure this repository
2: string:fuchsia.device.DEVICE_NAME_MAX target_identifier;
/// An optional list of hostnames. A rewrite rule will be added
/// for each hostname in this list to resolve to this repository.
3: vector<string:MAX_NAME>:MAX_ALIASES aliases;
};
enum RepositoryError : uint32 {
/// Repository "name" is missing in an API where it is required.
MISSING_REPOSITORY_NAME = 1;
/// No repository matches the provided name.
NO_MATCHING_REPOSITORY = 2;
/// There was an error communicating with the target. This may mean that
/// the target does not exist, is down or unreachable, or that there was an
/// error communicating with a proxy on target.
/// TODO(fxbug.dev/77904) make this more specific when we have more specific
/// errors from the underlying API.
TARGET_COMMUNICATION_FAILURE = 3;
/// There was an error from the fuchsia.pkg.RepositoryRegistry.
REPOSITORY_MANAGER_ERROR = 4;
/// There was a error from fuchsia.pkg.rewrite.Engine.
REWRITE_ENGINE_ERROR = 5;
/// Unknown repository spec type.
UNKNOWN_REPOSITORY_SPEC = 6;
/// Repository spec is missing a required field.
MISSING_REPOSITORY_SPEC_FIELD = 7;
/// Some unspecified error occurred during I/O.
IO_ERROR = 8;
/// Some unspecified internal error occurred.
INTERNAL_ERROR = 9;
};