Beispiel #1
0
        public static void ValidatePutBlobArguments(IBlobObject blob, long contentLength, long?maxBlobSize, byte[] applicationMetadata, byte[] contentMD5, ISequenceNumberUpdate sequenceNumberUpdate, OverwriteOption overwriteOption, IBlobObjectCondition condition, bool isLargeBlockBlobRequest, bool is8TBPageBlobAllowed)
        {
            if (blob.Snapshot != StorageStampHelpers.RootBlobSnapshotVersion)
            {
                throw new XStoreArgumentException("This operation is only supported on the root blob.");
            }
            long num = 1099511627776L;

            if (contentLength < (long)0)
            {
                throw new ArgumentOutOfRangeException("contentLength", "contentLength must be >= 0");
            }
            if (blob.Type == BlobType.ListBlob && !isLargeBlockBlobRequest && contentLength > (long)67108864)
            {
                throw new BlobContentTooLargeException(new long?((long)67108864), null, null);
            }
            if (blob.Type == BlobType.IndexBlob && maxBlobSize.Value > num)
            {
                throw new BlobContentTooLargeException(new long?(num), null, null);
            }
            StorageStampHelpers.ValidateMaxBlobSizeForPutBlob(blob, maxBlobSize);
            StorageStampHelpers.ValidateApplicationMetadata(applicationMetadata);
            if (contentMD5 != null && (long)((int)contentMD5.Length) != (long)16)
            {
                throw new MD5InvalidException();
            }
            if (sequenceNumberUpdate != null)
            {
                if (blob.Type != BlobType.IndexBlob)
                {
                    throw new XStoreArgumentException("sequenceNumberUpdate only allowed for PageBlob");
                }
                if (sequenceNumberUpdate.UpdateType != SequenceNumberUpdateType.Update)
                {
                    throw new XStoreArgumentException("sequenceNumberUpdate can only have type Update for PutBlob.");
                }
                if (sequenceNumberUpdate.SequenceNumber < (long)0 || sequenceNumberUpdate.SequenceNumber > 9223372036854775807L)
                {
                    throw new XStoreArgumentException("sequenceNumberUpdate sequence number must be >= 0 and < Int64.MaxValue.");
                }
            }
        }