/// <summary>
        /// Constructs a new empty BucketObjectsWindow.
        /// </summary>
        /// <param name="regionBucketAndPrefix">The region, bucket, and prefix, in the following form: [region:]bucket/prefix.</param>
        /// <param name="batchIdCounter">The <see cref="BatchIdCounter"/> for this window.</param>
        /// <param name="unprefixedStartAtKey">The key to start at or <b>null</b> to start at the beginning.</param>
        /// <param name="unprefixedStopAtKey">The key to stop at or <b>null</b> to start at the beginning.</param>
        /// <param name="cannedAcl">A <see cref="S3CannedACL"/> to use for the target file.</param>
        /// <param name="grant">A <see cref="S3Grant"/> indicating rights grants to apply to the target file.</param>
        public BucketObjectsWindow(string regionBucketAndPrefix, BatchIdCounter batchIdCounter, string unprefixedStartAtKey = null, string unprefixedStopAtKey = null, S3CannedACL cannedAcl = null, S3Grant grant = null, ServerSideEncryptionMethod targetEncryptionMethod = null)
        {
            _batchIdCounter = batchIdCounter;
            Tuple <string, string, string> parsedRegionBucketAndPrefix = ParseRegionBucketAndPrefix(regionBucketAndPrefix);

            Amazon.RegionEndpoint region = Amazon.RegionEndpoint.GetBySystemName(string.IsNullOrEmpty(parsedRegionBucketAndPrefix.Item1)
                ? GetBucketRegion(parsedRegionBucketAndPrefix.Item2)
                : parsedRegionBucketAndPrefix.Item1);
            _s3             = new AmazonS3Client(region);
            _bucket         = parsedRegionBucketAndPrefix.Item2;
            _prefix         = parsedRegionBucketAndPrefix.Item3;
            _grant          = grant;
            _grantCannedAcl = cannedAcl;
            _queue          = new ConcurrentQueue <Batch>();
            if (!string.IsNullOrEmpty(unprefixedStartAtKey))
            {
                _startAtKey         = _prefix + unprefixedStartAtKey;
                _unprefixedLeastKey = unprefixedStartAtKey;
            }
            else
            {
                _unprefixedLeastKey = string.Empty;
            }
            if (!string.IsNullOrEmpty(unprefixedStopAtKey))
            {
                _stopAtKey = _prefix + unprefixedStopAtKey;
            }
            _unprefixedGreatestKey  = string.Empty;
            _targetEncryptionMethod = targetEncryptionMethod;
        }
Beispiel #2
0
 /// <summary>
 /// Constructs a state object for the sync operation from the specified source to the specified destination.
 /// </summary>
 /// <param name="sourceRegionBucketAndPrefix">The source region, bucket, and prefix.</param>
 /// <param name="targetRegionBucketAndPrefix">The target region, bucket, and prefix.</param>
 /// <param name="grant">A string indicating rights being granted to the target file.</param>
 /// <param name="encryptionMethod">A string indicating the encryption method to use for the target file.</param>
 /// <param name="startKey">The key to start on.</param>
 /// <param name="stopKey">The key to stop on.</param>
 public State(string sourceRegionBucketAndPrefix, string targetRegionBucketAndPrefix, string grant, string encryptionMethod, string startKey, string stopKey)
 {
     _sourceRegionBucketAndPrefix = sourceRegionBucketAndPrefix;
     _targetRegionBucketAndPrefix = targetRegionBucketAndPrefix;
     _grant                    = grant;
     _encryptionMethod         = encryptionMethod;
     _startDate                = DateTime.UtcNow;
     _unrecordedTimeStartTicks = _startDate.Ticks;
     _ticksUsed                = 0;
     _sourceBatchId            = new BatchIdCounter();
     _startKey                 = startKey;
     if (!string.IsNullOrEmpty(startKey))
     {
         _lastKeyOfLastBatchCompleted = startKey;
     }
     _stopKey = stopKey;
 }