Commit Graph

444 Commits

Author SHA1 Message Date
Anton Kolesnyk
c5ddbbc430
Changes around context expiration naming and types (#2033)
This would unblock #2010.

Closes #2032.
Closes #1880.

I know this comes out of the blue, but it seems to me the right change to do. This is a proposal, let me know what you think.

First, I started with the fact that we need to make `CancelWhen()` public.
Then, I realized that I don't like the `CancelWhen()` naming. `CancelAt()` is better?
But `CancelAt()` sounds like an order to do something, not as getter.
So, it should be named `Get...`. `GetCancelWhen()`? `GetCancelAt()`? Sounds strage.

`GetDeadline()` - not bad, bit it is not that clear, what the deadline is.
And I looked at the `WithDeadline()` method. And in comment, the first line is `@brief Create a context with expiration.`.
"Expiration" sounds better explanation for the essense of the "deadline".

So, I went with `GetExpiration()`. I think "Expiration" is also a better name, because should we want to add the method called "bool IsExpired()", it comes naturally using the existing terminology, sounds better than "`IsPastDeadline()`".

Next thing - if we have "`GetExpiration()`", it is strange to have a method called `Get()`. So, we have `WithExpiration()` and `WithValue()`. So, it sounds like the getter should be called `GetValue()`. I did that rename as well.

Then, I looked at "`With...`" method naming. It is a factory method. If for getters we have `Get`, then for factory methods we should have `Create`. So, I renamed `WithExpiration()` and `WithValue()` to `CreateWithExpiration()` and `CreateWithValue()`.

Then I looked at `Context::time_point` typedef. First, in general, if we can avoid public typedefs, it is better, because we don't need to document them and worry if we broke client code when we change them.
Second, it is strange that we use `Azure::DateTime` everywhere, but not in context.

So, I replaced it with `Azure::DateTime`. It is good because it allows us to drop to/from epoch conversions (#1880), and really all that extra dance we do to cast to representation and back to datetime is the ways to stay within legal type casting limits of compiler type declaration, while in reality there isn't much that is happening in the code: `DateTime` is essentially an `int64`, and with all these conversions to epoch time, then to representation and back, compiler does not generate real code, it still operates with that only `int64`.

Why we cast to `DateTime::rep` and back at all? Context stores it as `atomic`, and I am not questioning that. You can't get `std::atomic<DateTime>` today explicitly, so we "extract" representation (`int64`) and store it as `std::atomic<DateTime::rep>`, which is the same thing as `std::atomic_int64`.

-- Update: --
1. "Expiration" => "Deadline" (Jeffrey's request)
2. Added `Context::HasExpiration()` (response to Jinming) // plus, we do have `HasValue()` so why not have `HasDeadline()`.
3. `WithDeadline()`, `WithValue` => Two overloads of `CreateChildContext()` (my own initiative).

-- Update 2: --
`CreateChildContext()` => `WithDeadline()`, `WithValue`

-- Update 3: --
Removed `HasDeadline()`
2021-04-05 21:24:40 +00:00
Victor Vazquez
dfdaf25223
[Core] Refactor RequestFailedException with Http information (#2026)
* KeyVault Exception
2021-04-05 12:11:31 -07:00
Anton Kolesnyk
a7fdea42e6
Introduce Context::Key with pointer comparison speeds (#1988) 2021-04-05 11:26:50 -07:00
Ahson Khan
8095d85e67
Simplify the public surface design of Response<T> for usability. (#1974)
* Simplify the design of Response<T> for usability.

* Revert changes to operation<T> to keep the changes single purpose.

* Update many of the response<T> call sites based on API changes.

* Update all remaining callsites and fix clang formatting.

* Update Response<T> documentation.

* Fix clang formatting.

* Remove status code from the Response<T> public surface area.

* Update the changelog.

* Fix up CL wording and remove commented-out change to operation<T>.

* Fixed test by actually calling a method.

* Fix up key vault test by not taking ownership of raw response.

* Fix call to get status code in test.

* Add new line at end of keyvualt live test file.

* Make a local copy within keyvault pipeline to avoid compilers re-ordering things.

* Make the fixes to the recent keyvault changes.

* Fix key vault pipeline to address ImportKey test failure
2021-04-01 00:50:04 +00:00
Anton Kolesnyk
ddd7a093f4
Move policies to internal (#1985) 2021-03-31 12:56:33 -07:00
JinmingHu
0cd405d064
changelog (#2008) 2021-03-31 14:49:42 +08:00
Anton Kolesnyk
0665efe0fe
unique_ptr Get() => Extract() || Send() || ExtractOrCreate() (#1984) 2021-03-30 10:17:24 -07:00
JinmingHu
b9c5c978ee
refine impl of rename file/directory (#1991)
* fix bug: / was left out in rename source

* refine impl of rename file/directory
2021-03-30 11:58:33 +08:00
JinmingHu
88499ab1b6
fix user-agent (#1990) 2021-03-30 01:35:50 +00:00
Azure SDK Bot
d28d52b058
Increment version for storage releases (#1969)
* Increment package version after release of azure-storage-common

* Increment package version after release of azure-storage-blobs

* Increment package version after release of azure-storage-files-datalake

* Increment package version after release of azure-storage-files-shares

* Revert the ordering change for beta.6.

Co-authored-by: Ahson Khan <ahkha@microsoft.com>
Co-authored-by: Ahson Khan <ahson_ahmedk@yahoo.com>
2021-03-24 02:06:06 +00:00
Ahson Khan
82dd53f3b1
Fix the date in the changelog for storage beta.6 packages using the correct year to avoid auto version bump PR re-ordering it (#1970)
* Fix the date in the changelog for storage beta.6 packages using the correct year to avoid auto version bump PR re-ordering it

* Fix the year for common beta.6

* Fix the CL year for shares beta.6

* Fix the CL year for datalake beta.6
2021-03-24 01:48:00 +00:00
JinmingHu
417dde4144
mint storage beta 9 (#1957) 2021-03-23 10:15:45 +08:00
Kan Tang
0d422b95a0
Remove Type suffix from some enums. (#1951)
* Remove Type suffix from some enums.

* Remove more fields.

* Resolve build issue on Linux.
2021-03-22 23:20:04 +00:00
JinmingHu
c3a9d67d01
rename BlockListTypeOption -> BlockListType (#1945) 2021-03-19 09:54:57 +00:00
Kan Tang
ea2186bee3
Hide unused models. (#1944)
* Hide unused models.

* Resolve comments.
2021-03-19 08:17:05 +00:00
Kan Tang
8fa71e0f31
Remove ShareStats. (#1946) 2021-03-19 07:48:01 +00:00
Kan Tang
de28afadc6
Removed unwanted Share prefix and moved unused models to details. (#1940)
* Removed unwanted Share prefix and moved unused models to details.

* Resolve build issues.

* Resolve comments.

* Access Tier change.

* FileServiceProperties to ShareServiceProperties
2021-03-19 06:59:15 +00:00
JinmingHu
37e5b2ad79
rename Tier -> AccessTier (#1943) 2021-03-19 06:23:35 +00:00
JinmingHu
a66592c99e
Rename some return types and options (#1941)
* rename some return types and options

* fix changelog

* BodyStream reference in blob protocol layer

* PathClient::GetAccessControlList returns PathAccessControlList

* more changelog

* changelog

* move UndeleteBlobContainerResult to _detail
2021-03-19 13:32:26 +08:00
JinmingHu
b88eb6d785
remove public fields from operation<T> (#1939) 2021-03-19 04:10:50 +00:00
JinmingHu
1b316d3b44
Changed BodyStream parameter in upload functions from pointer to refe… (#1938)
* Changed BodyStream parameter in upload functions from pointer to reference

* clang-format
2021-03-19 03:19:37 +00:00
Kan Tang
e360553546
Remove request IDs (#1930)
Co-authored-by: JinmingHu <jinmhu@microsoft.com>
2021-03-18 20:32:40 +08:00
JinmingHu
47c426990b
Removed RequestId from return types (#1931)
* remove request IDs

* changelog

* remove more
2021-03-18 19:51:35 +08:00
Ahson Khan
f0b837d8c6
Update storage datalake CL to group changes to return types together (#1933)
* Update storage datalake CL to group changes to return types together

* Remove DataLake from the return types in CL

* Update CL for file shares to be accurate

* Fix file shares GetProperties breaking changes
2021-03-18 02:12:49 -07:00
Ahson Khan
72c082d98c
Update storage CL to group changes to return types together (#1932) 2021-03-18 06:55:31 +00:00
JinmingHu
9152e3dc33
remove DataLake/Blob/Share from options and result types (#1927) 2021-03-18 05:58:39 +00:00
JinmingHu
5210e8eb0d
revert changes to GetAccessPolicy (#1923) 2021-03-17 03:09:37 +00:00
JinmingHu
5df3596c34
Changed return type of BlobClinet::GetTags to std::map<std::string, std::string> (#1922) 2021-03-17 10:37:12 +08:00
JinmingHu
35b39f7cb1
GetRangeListDiff (#1915) 2021-03-17 02:34:18 +00:00
JinmingHu
64d9356ff6
remove all use of ValuePolicy (#1914) 2021-03-16 09:28:25 -07:00
Kan Tang
f99b214be9
Datalakereturntype (#1916)
* DataLake 'Get' operation return type refine.

* Added minor changes for Get return types in DataLake
2021-03-16 08:53:38 +00:00
Kan Tang
2c369a2c3b
Rename return types of some Get operations in file service. (#1820)
* Renamed file service's get APIs.

* Resolved comments.

* Resolve comments
2021-03-16 08:16:59 +00:00
JinmingHu
7cade913bc
remove struct SecondaryHostReplicaStatus, to simplify context use (#1913)
# Pull Request Checklist

Please leverage this checklist as a reminder to address commonly occurring feedback when submitting a pull request to make sure your PR can be reviewed quickly:

See the detailed list in the [contributing guide](https://github.com/Azure/azure-sdk-for-cpp/blob/master/CONTRIBUTING.md#pull-requests).

- [x] [C++ Guidelines](https://azure.github.io/azure-sdk/cpp_introduction.html)
- [x] Doxygen docs
- [x] Unit tests
- [x] No unwanted commits/changes
- [x] Descriptive title/description
  - [x] PR is single purpose
  - [x] Related issue listed
- [x] Comments in source
- [x] No typos
- [x] Update changelog
- [x] Not work-in-progress
- [x] External references or docs updated
- [x] Self review of PR done
- [x] Any breaking changes?
2021-03-16 07:05:08 +00:00
JinmingHu
9c7d4c61e4
move stuff from _details to _internal for storage-common package (#1912)
closes https://github.com/Azure/azure-sdk-for-cpp/issues/1869


# Pull Request Checklist

Please leverage this checklist as a reminder to address commonly occurring feedback when submitting a pull request to make sure your PR can be reviewed quickly:

See the detailed list in the [contributing guide](https://github.com/Azure/azure-sdk-for-cpp/blob/master/CONTRIBUTING.md#pull-requests).

- [x] [C++ Guidelines](https://azure.github.io/azure-sdk/cpp_introduction.html)
- [x] Doxygen docs
- [x] Unit tests
- [x] No unwanted commits/changes
- [x] Descriptive title/description
  - [x] PR is single purpose
  - [x] Related issue listed
- [x] Comments in source
- [x] No typos
- [x] Update changelog
- [x] Not work-in-progress
- [x] External references or docs updated
- [x] Self review of PR done
- [x] Any breaking changes?
2021-03-16 06:55:13 +00:00
JinmingHu
86c908eeda
fix flaky test failure (#1910) 2021-03-16 06:11:25 +00:00
JinmingHu
100eba49e2
rename return types of some Get operations (#1819) 2021-03-16 12:30:30 +08:00
Victor Vazquez
42a67b1349
Moving GetRawResponseInternal out of public from Operation derived classes (#1890) 2021-03-12 12:31:01 -08:00
Victor Vazquez
ad8528b86d
Fix StartCopyBlobOperation by removing the field - derived classes should not define a member with the same type and name as the base class (#1883)
Remove the raw response from Operation-derived class
2021-03-12 04:44:24 +00:00
Anton Kolesnyk
299b07e190
Changelog: Rephrase to move related entities closer together. (#1874)
* Move changelog entry to correct place

* Reformat breaking changes

* New feature in the right place

* body_stream.hpp

* Backtick

* Add changes made for Context

* More updates

* More updates

Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
2021-03-11 19:47:17 -08:00
Victor Vazquez
825d4f11d5
make poll return const ref to rawResponse (#1875)
* make poll return const ref to rawResponse
2021-03-12 03:18:47 +00:00
Ahson Khan
fc79c5b3ad
Rename header files to match the namespace structure for things nested within Azure::Core. (#1879)
* Rename header files to match the namespace structure for things nested
within Azure::Core.

* Update a header include that was missed.
2021-03-11 16:22:37 -08:00
Ahson Khan
6a1afb9cbe
Moved the Base64Encode() and Base64Decode() functions to be static members of a Convert class within the Azure::Core namespace. (#1870)
* Moved the `Base64Encode()` and `Base64Decode()` functions to be static members of a `Convert` class within the `Azure::Core` namespace.

* Add the class name in the source file for posix.
2021-03-11 12:39:51 -08:00
Rick Winter
7c862e1a51
Switch to return the RawResponse const& (#1852)
* Operation returns a RawResposne const&
2021-03-11 10:59:33 -08:00
Ahson Khan
12475350b2
Changed the static methods 'BodyStream::ReadToCount()' and 'BodyStream::ReadToEnd()' into instance methods. (#1863)
Usability studies found that static methods are generally not as user-friendly as instance methods. Folks new to the SDK have harder time discovering the APIs, they reverse the flow of typing, and the calling code ends up a bit more verbose because you have to spell out the whole namespace and type name when there aren't any using directives.

There doesn't seem to be a strong benefit or feasibility reason to keep these method statics which are typically harder to use and discover.

cc @kyle-patterson
2021-03-11 11:58:33 +00:00
Ahson Khan
84df3cefbc
Make FileBodyStream easy to construct by accepting a file name, and create an internal ParallelFileBodyStream. (#1830)
Alternative to https://github.com/Azure/azure-sdk-for-cpp/pull/1730 which avoids accepting and breaking the `FILE*` abstraction.
2021-03-11 08:39:52 +00:00
Victor Vazquez
c0ce9688d6
fix regression on contex value implementation for Storage (#1862) 2021-03-11 07:53:33 +00:00
Victor Vazquez
23b698f2c6
Move URL to CORE (#1840)
* move url from Core::Http to Core::
2021-03-10 23:29:35 -08:00
Ahson Khan
55fe99a1b1
Revert checked-in connection strings and delete resources. (#1854) 2021-03-10 21:32:03 -08:00
Victor Vazquez
a9c0637e46
Moving Nullable<T> to Azure namespace (#1847)
* Moving Nullable<T> to Azure namespace

* changelog
2021-03-10 18:56:11 -08:00
Victor Vazquez
c7ba56f837
Move http policies to Azure::Core::Http::Policies (#1844)
* Move http policies to Azure::Core::Http::Policies

* update to latest master
2021-03-10 18:55:56 -08:00