Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#906 -Added methods in status API supports for saving and reading binary data #1116

Merged
merged 111 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
9952004
Added methods in status API supports for direct storage and reading o…
divzi-p Jun 29, 2023
37b5f7d
Changed SaveStateByteAsync,TrySaveStateByteAsync to use ReadOnlyMemor…
divzi-p Aug 26, 2023
5ffb173
[Workflow] Fix issue with ignored external event payload (#1119)
cgillum Jul 6, 2023
f3d6405
Rev'ed Grpc.Net.Client PackageReference version for Dapr dotnet-sdk (…
MonkeyTennis Jul 18, 2023
b8110ec
Add support to DAPR_HTTP_ENDPOINT and DAPR_GRPC_ENDPOINT env. (#1124)
artursouza Jul 18, 2023
2065570
Add cascading metadata (#1128)
AaronCrawfis Jul 18, 2023
34241a6
remove invalid code line (#1127)
hhunter-ms Jul 18, 2023
d5131bc
adding get actor reminder API in docs (#1113)
shivamkm07 Jul 21, 2023
d5959c2
Inroduce OnActorMethodFailedAsync virtual method for overriding (#1014)
vlardn Aug 16, 2023
b067162
Remove .NET Core 3.1 support and standardize on .NET 6 (#1045)
yash-nisar Aug 24, 2023
b99b4b1
Proof-of-concept serialization of advanced JSON types, records (#1073)
onionhammer Sep 5, 2023
a9d4b94
Type change from byte[] -> ReadOnlyMemory<byte>
divzi-p Jan 9, 2024
a0d1d37
Changed method names to sync with naming conventions
divzi-p Jan 13, 2024
132f822
Implememted review comments to add proper comments and remove comment…
divzi-p Apr 30, 2024
6ec96a6
Removed commented code.
divzi-p Apr 30, 2024
1020e9f
Updating workflow collection to allow for use of API Token validation…
RyanLettieri Sep 7, 2023
09a855d
set dapr-api-token to healthz requests when needed (#1145)
famarting Sep 7, 2023
254b399
Adding in new test for parallel raise events in workflow (#1155)
RyanLettieri Oct 6, 2023
eb827d6
Consolidate C# language version to 10. (#1180)
philliphoff Nov 13, 2023
c4eb2f1
Update actor reminder example. (#1179)
philliphoff Nov 13, 2023
97cbd21
Initial implementation for workflow log tracing (#1176)
RyanLettieri Nov 14, 2023
703340b
.NET 8 Support (#1188)
philliphoff Nov 15, 2023
8d7d72b
Modify broken links in README (#1190)
MregXN Nov 28, 2023
254c3d7
Added unit test to prove out enum serialization working as expected d…
WhitWaldo Nov 28, 2023
dc45a01
modify readme (#1192)
MregXN Nov 29, 2023
89d2c6d
Updates Dapr to 1.12 in GitHub actions itest (#1185)
JoshVanL Nov 29, 2023
423bc5d
Add holopin.yml config (#1147)
marcduiker Nov 29, 2023
a51c12c
Correct spelling of "identified" (#1159)
frankbuckley Nov 29, 2023
1dd74e7
Adding cancel to workflow example and updating api references to beta…
RyanLettieri Nov 29, 2023
6b3970f
Enable `CancellationToken` for non-remoting actor implementations (#1…
philliphoff Jan 6, 2024
3f924a1
Fix example dotnet-actors-howto.md (#1218)
henrikkarstrom Jan 6, 2024
48550c4
Update _index.md by fixing broken link (#1221)
farshaddavoudi Jan 6, 2024
a737137
use daprWorkflowClient (#1212)
MregXN Jan 8, 2024
d8376d8
Actor State TTL (#1164)
JoshVanL Jan 8, 2024
a41915c
Added documentation detailing how serialization works using the DataC…
WhitWaldo Jan 26, 2024
3a05d53
Weakly typed actor polymorphic and null responses (#1214)
RemcoBlok Jan 31, 2024
f7a66d8
Implementing Cryptography building block in .NET (#1217)
WhitWaldo Feb 14, 2024
38bc34b
Handle the case where appid contains at least one upperletter (#1233)
TWEESTY Feb 16, 2024
7bf1fae
Enable vault name mapping and error suppression (#1231)
jamesmcroft Feb 16, 2024
59a9be0
Add overload to deserialize GetBulkStateAsync item values (#1173)
WhitWaldo Feb 16, 2024
81ab50c
Use TryAddSingleton() for registering services. (#1238)
philliphoff Feb 16, 2024
61fd4bc
Source generated actor clients (#1165)
philliphoff Feb 16, 2024
e1a42d8
Merge 1.13 release branch back to master (#1247)
philliphoff Mar 8, 2024
38c32de
Updated to reflect latest guidance to register endpoints via top-leve…
WhitWaldo Apr 8, 2024
4fbfe71
Adds an option to set a timeout for service invocation (#1252)
elena-kolevska Apr 8, 2024
2986d41
Updating Workflow XML comment for accuracy (#1260)
WhitWaldo Apr 8, 2024
e0d359b
Updated property on type to reflect the fact that it can return a nul…
WhitWaldo Apr 8, 2024
a96cee4
#1239 remove polyfill packages (#1258)
thompson-tomo Apr 8, 2024
11dfdcd
Updated .github/holopin.yml. Fixes #1270 (#1276)
cmendible Apr 23, 2024
953e041
Update README.md (#1284)
m3nax May 13, 2024
7c50d04
restored missing title in readme (#1286)
m3nax May 14, 2024
10a5d32
Fixed badge broken links (#1290)
m3nax May 22, 2024
ba0d11b
Removed non-existent project, correct path of the generator project. …
m3nax Jun 5, 2024
9ad3692
Added overload for DaprClient DI registration (#1289)
WhitWaldo Jun 25, 2024
d2540ce
Merge `release-1.13` back into `master` (#1285)
philliphoff Jun 25, 2024
20fe0cb
Samples - Add k8s deployment yaml to DemoActor sample (#1308)
m3nax Jun 26, 2024
d4531ba
Added ActorReference creation from the ActorBase class informations (…
m3nax Jun 26, 2024
8479a9d
Added overload to support SDK supplying query string on invoked URL (…
WhitWaldo Jul 3, 2024
a3d476a
fix (#1329)
hhunter-ms Jul 23, 2024
b866eeb
link to non-dapr endpoint howto (#1335)
hhunter-ms Aug 9, 2024
da74dac
Added unit test to prove out concern raised on Discord
WhitWaldo Sep 13, 2024
89e271c
Removed unused using
WhitWaldo Sep 19, 2024
aa4cfed
Merge 1.14 release branch back into `master`. (#1337)
philliphoff Aug 22, 2024
8cc47f5
Added missing workflow status branch (#1348)
WhitWaldo Sep 13, 2024
f5129f9
Consolidated version of coverlet.msbuild, coverlet.collector, xunit, …
m3nax Jun 26, 2024
d3421bf
Added unit test to validate that headers aren't being stripped off re…
WhitWaldo Oct 7, 2024
20bc8f5
Fixed spelling typo
WhitWaldo Oct 7, 2024
fb42f81
Added fix to handle null return values
WhitWaldo Oct 6, 2024
62765d7
Removed unnecessary null check
WhitWaldo Oct 11, 2024
d126e1a
Removed deprecated methods from DaprClient and tests as well as unuse…
WhitWaldo Sep 3, 2024
6f84f17
Removed unused (and invalid) reference
WhitWaldo Sep 3, 2024
781fe32
Removed E2E workflow test as it validated DaprClient and the function…
WhitWaldo Oct 11, 2024
906f44e
Adding instance-based CreateInvokableHttpClient (#1319)
WhitWaldo Oct 14, 2024
a1a6f9c
Fixed security advisory updates across dependencies (transitive and d…
WhitWaldo Oct 15, 2024
dd1bcd0
Removes floating classes and introduces Dapr.Common project (#1365)
WhitWaldo Oct 16, 2024
0c1944b
Extracted Protos out to common project (#1367)
WhitWaldo Oct 16, 2024
3209c91
Improvement of the dotnet-contributing files (#1330)
Shubhdeep02 Oct 16, 2024
77dfe1e
Support case insensitive cloudevent payloads and forward cloudevent p…
IliasP91 Oct 17, 2024
ab6f508
Updating actor serialization documentation (#1371)
WhitWaldo Oct 18, 2024
47951b7
Prioritize retrieval of environment variables from IConfiguration ins…
WhitWaldo Oct 18, 2024
04d47e6
cleanup: Removed Serilog nuget from Directory.Packages.props (#1376)
m3nax Oct 22, 2024
cde2f0f
Removed sample folder (#1375)
m3nax Oct 22, 2024
1e727dd
Remove unused variables (#1314)
RafaelJCamara Oct 24, 2024
34d16ef
Remove unused using statements. (#1313)
RafaelJCamara Oct 24, 2024
094d757
Incremental source generator for actors (#1334)
m3nax Oct 28, 2024
fcfb7e1
Add .NET client for Dapr Jobs API (#1384)
WhitWaldo Nov 1, 2024
7b1e898
Updated prereqs to specify .NET 6 and .NET 8 in v1.15 (#1398)
WhitWaldo Nov 1, 2024
a0a95d9
Refactor DaprWorkflowClientBuilderFactory and WorkflowRuntimeOptions …
humandigital-ruud Nov 4, 2024
180f622
Fix for DI registration not completing as expected (#1386)
WhitWaldo Nov 5, 2024
6964033
Add .NET client for pub/sub support - streaming subscriptions (#1381)
WhitWaldo Nov 5, 2024
ec505e2
ci: set fail-fast to false (#1405)
mikeee Nov 12, 2024
180447c
Added async operations workflow sample (#1394)
WhitWaldo Nov 12, 2024
d71f398
Added workflow example: Fan out/fan in (#1396)
WhitWaldo Nov 13, 2024
c0def6c
Added workflow sample: Sub-workflows (#1395)
WhitWaldo Nov 14, 2024
6d75abf
Added workflow sample: Task chaining (#1387)
WhitWaldo Nov 14, 2024
d7967c0
Added workflow sample: Monitor (#1388)
WhitWaldo Nov 14, 2024
aa4f494
Added workflow example: External interaction (#1389)
WhitWaldo Nov 18, 2024
3c4271a
Optional DI lifecycle change (#1408)
WhitWaldo Nov 21, 2024
be460e4
Additional lifecycle registration changes (#1410)
WhitWaldo Nov 24, 2024
132d072
Preserve comparer of the original dictionary from ConfigurationProvid…
tomhreb Nov 30, 2024
7965359
Bug/476 multiple methods per interface with JSON serialization doesn´…
paule96 Dec 3, 2024
47458cd
Support .NET 9 (#1404)
WhitWaldo Dec 4, 2024
7ff85d3
update .net workflow docs to stable (#1418)
hhunter-ms Dec 4, 2024
1b7e65c
FIX: Actor source generator generates invalid code for generic interf…
m3nax Dec 5, 2024
14c095e
added system.text and fixed bull check in test
divzi-p Dec 10, 2024
1d5cc35
Merge branch 'master' into feature_upgrade_statusapi_1.0.0
WhitWaldo Dec 11, 2024
f4810f4
Merge branch 'master' into feature_upgrade_statusapi_1.0.0
WhitWaldo Dec 11, 2024
9c2a061
Fixed two merge misses
WhitWaldo Dec 11, 2024
eeaa842
Merge remote-tracking branch 'divzi-p/feature_upgrade_statusapi_1.0.0…
WhitWaldo Dec 11, 2024
f72eadf
Fixed errors in unit tests
WhitWaldo Dec 11, 2024
6e98a19
Removed duplicate method
WhitWaldo Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/Client/StateManagement/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Copyright 2021 The Dapr Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,8 @@ class Program
new StateStoreExample(),
new StateStoreTransactionsExample(),
new StateStoreETagsExample(),
new BulkStateExample()
new BulkStateExample(),
new StateStoreBinaryExample()
};

static async Task<int> Main(string[] args)
Expand Down
47 changes: 47 additions & 0 deletions examples/Client/StateManagement/StateStoreBinaryExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Text;
using Dapr.Client;
using System.Threading.Tasks;
using System.Threading;
using Google.Protobuf;

namespace Samples.Client
{
public class StateStoreBinaryExample : Example
{

private static readonly string stateKeyName = "binarydata";
private static readonly string storeName = "statestore";

public override string DisplayName => "Using the State Store with binary data";

public override async Task RunAsync(CancellationToken cancellationToken)
{
using var client = new DaprClientBuilder().Build();

var state = "Test Binary Data";
// convert variable in to byte array
var stateBytes = Encoding.UTF8.GetBytes(state);
await client.SaveByteStateAsync(storeName, stateKeyName, stateBytes.AsMemory(), cancellationToken: cancellationToken);
Console.WriteLine("Saved State!");

var responseBytes = await client.GetByteStateAsync(storeName, stateKeyName, cancellationToken: cancellationToken);
var savedState = Encoding.UTF8.GetString(ByteString.CopyFrom(responseBytes.Span).ToByteArray());

if (savedState == null)
{
Console.WriteLine("State not found in store");
}
else
{
Console.WriteLine($"Got State: {savedState}");
}

await client.DeleteStateAsync(storeName, stateKeyName, cancellationToken: cancellationToken);
Console.WriteLine("Deleted State!");
}


}
}
74 changes: 74 additions & 0 deletions src/Dapr.Client/DaprClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,80 @@ public abstract Task SaveStateAsync<TValue>(
IReadOnlyDictionary<string, string> metadata = default,
CancellationToken cancellationToken = default);


/// <summary>
/// Saves the provided <paramref name="binaryValue" /> associated with the provided <paramref name="key" /> to the Dapr state
/// store
/// </summary>
/// <param name="storeName">The name of the state store.</param>
/// <param name="key">The state key.</param>
/// <param name="binaryValue">The binary data that will be stored in the state store.</param>
/// <param name="stateOptions">Options for performing save state operation.</param>
/// <param name="metadata">A collection of metadata key-value pairs that will be provided to the state store. The valid metadata keys and values are determined by the type of state store used.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> that can be used to cancel the operation.</param>
/// <returns>A <see cref="Task" /> that will complete when the operation has completed.</returns>
public abstract Task SaveByteStateAsync(
divzi-p marked this conversation as resolved.
Show resolved Hide resolved
string storeName,
string key,
ReadOnlyMemory<byte> binaryValue,
StateOptions stateOptions = default,
IReadOnlyDictionary<string, string> metadata = default,
CancellationToken cancellationToken = default);

/// <summary>
///Saves the provided <paramref name="binaryValue" /> associated with the provided <paramref name="key" /> using the
/// <paramref name="etag"/> to the Dapr state. State store implementation will allow the update only if the attached ETag matches with the latest ETag in the state store.
/// </summary>
/// <param name="storeName">The name of the state store.</param>
/// <param name="key">The state key.</param>
/// <param name="binaryValue">The binary data that will be stored in the state store.</param>
/// <param name="etag">An ETag.</param>
/// <param name="stateOptions">Options for performing save state operation.</param>
/// <param name="metadata">A collection of metadata key-value pairs that will be provided to the state store. The valid metadata keys and values are determined by the type of state store used.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> that can be used to cancel the operation.</param>
/// <returns>A <see cref="Task" /> that will complete when the operation has completed.</returns>
public abstract Task<bool> TrySaveByteStateAsync(
string storeName,
string key,
ReadOnlyMemory<byte> binaryValue,
string etag,
StateOptions stateOptions = default,
IReadOnlyDictionary<string, string> metadata = default,
CancellationToken cancellationToken = default);


/// <summary>
/// Gets the current binary value associated with the <paramref name="key" /> from the Dapr state store.
/// </summary>
/// <param name="storeName">The name of state store to read from.</param>
/// <param name="key">The state key.</param>
/// <param name="consistencyMode">The consistency mode <see cref="ConsistencyMode" />.</param>
/// <param name="metadata">A collection of metadata key-value pairs that will be provided to the state store. The valid metadata keys and values are determined by the type of state store used.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> that can be used to cancel the operation.</param>
/// <returns>A <see cref="Task{T}" /> that will return the value when the operation has completed.</returns>
public abstract Task<ReadOnlyMemory<byte>> GetByteStateAsync(
string storeName,
string key,
ConsistencyMode? consistencyMode = default,
IReadOnlyDictionary<string, string> metadata = default,
CancellationToken cancellationToken = default);

/// <summary>
divzi-p marked this conversation as resolved.
Show resolved Hide resolved
/// Gets the current binary value associated with the <paramref name="key" /> from the Dapr state store and an ETag.
/// </summary>
/// <param name="storeName">The name of the state store.</param>
/// <param name="key">The state key.</param>
/// <param name="consistencyMode">The consistency mode <see cref="ConsistencyMode" />.</param>
/// <param name="metadata">A collection of metadata key-value pairs that will be provided to the state store. The valid metadata keys and values are determined by the type of state store used.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken" /> that can be used to cancel the operation.</param>
/// <returns>A <see cref="Task{T}" /> that will return the value when the operation has completed. This wraps the read value and an ETag.</returns>
public abstract Task<(ReadOnlyMemory<byte>, string etag)> GetByteStateAndETagAsync(
string storeName,
string key,
ConsistencyMode? consistencyMode = default,
IReadOnlyDictionary<string, string> metadata = default,
CancellationToken cancellationToken = default);

/// <summary>
/// Tries to save the state <paramref name="value" /> associated with the provided <paramref name="key" /> using the
/// <paramref name="etag"/> to the Dapr state. State store implementation will allow the update only if the attached ETag matches with the latest ETag in the state store.
Expand Down
Loading
Loading