Пример #1
0
 internal async Task SaveAsyncImpl(
     JobOutputKind kind,
     DirectoryInfo baseFolder,
     string relativePath,
     CancellationToken cancellationToken = default(CancellationToken)
     )
 => await _storagePath.SaveAsync(kind, baseFolder, relativePath, cancellationToken);
Пример #2
0
 /// <summary>
 /// Saves the specified file to persistent storage.
 /// </summary>
 /// <param name="kind">A <see cref="JobOutputKind"/> representing the category under which to
 /// store this file, for example <see cref="JobOutputKind.JobOutput"/> or <see cref="JobOutputKind.JobPreview"/>.</param>
 /// <param name="sourcePath">The path of the file to save.</param>
 /// <param name="destinationRelativePath">The blob name under which to save the file. This may include a
 /// relative component, such as "pointclouds/pointcloud_0001.txt".</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynchronous operation.</param>
 /// <returns>A <see cref="Task"/> that represents the asynchronous operation.</returns>
 /// <exception cref="ArgumentNullException">The <paramref name="kind"/>, <paramref name="sourcePath"/>, or <paramref name="destinationRelativePath"/> argument is null.</exception>
 /// <exception cref="ArgumentException">The <paramref name="sourcePath"/> or <paramref name="destinationRelativePath"/> argument is empty.</exception>
 public async Task SaveAsync(
     JobOutputKind kind,
     string sourcePath,
     string destinationRelativePath,
     CancellationToken cancellationToken = default(CancellationToken)
     )
 => await _storagePath.SaveAsync(kind, sourcePath, destinationRelativePath, cancellationToken);
Пример #3
0
 /// <summary>
 /// Retrieves a job output from Azure blob storage by kind and path.
 /// </summary>
 /// <param name="kind">A <see cref="JobOutputKind"/> representing the category of the output to
 /// retrieve, for example <see cref="JobOutputKind.JobOutput"/> or <see cref="JobOutputKind.JobPreview"/>.</param>
 /// <param name="filePath">The path under which the output was persisted in blob storage.</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynchronous operation.</param>
 /// <returns>A reference to the requested file in Azure blob storage.</returns>
 public async Task <OutputFileReference> GetOutputAsync(
     JobOutputKind kind,
     string filePath,
     CancellationToken cancellationToken = default(CancellationToken)
     )
 => await _storagePath.GetOutputAsync(kind, filePath, cancellationToken);
Пример #4
0
 /// <summary>
 /// Lists the job outputs of the specified kind.
 /// </summary>
 /// <param name="kind">A <see cref="JobOutputKind"/> representing the category of outputs to
 /// list, for example <see cref="JobOutputKind.JobOutput"/> or <see cref="JobOutputKind.JobPreview"/>.</param>
 /// <returns>A list of persisted job outputs of the specified kind.</returns>
 /// <remarks>The list is retrieved lazily from Azure blob storage when it is enumerated.</remarks>
 public IEnumerable <OutputFileReference> ListOutputs(JobOutputKind kind)
 => _storagePath.List(kind);
Пример #5
0
 /// <summary>
 /// Saves the specified file to persistent storage.
 /// </summary>
 /// <param name="kind">A <see cref="JobOutputKind"/> representing the category under which to
 /// store this file, for example <see cref="JobOutputKind.JobOutput"/> or <see cref="JobOutputKind.JobPreview"/>.</param>
 /// <param name="relativePath">The path of the file to save, relative to the current directory.
 /// If the file is in a subdirectory of the current directory, the relative path will be preserved
 /// in blob storage.</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynchronous operation.</param>
 /// <returns>A <see cref="Task"/> that represents the asynchronous operation.</returns>
 /// <remarks>If the file is outside the current directory, traversals up the directory tree are removed.
 /// For example, a <paramref name="relativePath"/> of "..\ProcessEnv.cmd" would be treated as "ProcessEnv.cmd"
 /// for the purposes of creating a blob name.</remarks>
 /// <exception cref="ArgumentNullException">The <paramref name="kind"/> or <paramref name="relativePath"/> argument is null.</exception>
 /// <exception cref="ArgumentException">The <paramref name="relativePath"/> argument is an absolute path, or is empty.</exception>
 public async Task SaveAsync(
     JobOutputKind kind,
     string relativePath,
     CancellationToken cancellationToken = default(CancellationToken)
     )
 => await SaveAsyncImpl(kind, new DirectoryInfo(Directory.GetCurrentDirectory()), relativePath, cancellationToken);
 /// <summary>
 /// Gets the Blob name prefix/folder where files of the given kind are stored
 /// </summary>
 /// <param name="job">The job to calculate the output storage destination for.</param>
 /// <param name="kind">The output kind.</param>
 /// <returns>The Blob name prefix/folder where files of the given kind are stored.</returns>
 public static string GetOutputStoragePath(this CloudJob job, JobOutputKind kind)
 => StoragePath.JobStoragePath.BlobNamePrefixImpl(kind);
Пример #7
0
 /// <summary>
 /// Gets the Blob name prefix/folder where files of the given kind are stored
 /// </summary>
 /// <param name="kind">The output kind.</param>
 /// <returns>The Blob name prefix/folder where files of the given kind are stored.</returns>
 public string GetOutputStoragePath(JobOutputKind kind) => _storagePath.BlobNamePrefix(kind);
 /// <summary>
 /// Retrieves a job output from Azure blob storage by kind and path.
 /// </summary>
 /// <param name="kind">A <see cref="JobOutputKind"/> representing the category of the output to
 /// retrieve, for example <see cref="JobOutputKind.JobOutput"/> or <see cref="JobOutputKind.JobPreview"/>.</param>
 /// <param name="filePath">The path under which the output was persisted in blob storage.</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynchronous operation.</param>
 /// <returns>A reference to the requested file in Azure blob storage.</returns>
 public async Task <ICloudBlob> GetOutputAsync(JobOutputKind kind, string filePath, CancellationToken cancellationToken = default(CancellationToken))
 => await _storagePath.GetBlobAsync(kind, filePath, cancellationToken);
 /// <summary>
 /// Lists the job outputs of the specified kind.
 /// </summary>
 /// <param name="kind">A <see cref="JobOutputKind"/> representing the category of outputs to
 /// list, for example <see cref="JobOutputKind.JobOutput"/> or <see cref="JobOutputKind.JobPreview"/>.</param>
 /// <returns>A list of persisted job outputs of the specified kind.</returns>
 /// <remarks>The list is retrieved lazily from Azure blob storage when it is enumerated.</remarks>
 public IEnumerable <IListBlobItem> ListOutputs(JobOutputKind kind)
 => _storagePath.List(kind);