blob: c3c9f8cd6a3a9d74cc12619befde24f465d04468 [file] [log] [blame] [edit]
// Copyright 2020 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.pkg;
using fuchsia.io;
/// A collection of TUF repositories contained in an attached storage device.
@discoverable
protocol LocalMirror {
/// Obtains and returns a named TUF metadata file from an attached storage
/// device.
///
/// + request `repo_url` the URL of the TUF repository for which to return
/// metadata.
/// + request `path` the path of the metadata file, relative to the
/// repository_metadata directory for the specific TUF repository.
/// + request `metadata` a pipelined TUF metadata file to be opened with
/// `fuchsia.io/OpenFlags.RIGHT_READABLE | fuchsia.io/OpenFlags.DESCRIBE`.
/// If the metadata directory exists but the requested file does not, the
/// client end will receive a fuchsia.io/Node.OnOpen with
/// `Status::NOT_FOUND`.
/// * error a `GetMetadataError` value
// TODO(fxbug.dev/121253): Make this method one-way.
GetMetadata(resource struct {
repo_url RepositoryUrl;
path fuchsia.io.Path;
metadata server_end:fuchsia.io.File;
}) -> () error GetMetadataError;
/// Obtains and returns a blob from an attached storage device.
///
/// + request `blob_id` the id of the blob to return.
/// + request `blob` a pipelined blob file to be opened with
/// `fuchsia.io/OpenFlags.RIGHT_READABLE | fuchsia.io/OpenFlags.DESCRIBE`.
/// If the blobs directory exists but the requested file does not, the
/// client end will receive a fuchsia.io/Node.OnOpen with
/// `Status::NOT_FOUND`.
/// * error a `GetBlobError` value
// TODO(fxbug.dev/121253): Make this method one-way.
GetBlob(resource struct {
blob_id BlobId;
blob server_end:fuchsia.io.File;
}) -> () error GetBlobError;
};
/// Error type for [`fuchsia.pkg/LocalMirror.GetMetadata`].
// TODO(fxbug.dev/121253): Remove this enum.
type GetMetadataError = strict enum {
/// An error occurred when opening the requested metadata file. This may (though
/// does not necessarily) indicate the metadata directory does not exist.
ERROR_OPENING_METADATA = 1;
};
/// Error type for [`fuchsia.pkg/LocalMirror.GetBlob`].
// TODO(fxbug.dev/121253): Remove this enum.
type GetBlobError = strict enum {
/// An error occurred when opening the requested blob. This may (though
/// does not necessarily) indicate the blobs directory does not exist.
ERROR_OPENING_BLOB = 1;
};