Ejemplo n.º 1
0
        public async Task <IBlob> GetAsync(string key)
        {
            int       retryCount = 0;
            Exception lastException;

            do
            {
                if (retryCount > 0)
                {
                    await Task.Delay(retryPolicy.GetDelay(retryCount)).ConfigureAwait(false);
                }

                try
                {
                    var request = new GetObjectRequest(
                        host: client.Host,
                        bucketName: bucketName,
                        key: key
                        );

                    return(await client.GetObjectAsync(request).ConfigureAwait(false));
                }
                catch (S3Exception ex) when(ex.IsTransient)
                {
                    lastException = ex;
                }

                retryCount++;
            }while (retryPolicy.ShouldRetry(retryCount));

            throw lastException;
        }
Ejemplo n.º 2
0
        public async Task <IBlob> GetRangeAsync(string name, long start, long end)
        {
            var request = new GetObjectRequest(client.Region, bucketName, key: name);

            request.SetRange(start, end);

            return(await client.GetObjectAsync(request).ConfigureAwait(false));
        }
Ejemplo n.º 3
0
        public async Task <IBlob> GetAsync(string name)
        {
            var request = new GetObjectRequest(
                host: client.Host,
                bucketName: bucketName,
                objectName: name
                );

            return(await client.GetObjectAsync(request).ConfigureAwait(false));
        }