Esempio n. 1
0
        static async Task CreateLinkAsync(IAwsManager awsManager, S3Links.ICreateLinkRequest createLinkRequest, bool actuallyWrite, CancellationToken cancellationToken)
        {
            if (cancellationToken.IsCancellationRequested)
            {
                return;
            }

            var relativePath = createLinkRequest.RelativePath;
            var key          = createLinkRequest.FileFingerprint.Fingerprint.Key();

            Console.WriteLine("Link {0} \"{1}\" -> {2} ({3})",
                              createLinkRequest.Collection, relativePath, key.Substring(0, 12),
                              createLinkRequest.FileFingerprint.WasCached ? "cached" : "new");

            if (!actuallyWrite)
            {
                return;
            }

            try
            {
                await awsManager.CreateLinkAsync(createLinkRequest, cancellationToken).ConfigureAwait(false);
            }
            catch (OperationCanceledException)
            { }
            catch (Exception ex)
            {
                Console.WriteLine("Link {0} {1} -> {2} failed: {3}", createLinkRequest.Collection, relativePath, key.Substring(0, 12), ex.Message);
            }
        }
Esempio n. 2
0
 public Task CreateLinkAsync(S3Links.ICreateLinkRequest createLinkRequest, CancellationToken cancellationToken)
 {
     return(_s3Links.CreateLinkAsync(createLinkRequest, cancellationToken));
 }