Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #104 from XiaoningLiu/0.19.0
Browse files Browse the repository at this point in the history
2017.09 - version 0.19.0
  • Loading branch information
vinjiang authored Sep 22, 2017
2 parents e3986ce + 29a9329 commit 1923fd4
Show file tree
Hide file tree
Showing 221 changed files with 1,797 additions and 797 deletions.
20 changes: 20 additions & 0 deletions BreakingChanges.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
Tracking Breaking changes in 0.19.0

Blob
* Populate content MD5 for range gets on Blobs.
- `MicrosoftAzure\Storage\Blob\Models\BlobProperties::getContentMD5()` will always return the value of the whole blob’s MD5 value.
- Added `MicrosoftAzure\Storage\Blob\Models\BlobProperties::getRangeContentMD5()` to get MD5 of a blob range.
* `MicrosoftAzure\Storage\Blob\Models\GetBlobOptions` and `MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions` now provide `setRange()` and `getRange()` to accept a `MicrosoftAzure\Storage\Common\Models\Range` object. Following methods are removed:
- `setRangeStart()`
- `getRangeStart()`
- `setRangeEnd()`
- `getRangeEnd()`
* Renamed 2 methods inside `MicrosoftAzure\Storage\Blob\Models\GetBlobOptions`:
- `getComputeRangeMD5()` -> `getRangeGetContentMD5()`
- `setComputeRangeMD5()` -> `setRangeGetContentMD5()`

File
* Populate content MD5 for range gets on Files.
- `MicrosoftAzure\Storage\File\Models\FileProperties::getContentMD5()` will always return the value of the whole file’s MD5 value.
- Added `MicrosoftAzure\Storage\File\Models\FileProperties::getRangeContentMD5()` to get MD5 of a file range.

Tracking Breaking changes in 0.17.0

All
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ You can use the following commands to run tests:
* One particular test case: ``phpunit -c phpunit.dist.xml --filter <case name>`` or ``phpunit -c phpunit.functional.dist.xml --filter <case name>``

### Testing Features
As you develop a feature, you'll need to write tests to ensure quality. Your changes should be covered by both unit tests and functional tests. The unit tests and functional tests codes should be placed under tests/unit and tests/functional respectively. You should also run existing tests related to your change to address any unexpected breaks.
As you develop a feature, you'll need to write tests to ensure quality. Your changes should be covered by both unit tests and functional tests. The unit tests and functional tests codes should be placed under tests/Unit and tests/Functional respectively. You should also run existing tests related to your change to address any unexpected breaks.

## Pull Requests

Expand Down
36 changes: 35 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,42 @@
2017.09 - version 0.19.0

ALL
* Fixed wrong `XmlSerializer` in ServiceException.php.
* Fixed formatting of non-UTC dates when using instances of `DateTime` to generate shared access signatures.
* Fixed class loading errors on case-sensitive file systems when testing.

Blob
* Added `CopyBlobFromURL` to support copy blob from a source URL including resources in other storage accounts.
* Added support for Incremental Copy Page Blob. This allows efficient copying and backup of page blob snapshots.
* Fixed a bug that `BlobRestProxy::createPageBlobFromContent` cannot work.
* Populate content MD5 for range gets on Blobs.
- `MicrosoftAzure\Storage\Blob\Models\BlobProperties::getContentMD5()` will always return the value of the whole blob’s MD5 value.
- Added `MicrosoftAzure\Storage\Blob\Models\BlobProperties::getRangeContentMD5()` to get MD5 of a blob range.
* Renamed 2 methods inside `MicrosoftAzure\Storage\Blob\Models\GetBlobOptions`:
- `getComputeRangeMD5()` -> `getRangeGetContentMD5()`
- `setComputeRangeMD5()` -> `setRangeGetContentMD5()`
* The public access level of a container is now returned from the List Containers and Get Container Properties APIs.
* `MicrosoftAzure\Storage\Blob\Models\GetBlobOptions` and `MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions` now provide `setRange()` and `getRange()` to accept a `MicrosoftAzure\Storage\Common\Models\Range` object. Following methods are removed:
- `setRangeStart()`
- `getRangeStart()`
- `setRangeEnd()`
- `getRangeEnd()`

Queue
* The `QueueRestProxy::createMessage` now returns information about the message that was just added, including the pop receipt.

File
* Fixed a bug that setting content MD5 cannot work when creating files.
* Option parameter `ListDirectoriesAndFilesOptions` of `FileRestProxy::listDirectoriesAndFiles` is now able to set a prefix which limits the listing to a specified prefix.
* Populate content MD5 for range gets on Files.
- `MicrosoftAzure\Storage\File\Models\FileProperties::getContentMD5()` will always return the value of the whole file’s MD5 value.
- Added `MicrosoftAzure\Storage\File\Models\FileProperties::getRangeContentMD5()` to get MD5 of a file range.

2017.08 - version 0.18.0

All
* Updated `SharedAccessSignatureHelper` to accept `Datetime` type as `signedExpiry` or `signedStart` parameter when generating SAS tokens.
* Added samples under samples foder to generate account level or service level SAS tokens with `SharedAccessSignatureHelper`.
* Added samples under the samples folder to generate account level or service level SAS tokens with `SharedAccessSignatureHelper`.
* Fixed wrong PHPUnit `@covers` tags in unit and functional test.
* Removed unused imports declarations.

Expand Down
2 changes: 1 addition & 1 deletion phpunit.functional.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
verbose="true">
<testsuites>
<testsuite name="azure-storage-php">
<directory suffix="Test.php">tests/functional/</directory>
<directory suffix="Test.php">tests/Functional/</directory>
</testsuite>
</testsuites>

Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
verbose="true">
<testsuites>
<testsuite name="azure-storage-php">
<directory suffix="Test.php">tests/unit</directory>
<directory suffix="Test.php">tests/Unit</directory>
</testsuite>
</testsuites>

Expand Down
10 changes: 4 additions & 6 deletions samples/BlobSamples.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use MicrosoftAzure\Storage\Blob\Models\DeleteBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\CreateBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\GetBlobOptions;
use MicrosoftAzure\Storage\Blob\Models\ContainerAcl;
use MicrosoftAzure\Storage\Blob\Models\ContainerACL;
use MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions;
use MicrosoftAzure\Storage\Blob\Models\ListPageBlobRangesOptions;
use MicrosoftAzure\Storage\Common\Exceptions\ServiceException;
Expand Down Expand Up @@ -234,7 +234,7 @@ function containerAcl($blobClient)
// Set container ACL
$past = new \DateTime("01/01/2010");
$future = new \DateTime("01/01/2020");
$acl = new ContainerAcl();
$acl = new ContainerACL();
$acl->setPublicAccess(PublicAccessType::CONTAINER_AND_BLOBS);
$acl->addSignedIdentifier('123', $past, $future, 'rw');
$blobClient->setContainerACL($container, $acl);
Expand Down Expand Up @@ -519,8 +519,7 @@ function pageBlobOperations($blobClient)
);
# List page blob ranges
$listPageBlobRangesOptions = new ListPageBlobRangesOptions();
$listPageBlobRangesOptions->setRangeStart(0);
$listPageBlobRangesOptions->setRangeEnd(1023);
$listPageBlobRangesOptions->setRange(new Range(0, 1023));
echo "List Page Blob Ranges".PHP_EOL;
$listPageBlobRangesResult = $blobClient->listPageBlobRanges(
$containerName,
Expand All @@ -531,8 +530,7 @@ function pageBlobOperations($blobClient)
foreach ($listPageBlobRangesResult->getRanges() as $range) {
echo "Range:".$range->getStart()."-".$range->getEnd().PHP_EOL;
$getBlobOptions = new GetBlobOptions();
$getBlobOptions->setRangeStart($range->getStart());
$getBlobOptions->setRangeEnd($range->getEnd());
$getBlobOptions->setRange($range);
$getBlobResult = $blobClient->getBlob($containerName, $blobName, $getBlobOptions);
file_put_contents("PageContent.txt", $getBlobResult->getContentStream());
}
Expand Down
1 change: 0 additions & 1 deletion samples/TableSamples.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
use MicrosoftAzure\Storage\Common\SharedAccessSignatureHelper;

$connectionString = 'DefaultEndpointsProtocol=https;AccountName=<yourAccount>;AccountKey=<yourKey>';
$connectionString = 'DefaultEndpointsProtocol=https;AccountName=browserifytest;AccountKey=AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;AccountName=browserifytest;AccountKey=bzcVslAQI9EaR4R0HN78Rs4rjKotuAvCTto9rRlEcpVtVXt0gxzxv/ky4IQkX3N9xN7iAXLzYWn5Yk+5jYkBLg==';
$tableClient = ServicesBuilder::getInstance()->createTableService($connectionString);

$mytable = 'mytable';
Expand Down
153 changes: 121 additions & 32 deletions src/Blob/BlobRestProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -1661,6 +1661,10 @@ public function createPageBlobFromContentAsync(
$body = Psr7\stream_for($content);
$self = $this;

if (is_null($options)) {
$options = new CreateBlobOptions();
}

$createBlobPromise = $this->createPageBlobAsync(
$container,
$blob,
Expand Down Expand Up @@ -2014,7 +2018,7 @@ private function uploadPageBlobAsync(
return $this->sendConcurrentAsync(
$generator,
Resources::STATUS_CREATED,
$options->getRequestOptions()
$options
);
}

Expand Down Expand Up @@ -3045,13 +3049,16 @@ private function listPageBlobRangesAsyncImpl(
$headers,
$options->getAccessConditions()
);

$headers = $this->addOptionalRangeHeader(
$headers,
$options->getRangeStart(),
$options->getRangeEnd()
);


$range = $options->getRange();
if ($range) {
$headers = $this->addOptionalRangeHeader(
$headers,
$range->getStart(),
$range->getEnd()
);
}

$this->addOptionalHeader(
$headers,
Resources::X_MS_LEASE_ID,
Expand Down Expand Up @@ -3455,16 +3462,20 @@ public function getBlobAsync(
$options = new GetBlobOptions();
}

$getMD5 = $options->getComputeRangeMD5();
$getMD5 = $options->getRangeGetContentMD5();
$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessConditions()
);
$headers = $this->addOptionalRangeHeader(
$headers,
$options->getRangeStart(),
$options->getRangeEnd()
);

$range = $options->getRange();
if ($range) {
$headers = $this->addOptionalRangeHeader(
$headers,
$range->getStart(),
$range->getEnd()
);
}

$this->addOptionalHeader(
$headers,
Expand Down Expand Up @@ -3744,6 +3755,82 @@ public function copyBlobAsync(
$sourceContainer,
$sourceBlob,
Models\CopyBlobOptions $options = null
) {
if (is_null($options)) {
$options = new CopyBlobOptions();
}

$sourceBlobPath = $this->getCopyBlobSourceName(
$sourceContainer,
$sourceBlob,
$options
);

return $this->copyBlobFromURLAsync(
$destinationContainer,
$destinationBlob,
$sourceBlobPath,
$options
);
}

/**
* Copies from a source URL to a destination blob.
*
* @param string $destinationContainer name of the
* destination
* container
* @param string $destinationBlob name of the
* destination
* blob
* @param string $sourceURL URL of the
* source
* resource
* @param Models\CopyBlobFromURLOptions $options optional
* parameters
*
* @return Models\CopyBlobResult
*
* @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
*/
public function copyBlobFromURL(
$destinationContainer,
$destinationBlob,
$sourceURL,
Models\CopyBlobFromURLOptions $options = null
) {
return $this->copyBlobFromURLAsync(
$destinationContainer,
$destinationBlob,
$sourceURL,
$options
)->wait();
}

/**
* Creates promise to copy from source URL to a destination blob.
*
* @param string $destinationContainer name of the
* destination
* container
* @param string $destinationBlob name of the
* destination
* blob
* @param string $sourceURL URL of the
* source
* resource
* @param Models\CopyBlobFromURLOptions $options optional
* parameters
*
* @return \GuzzleHttp\Promise\PromiseInterface
*
* @see http://msdn.microsoft.com/en-us/library/windowsazure/dd894037.aspx
*/
public function copyBlobFromURLAsync(
$destinationContainer,
$destinationBlob,
$sourceURL,
Models\CopyBlobFromURLOptions $options = null
) {
$method = Resources::HTTP_PUT;
$headers = array();
Expand All @@ -3753,49 +3840,51 @@ public function copyBlobAsync(
$destinationContainer,
$destinationBlob
);

if (is_null($options)) {
$options = new CopyBlobOptions();
$options = new CopyBlobFromURLOptions();
}

$sourceBlobPath = $this->getCopyBlobSourceName(
$sourceContainer,
$sourceBlob,
$options
);


if ($options->getIsIncrementalCopy()) {
$this->addOptionalQueryParam(
$queryParams,
Resources::QP_COMP,
'incrementalcopy'
);
}

$headers = $this->addOptionalAccessConditionHeader(
$headers,
$options->getAccessConditions()
);

$headers = $this->addOptionalSourceAccessConditionHeader(
$headers,
$options->getSourceAccessConditions()
);

$this->addOptionalHeader(
$headers,
Resources::X_MS_COPY_SOURCE,
$sourceBlobPath
$sourceURL
);

$headers = $this->addMetadataHeaders($headers, $options->getMetadata());

$this->addOptionalHeader(
$headers,
Resources::X_MS_LEASE_ID,
$options->getLeaseId()
);

$this->addOptionalHeader(
$headers,
Resources::X_MS_SOURCE_LEASE_ID,
$options->getSourceLeaseId()
);

$options->setLocationMode(LocationMode::PRIMARY_ONLY);

return $this->sendAsync(
$method,
$headers,
Expand All @@ -3811,7 +3900,7 @@ public function copyBlobAsync(
);
}, null);
}

/**
* Abort a blob copy operation
*
Expand Down
Loading

0 comments on commit 1923fd4

Please sign in to comment.