Skip to content

Commit

Permalink
Merge pull request #230 from dapr/release-0.16
Browse files Browse the repository at this point in the history
merge Release 0.16
  • Loading branch information
mikeee authored Nov 4, 2024
2 parents ece8714 + 3907199 commit 4e2d316
Show file tree
Hide file tree
Showing 12 changed files with 2,339 additions and 1,483 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: dapr-rust-sdk

on:
schedule:
- cron: '8 8 * * *'
push:
branches:
- main
Expand Down Expand Up @@ -112,4 +114,4 @@ jobs:
- name: cargo publish dapr-macros
run: cargo publish --manifest-path dapr-macros/Cargo.toml --token ${{ env.CARGO_TOKEN }}
- name: cargo publish dapr
run: cargo publish --token ${{ env.CARGO_TOKEN }}
run: cargo publish --manifest-path dapr/Cargo.toml --token ${{ env.CARGO_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/validate-examples.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: validate-examples

on:
schedule:
- cron: '8 8 * * *'
push:
branches:
- main
Expand Down
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ resolver = "2"
[workspace.dependencies]
async-trait = "0.1"

dapr = { version = "0.15.1", path = "./dapr" }
dapr-macros = { version = "0.15.1", path = "./dapr-macros" }
dapr-macros = { version = "0.16.0-rc.2", path = "./dapr-macros" }

prost = "0.13.1"
prost-build = "0.13.1"
Expand All @@ -32,7 +31,7 @@ tonic = "0.12.1"
tonic-build = "0.12.1"

[workspace.package]
version = "0.15.1"
version = "0.16.0-rc.2"
authors = [
"Mike Nguyen <[email protected]>",
"The Dapr Authors <[email protected]>"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ resiliency.

Ensure you have Rust version 1.78 or higher installed. If not, install Rust [here](https://www.rust-lang.org/tools/install).

You will also need to install [protoc](https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation).
These crates no longer require protoc unless to recompile the protobuf files.

## How to use

Add the following to your `Cargo.toml` file:

```toml
[dependencies]
dapr = "0.15.0"
dapr = "0.16.0-rc.2"
```

Here's a basic example to create a client:
Expand All @@ -74,7 +74,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

## Explore more examples

Browse through more examples to understand the SDK better: [View examples](./examples)
Browse through more examples to understand the SDK better: [View examples](https://github.com/dapr/rust-sdk/tree/main/examples)

## Building

Expand All @@ -84,8 +84,6 @@ To build the SDK run:
cargo build
```

>Note: The protobuf client generation is built into `cargo build` process so updating the proto files under `dapr/` is enough to update the protobuf client.
## Developing (Updating .proto files from upstream Dapr)

To fetch the latest .proto files from Dapr execute the script `update-protos.sh`:
Expand All @@ -100,6 +98,8 @@ By default, the script fetches the latest proto updates from the master branch o
./update-protos.sh -v v1.14.0
```

You will also need to install [protoc](https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation).

Protos can then be compiled using:

```bash
Expand Down
4 changes: 2 additions & 2 deletions dapr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition.workspace = true
license.workspace = true
repository.workspace = true
description = "Rust SDK for dapr"
readme = "../README.md"
readme = "README.md"
keywords = ["microservices", "dapr"]
rust-version.workspace = true

Expand All @@ -30,8 +30,8 @@ tokio-util = { workspace = true, features = ["io"] }
[dev-dependencies]
axum-test = "15.3"
once_cell = "1.19"
dapr = { path = "./" }
tokio = { workspace = true, features = ["full"] }
uuid = { version = "1.10", features = ["v4"] }
dapr = { workspace = true }
tokio-test = { workspace = true }
tokio-stream = { workspace = true }
1 change: 1 addition & 0 deletions dapr/README.md
88 changes: 57 additions & 31 deletions dapr/src/dapr/dapr.proto.common.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/// `POST <http://localhost:3500/v1.0/invoke/<app_id>/method/<method>?query1=value1&query2=value2`>
///
/// Dapr runtime will parse POST as a verb and extract querystring to quersytring map.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HttpExtension {
/// Required. HTTP verb.
Expand All @@ -21,7 +20,17 @@ pub mod http_extension {
/// Type of HTTP 1.1 Methods
/// RFC 7231: <https://tools.ietf.org/html/rfc7231#page-24>
/// RFC 5789: <https://datatracker.ietf.org/doc/html/rfc5789>
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Verb {
None = 0,
Expand All @@ -42,16 +51,16 @@ pub mod http_extension {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Verb::None => "NONE",
Verb::Get => "GET",
Verb::Head => "HEAD",
Verb::Post => "POST",
Verb::Put => "PUT",
Verb::Delete => "DELETE",
Verb::Connect => "CONNECT",
Verb::Options => "OPTIONS",
Verb::Trace => "TRACE",
Verb::Patch => "PATCH",
Self::None => "NONE",
Self::Get => "GET",
Self::Head => "HEAD",
Self::Post => "POST",
Self::Put => "PUT",
Self::Delete => "DELETE",
Self::Connect => "CONNECT",
Self::Options => "OPTIONS",
Self::Trace => "TRACE",
Self::Patch => "PATCH",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand All @@ -75,7 +84,6 @@ pub mod http_extension {
/// InvokeRequest is the message to invoke a method with the data.
/// This message is used in InvokeService of Dapr gRPC Service and OnInvoke
/// of AppCallback gRPC service.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InvokeRequest {
/// Required. method is a method name which will be invoked by caller.
Expand All @@ -102,7 +110,6 @@ pub struct InvokeRequest {
/// from app callback.
/// This message is used in InvokeService of Dapr gRPC Service and OnInvoke
/// of AppCallback gRPC service.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InvokeResponse {
/// Required in unary RPCs. The content body of InvokeService response.
Expand All @@ -114,7 +121,6 @@ pub struct InvokeResponse {
}
/// Chunk of data sent in a streaming request or response.
/// This is used in requests including InternalInvokeRequestStream.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamPayload {
/// Data sent in the chunk.
Expand All @@ -128,7 +134,6 @@ pub struct StreamPayload {
pub seq: u64,
}
/// StateItem represents state key, value, and additional options to save state.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StateItem {
/// Required. The state key
Expand All @@ -143,22 +148,22 @@ pub struct StateItem {
pub etag: ::core::option::Option<Etag>,
/// The metadata which will be passed to state store component.
#[prost(map = "string, string", tag = "4")]
pub metadata:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
pub metadata: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// Options for concurrency and consistency to save the state.
#[prost(message, optional, tag = "5")]
pub options: ::core::option::Option<StateOptions>,
}
/// Etag represents a state item version
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Etag {
/// value sets the etag value
#[prost(string, tag = "1")]
pub value: ::prost::alloc::string::String,
}
/// StateOptions configures concurrency and consistency for state operations
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StateOptions {
#[prost(enumeration = "state_options::StateConcurrency", tag = "1")]
Expand All @@ -169,7 +174,17 @@ pub struct StateOptions {
/// Nested message and enum types in `StateOptions`.
pub mod state_options {
/// Enum describing the supported concurrency for state.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum StateConcurrency {
ConcurrencyUnspecified = 0,
Expand All @@ -183,9 +198,9 @@ pub mod state_options {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
StateConcurrency::ConcurrencyUnspecified => "CONCURRENCY_UNSPECIFIED",
StateConcurrency::ConcurrencyFirstWrite => "CONCURRENCY_FIRST_WRITE",
StateConcurrency::ConcurrencyLastWrite => "CONCURRENCY_LAST_WRITE",
Self::ConcurrencyUnspecified => "CONCURRENCY_UNSPECIFIED",
Self::ConcurrencyFirstWrite => "CONCURRENCY_FIRST_WRITE",
Self::ConcurrencyLastWrite => "CONCURRENCY_LAST_WRITE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand All @@ -199,7 +214,17 @@ pub mod state_options {
}
}
/// Enum describing the supported consistency for state.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum StateConsistency {
ConsistencyUnspecified = 0,
Expand All @@ -213,9 +238,9 @@ pub mod state_options {
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
StateConsistency::ConsistencyUnspecified => "CONSISTENCY_UNSPECIFIED",
StateConsistency::ConsistencyEventual => "CONSISTENCY_EVENTUAL",
StateConsistency::ConsistencyStrong => "CONSISTENCY_STRONG",
Self::ConsistencyUnspecified => "CONSISTENCY_UNSPECIFIED",
Self::ConsistencyEventual => "CONSISTENCY_EVENTUAL",
Self::ConsistencyStrong => "CONSISTENCY_STRONG",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
Expand All @@ -230,7 +255,6 @@ pub mod state_options {
}
}
/// ConfigurationItem represents all the configuration with its name(key).
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConfigurationItem {
/// Required. The value of configuration item.
Expand All @@ -241,6 +265,8 @@ pub struct ConfigurationItem {
pub version: ::prost::alloc::string::String,
/// the metadata which will be passed to/from configuration store component.
#[prost(map = "string, string", tag = "3")]
pub metadata:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
pub metadata: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
Loading

0 comments on commit 4e2d316

Please sign in to comment.