Commit Graph

371 Commits

Author SHA1 Message Date
vinayada1 949c64bed6 fix comment 2021-02-10 15:34:31 -08:00
vinayada1 b1f93047de fix review comments 2021-02-10 14:57:52 -08:00
vinayada1 0e2b802f7a update proto files from dapr runtime 2021-02-10 11:17:09 -08:00
vinayada1 6b7db7cf10 read binary data 2021-02-10 11:11:13 -08:00
vinayada1 bb891fa14f
Merge pull request #580 from dapr/merge-release-rc5
Merge release-1.0.0 into master after rc5
2021-02-03 15:29:20 -08:00
vinayada1 a98f0e66d7 Merge branch 'release-1.0.0' into master 2021-02-03 15:20:37 -08:00
Ryan Nowak 55e0dba8dd
Make Actors unit testable (#576)
Fixes:  #574

Changes ActorHost constructor to be public again. Now the state manager
and http interactor are set via properties. This means that code in unit
tests won't be able to cover the methods that interact with timers or
reminders - however this was already the case. Testing state management
is covered by replacing the `IActorStateManager` with a mock.

Logged an issue to improve this.

Also added validation. If you try to use something that's not fully
initialized it will result in an exception with a meaningful message
instead of a null reference.

Also skips tests that are failing due to #573. We know the cause of why
these are failing, and these tests have not been stable since they were
introduced. Failing additional CI builds is not giving us new
information.
2021-02-01 11:47:02 -08:00
vinayada1 7f9d23cdf5
fixes for getting the samples to work (#570)
* fixes for getting the samples to work

* add ut
2021-01-29 18:40:23 -08:00
Ryan Nowak aa41915e38
Update protobuf files (#567) 2021-01-29 10:29:14 -08:00
vinayada1 a4f6f041bc
Merge into release (#565)
*Merge master into release branch

Co-authored-by: Ryan Nowak <nowakra@gmail.com>

Co-authored-by: Ryan Nowak <nowakra@gmail.com>
Co-authored-by: Carlos Mendible <cmendible@gmail.com>
Co-authored-by: Arghya Sadhu <arghya88@gmail.com>
Co-authored-by: Per Ökvist <perokvist@users.noreply.github.com>
Co-authored-by: Sander Molenkamp <a.molenkamp@gmail.com>
Co-authored-by: LukePammant <Luke.pammant@gmail.com>
2021-01-27 14:46:35 -08:00
vinayada1 a2ed096b79
API to set DAPR_API_TOKEN (#558)
* API to set DAPR_API_TOKEN

Co-authored-by: Ryan Nowak <nowakra@gmail.com>
2021-01-27 13:39:44 -08:00
Ryan Nowak 1ccbacc9ed
Add raw API for using bindings with non-text data (#564)
* Add raw API for using bindings with non-text data

Fixes: #560

This change adds some new data types and a new overload of
`InvokeBindingAsync` that can work with raw data (non-text) as bytes.

* PR feedback
2021-01-27 09:46:37 -08:00
Ryan Nowak b00c02f320
Throw DaprException for errors in DaprClient (#561)
* Unify DaprException classes

We have two classes called DaprException.

It makes way more sense for us to have DaprException in the Dapr.Client
project, and it also makes sense for Dapr.Actors to reference
Dapr.Client (it did not for some reason).

There's some additional cleanup of code related to
JsonSerializerOptions. The Actors code was not referencing the 5.0.0
version of the package, and so it's now got access to some new stuff,
so we could remove a polyfill.

* Throw DaprException for errors

Fixes: #516

This updates all of the locations in DaprClient that handle networking
or serialization to throw DaprException instead of the underlying
exception type. This allows for simpler error handling.

* Add one more unit test
2021-01-26 20:05:17 -08:00
Ryan Nowak 8a7bac13b3
Add IDisposable to DaprClient (#563)
Fixes: #559

This change adds disposable support to DaprClient, and updates samples
to dispose it.

I didn't update tests because there are literally hundreds of
non-find-and-replacable cases, and we're not actually doing networking
in our tests so it won't cause an issue.
2021-01-26 15:45:01 -08:00
Ryan Nowak 9ca4a43cc7
Remove automatic protobuf conversion (#557)
Fixes: #442

We're making it absolutely clear which methods do JSON (most of them)
and which do gRPC. We have the ability to do both 'raw' functionality
and optimized paths for JSON+HTTP and gRPC+Protobuf for invoke. We're
not going to add 'raw' or Protobuf support for other building blocks
until there's a specific use case.

For the most part the functionality that's being removed here isn't used
anymore since that was part of the invoke changes.
2021-01-22 17:05:04 -08:00
Ryan Nowak 9748ca0a82
Simplify service invocation APIs (#555)
Fixes: #549

This change mixes up the service invocation APIs to reflect some changes
that are coming down the pipe in dapr/dapr#2683.

We're now using HTTP's semantics and JSON for the main functionality in
`InvokeMethodAsync`. This means that the error handling is simplified
and base on HTTP's status codes rather than trying to abstract over HTTP
and gRPC's different error models. This also means that we're free to
expose HttpRequestMessage and related types in the API because it's no
longer an abstraction.

You can still use `InvokeMethodAsync` to invoke gRPC services, but you
will get a status code in the response, and it will expect JSON, etc,
similar to how gRPC gateway works.

In addition to that we're added `InvokeMethodGrpcAsync` for cases where
you really want *gRPC's* semantics. These methods do Protobuf
serialization, as is a natural choice for gRPC. I do not recommend using
this approach to invoke HTTP services.

---

I also mad updates and improvments to various infrastructure where
necessary (like InvocationException). Also, the gRPC sample in the repo
now uses the new `InvokeMethodGrpcAsync` APIs.
2021-01-22 16:28:20 -08:00
Ryan Nowak 24367536fb
Add IActorProxyFactory to DI (#556)
* Add IActorProxyFactory to DI

Fixes: #532

This change adds IActorProxyFactory to DI when used with ASP.NET Core,
and makes it also available as a property on the Actor base class. This
way if you've configured the ActorRuntimeOptions with your JSON
settings, its easy to have them picked up in Actors client use cases as
well.

This doesn't quite go all the way to unifying the settings with
DaprClient - we don't want to make a change that disruptive this close
to release.

* Fix registration and add test
2021-01-22 16:24:47 -08:00
vinayada1 3ab5e7cde3
handle empty etag (#553)
* handle empty etag

Co-authored-by: Ryan Nowak <nowakra@gmail.com>
2021-01-22 10:24:06 -08:00
Carlos Mendible 1a51570aa6
DaprClient: Implementing GetBulkSecretAsync (#511) 2021-01-21 15:35:24 -08:00
Ryan Nowak 02ddbdf3cd
Add troubleshooting guide for pub/sub (#547) 2021-01-20 11:25:49 -08:00
Ryan Nowak f6aec35b9b
Add HttpClient support for Dapr service invocation (#544)
- Adds a new message handler for HttpClient interop
- Adds an easy way to create HttpClient instances
- A bunch of sample cleanup/polish/simplification

The main thing here is the added ability to interop with HttpClient. We'll be making some future changes to the service invocation APIs in DaprClient to address dapr/dapr#2342 since that issues greatly simplifies the interface we're dealing with.

Fixes: #526
2021-01-17 16:22:45 -08:00
vinayada1 7799c9f130
do not swallow all exceptions (#531)
* do not swallow all exceptions



Co-authored-by: Ryan Nowak <nowakra@gmail.com>
Co-authored-by: Per Ökvist <perokvist@users.noreply.github.com>
Co-authored-by: Sander Molenkamp <a.molenkamp@gmail.com>
2021-01-14 10:59:49 -08:00
vinayada1 f39fb4444c
fix data contract serialization issue (#543)
* fix data contract serialization issue

* remove unwanted code

* remove unused code
2021-01-13 14:43:55 -08:00
LukePammant 2b70a07909
Allow customizations of JsonSerializerOptions (#379)
* Documentation/comment fixes

* Add customizable JsonSerializerOptions for actors

- Added ability to set or customize the ActorRuntime's JsonSerializerOptions
- Added ability to set or customize the ActorClient's JsonSerializerOptions

* Fix unit test helper for BadStartup

* Add ActorProxy JsonSerializerOptions tests

* Add unit tests for RuntimeOptions and ProxyOptions

* Made fixes requested by Ryan Nowak

- Renamed ActorProxyTests to be more explicit about their purpose
- Added more ActorProxyTests to account for all static Create overloads
- Added explicit JsonSerializerOptions checks in tests
2021-01-13 12:56:39 -08:00
vinayada1 ac7e20e070
Fix the ArgumentNull exception (#537)
* Fix the ArgumentNull exception



Co-authored-by: Sander Molenkamp <a.molenkamp@gmail.com>
Co-authored-by: Ryan Nowak <nowakra@gmail.com>
2021-01-12 09:16:58 -08:00
vinayada1 4a193ec1ac
add metadata option to publish api (#542) 2021-01-12 09:05:52 -08:00
Ryan Nowak 0d772db882
Replace IDictionary<> with IReadOnlyDictionary<> (#541)
Fixes: #395

This change uses the IReadOnlyDictionary<> interface type where
possible, in particularly where we accept metadata. This allows the use
of the immutable collection types as parameters, as well as communicates
the contract - the SDK will read the metadata but not write to it. This
is helpful, because it communicates clearly to the user that they can
create a shared metadata collection instance and reuse them across
calls.
2021-01-11 14:48:24 -08:00
Ryan Nowak 11a3d25f7b Remove unused azure-pipelines.yml 2021-01-11 14:39:47 -08:00
Ryan Nowak 1ea76f1bfe Remove extra .sln files and just use one
These are just extra maintenance. The root cause of this regression is
that we didn't add the tests to all of the right solutions. Life is
simpler if we just use one. The `dotnet` commands already do the right
thing.
2021-01-11 14:39:47 -08:00
Ryan Nowak 0632ea8e81 Fix broken test
For some reason this project isn't being run by the CI
2021-01-11 14:39:47 -08:00
Ryan Nowak 5e0b5750fb
Remove GetAllStateNamesAsync (#536)
Fixes: #53

This API was intended to query the state store for all existing state
entries for the actor. However support for this in the dapr runtime has
not be implemented. We're removing this API to avoid confusion since
it does not behave as expected. We can revisit this in the future based
on feedback.
2021-01-11 11:21:16 -08:00
Sander Molenkamp afc87abe7d
Replace ValueTask with Task (#539) 2021-01-11 10:27:40 -08:00
Ryan Nowak fdc35bbbaf
Do not write exception to response body (#535)
Fixes: #410

This change removes code that would write the exception message and call
stack to the response body when a non-remoting invoke is used. While
this kind of thing can be helpful for debugging, the best thing to do is
actually just let the exception bubble. This allows users to use the
ASP.NET Core error handling features that are much richer and have
security related guidance built-in.
2021-01-08 14:33:25 -08:00
vinayada1 9413ed3f99
fix exception with ActorProxy (#530)
* fix exception with ActorProxy

This reverts commit b599b57f65.
2021-01-08 13:57:43 -08:00
Per Ökvist 50dec32e8a
state operation overload with meta #412 (#470)
* state operation overload with meta #412

* added metadata to bulk state

* getStateAndEtag with metadata test

* an -> a keyvalue pair

* Added GetBulkStateAsync_ValidateRequest

* update

* update

* removed backup files

* metadata docs

* state store metadata docs

Co-authored-by: Ryan Nowak <nowakra@gmail.com>
2021-01-08 11:45:34 -08:00
Ryan Nowak 3a03ada243
Use Startup to register Actors (#533)
Fixes: #434

This change introduces new APIs for registering Actors DI and with
the HTTP pipeline based on the ASP.NET Core Startup.cs model. This
replaces `UseActors()` in Program.cs and delivers better integration
between the ASP.NET Core framework and Actors.

The bug that motivated this change was that the actors HTTP handlers
were separate from the application's main routing table. This meant that
certain routing patterns were totally broken (such as Blazor Server)
when used in the same project as actors. There was no real way to fix
this without a change in how we register the framework to make it more
consistent with other features that build on ASP.NET Core.
2021-01-08 11:30:07 -08:00
Arghya Sadhu 67d59502bf
rename name to bindingName for API consistency (#504)
Signed-off-by: Arghya Sadhu <arghya88@gmail.com>

Co-authored-by: vinayada1 <28875764+vinayada1@users.noreply.github.com>
2021-01-05 13:49:37 -08:00
vinayada1 c650955f75
rename InvokeAsync to InvokeMethodAsync (#529) 2021-01-05 13:41:41 -08:00
Carlos Mendible 9fd1900e59
Fixing 502 (#503)
Co-authored-by: Ryan Nowak <nowakra@gmail.com>
2021-01-04 17:50:52 -08:00
Ryan Nowak 776156298e
Apply linting suggestions (#492)
We've had a list of linting-related messages piling up for a while now.
This change bulk-applies these suggestions with usually relate to
simplification or use or newer language features like ??=

The only changes I did manually here are:

    Removing some usage of Task.GetAwaiter().GetResult() where it was
    just laziness
    Removing some dead code in methods and parameters of internal APIs.
2021-01-04 17:35:57 -08:00
Ryan Nowak d54419526f
Add .NET 5 testing (#458)
DO NOT MERGE - just testing this against the RC. We'll merge this
once 5 is a full release.
2021-01-04 11:13:35 -08:00
vinayada1 39c6d8ca7d
Merge release-1.0.0 into master (#518)
* update proto files (#507)

* fix samples (#509)

* fix docs (#515)
2020-12-18 11:12:39 -08:00
Ryan Nowak 490e522716
Update actor docs for 0.12 changes (#501)
Co-authored-by: vinayada1 <28875764+vinayada1@users.noreply.github.com>
2020-12-18 10:37:05 -08:00
vinayada1 191fd659a9
fix docs (#515) 2020-12-17 14:55:49 -08:00
vinayada1 e45fe3e481
fix samples (#509) 2020-12-15 15:03:57 -08:00
vinayada1 038cf79ebd
update proto files (#507) 2020-12-14 16:00:28 -08:00
vinayada1 1edfdf447b
Change package versioning from preview to rc (#506) 2020-12-14 15:38:27 -08:00
vinayada1 d694698b4f
add sample for state apis with etags (#498)
* add sample for state apis with etags

* fixed review comments
2020-12-07 14:45:40 -08:00
vinayada1 eeaf42ff22
Timers (#485)
* init commit

* working changes

* fix review comments

Co-authored-by: Ryan Nowak <nowakra@gmail.com>
2020-12-07 12:52:07 -08:00
Carlos Mendible 28bcbf9e3b
Resurrecting Secret Store Configuration Provider (#465)
* Resurrecting secret store extension

* Resurrecting secret store extension

* Trigger Build
2020-12-07 10:43:45 -08:00