From cc8a2770edfbbe2290b751612b9689bd42e2973a Mon Sep 17 00:00:00 2001 From: Stephane Lapointe Date: Wed, 13 Apr 2022 16:52:59 -0400 Subject: [PATCH 1/3] Fixes wrong working directory for dotnet state management sample (#2359) * Wrong working directory for .Net state management sample The working directory for .NET is pointing to `pub_sub` but it should be `state_management`. Signed-off-by: Stephane Lapointe * Removing the word "publisher" which was also unneed Co-authored-by: Mark Fussell --- .../getting-started/quickstarts/statemanagement-quickstart.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daprdocs/content/en/getting-started/quickstarts/statemanagement-quickstart.md b/daprdocs/content/en/getting-started/quickstarts/statemanagement-quickstart.md index af01f1ef6..8c1428d6c 100644 --- a/daprdocs/content/en/getting-started/quickstarts/statemanagement-quickstart.md +++ b/daprdocs/content/en/getting-started/quickstarts/statemanagement-quickstart.md @@ -285,7 +285,7 @@ git clone https://github.com/dapr/quickstarts.git In a terminal window, navigate to the `order-processor` directory. ```bash -cd pub_sub/csharp/sdk/order-processor +cd state_management/csharp/sdk/order-processor ``` Recall NuGet packages: @@ -414,7 +414,7 @@ Install the dependencies: mvn clean install ``` -Run the `order-processor` publisher service alongside a Dapr sidecar. +Run the `order-processor` service alongside a Dapr sidecar. ```bash dapr run --app-id order-processor --components-path ../../../components -- java -jar target/order-processor-0.0.1-SNAPSHOT.jar From 89eb035461e3e9be912e7f966debc6f9a6d903ce Mon Sep 17 00:00:00 2001 From: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Date: Fri, 15 Apr 2022 18:38:23 -0500 Subject: [PATCH 2/3] [state management] Update docs around transactional operations (#2372) * clarify transactional operations in docs Signed-off-by: Hannah Hunter * Added some more details for clarity * updates per Mark Signed-off-by: Hannah Hunter * remove en from link Signed-off-by: Hannah Hunter * ignore links attempt Signed-off-by: Hannah Hunter Co-authored-by: Mark Fussell --- .../content/en/contributing/codespaces.md | 4 +++- .../state-management-overview.md | 12 +++++++--- .../content/en/reference/api/state_api.md | 22 +++++++++++++------ 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/daprdocs/content/en/contributing/codespaces.md b/daprdocs/content/en/contributing/codespaces.md index 993f3e2bd..111f04d9b 100644 --- a/daprdocs/content/en/contributing/codespaces.md +++ b/daprdocs/content/en/contributing/codespaces.md @@ -46,4 +46,6 @@ git reset --hard ``` ## Related links -- [GitHub documentation](https://docs.github.com/en/github/developing-online-with-codespaces/about-codespaces) + +- [GitHub documentation](https://docs.github.com/github/developing-online-with-codespaces/about-codespaces) + diff --git a/daprdocs/content/en/developing-applications/building-blocks/state-management/state-management-overview.md b/daprdocs/content/en/developing-applications/building-blocks/state-management/state-management-overview.md index d6c486580..93a42e4e9 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/state-management/state-management-overview.md +++ b/daprdocs/content/en/developing-applications/building-blocks/state-management/state-management-overview.md @@ -66,11 +66,17 @@ With the HTTP API, you can set content type via URL query parameter `metadata.co With the gRPC API, you can set content type by adding key/value pair `"contentType" : ` to the request metadata. -### Bulk operations +### Multiple operations -Dapr supports two types of bulk operations: **bulk** or **multi**. You can group several requests of the same type into a bulk (or a batch). Dapr submits requests in bulk operations as individual requests to the underlying data store. In other words, bulk operations are not transactional. On the other hand, you can group requests of different types into a multi-operation, which is then handled as an atomic transaction. +Dapr supports two types of mult-read or multi-write operations: **bulk** or **transactional**. Read the [API reference]({{< ref state_api.md >}}) to learn how use bulk and multi options. -Read the [API reference]({{< ref state_api.md >}}) to learn how use bulk and multi options. +#### Bulk read operations + +You can group multiple read requests into a bulk (or batch) operation. In the bulk operation, Dapr submits the read requests as individual requests to the underlying data store, and returns them as a single result. + +#### Transactional operations + +You can group write, update and delete operations into a request, which are then handled as an atomic transaction. The request will succeed or fail as a transactional set of operations. ### State encryption Dapr supports automatic client encryption of application state with support for key rotations. This is supported on all Dapr state stores. For more info, read the [How-To: Encrypt application state]({{< ref howto-encrypt-state.md >}}) topic. diff --git a/daprdocs/content/en/reference/api/state_api.md b/daprdocs/content/en/reference/api/state_api.md index 375b775ab..011d4d595 100644 --- a/daprdocs/content/en/reference/api/state_api.md +++ b/daprdocs/content/en/reference/api/state_api.md @@ -443,9 +443,9 @@ POST http://localhost:3500/v1.0-alpha1/state/myStore/query?metadata.partitionKey ## State transactions -Persists the changes to the state store as a multi-item transaction. +Persists the changes to the state store as a [transactional operation]({{< ref "state-management-overview.md#transactional-operations" >}}). -> This operation depends on a state store component that supports multi-item transactions. +> This API depends on a state store component that supports transactions. Refer to the [state store component spec]({{< ref "supported-state-stores.md" >}}) for a full, current list of state stores that support transactions. @@ -481,20 +481,28 @@ POST http://localhost:3500/v1.0/state/myStore/transaction?metadata.contentType=a Field | Description ---- | ----------- -`operations` | A JSON array of state operation -`metadata` | (optional) The metadata for transaction that applies to all operations +`operations` | A JSON array of state `operation` +`metadata` | (optional) The `metadata` for the transaction that applies to all operations -Each state operation is comprised with the following fields: +All transactional databases implement the following required operations: -Field | Description +Operation | Description +--------- | ----------- +`upsert` | Adds or updates the value +`delete` | Deletes the value + +Each operation has an associated `request` that is comprised of the following fields: + +Request | Description ---- | ----------- `key` | State key `value` | State value, which can be any byte array `etag` | (optional) State ETag -`metadata` | (optional) Additional key-value pairs to be passed to the state store +`metadata` | (optional) Additional key-value pairs to be passed to the state store that apply for this operation `options` | (optional) State operation options; see [state operation options](#optional-behaviors) #### Examples +The example below shows an `upsert` operation for `key1` and a `delete` operation for `key2`. This is applied to the partition named 'planet' in the state store. Both operations either succeed or fail in the transaction. ```shell curl -X POST http://localhost:3500/v1.0/state/starwars/transaction \ From 381ede8146bbbf561b8cb5a604f300422127e405 Mon Sep 17 00:00:00 2001 From: moreyhat Date: Fri, 15 Apr 2022 17:44:41 -0700 Subject: [PATCH 3/3] Fixed typo in security concept doc (#2374) Signed-off-by: moreyhat Co-authored-by: Yaron Schneider --- daprdocs/content/en/concepts/security-concept.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/concepts/security-concept.md b/daprdocs/content/en/concepts/security-concept.md index 9080dd399..8f3fb26e1 100644 --- a/daprdocs/content/en/concepts/security-concept.md +++ b/daprdocs/content/en/concepts/security-concept.md @@ -138,7 +138,7 @@ By default Dapr doesn't transform the state data from applications. This means D However application state often needs to get encrypted at rest to provide stronger security in enterprise workloads or regulated environments and Dapr does provide automatic client side state encryption based on AES256. Read [How-To: Encrypt application state]({{< ref howto-encrypt-state.md >}}) for more details. -## Dapr Runtrime state +## Dapr Runtime state Importantly the Dapr runtime does not store any data at rest, meaning that Dapr runtime has no dependency on any state stores for its operation and can be considered stateless. # Using security capabilies in an example application