Skip to content

Commit

Permalink
Updates gRPC proto - dapr v1.10 release (#88)
Browse files Browse the repository at this point in the history
* updates grpc proto for dapr v1.10 release

Signed-off-by: Roberto J Rojas <[email protected]>

* updates dependencies to most recent

Signed-off-by: Roberto J Rojas <[email protected]>

---------

Signed-off-by: Roberto J Rojas <[email protected]>
  • Loading branch information
robertojrojas authored Feb 7, 2023
1 parent b682ce7 commit ecc0e4e
Show file tree
Hide file tree
Showing 5 changed files with 243 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dapr"
version = "0.10.0"
version = "0.11.0"
authors = ["dapr.io"]
edition = "2021"
license-file = "LICENSE"
Expand Down
17 changes: 15 additions & 2 deletions dapr/proto/common/v1/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ message InvokeRequest {
// Required. method is a method name which will be invoked by caller.
string method = 1;

// Required. Bytes value or Protobuf message which caller sent.
// Required in unary RPCs. Bytes value or Protobuf message which caller sent.
// Dapr treats Any.value as bytes type if Any.type_url is unset.
google.protobuf.Any data = 2;

Expand All @@ -82,13 +82,26 @@ message InvokeRequest {
// This message is used in InvokeService of Dapr gRPC Service and OnInvoke
// of AppCallback gRPC service.
message InvokeResponse {
// Required. The content body of InvokeService response.
// Required in unary RPCs. The content body of InvokeService response.
google.protobuf.Any data = 1;

// Required. The type of data content.
string content_type = 2;
}

// Chunk of data sent in a streaming request or response.
// This is used in requests including InternalInvokeRequestStream.
message StreamPayload {
// Data sent in the chunk.
// The amount of data included in each chunk is up to the discretion of the sender, and can be empty.
// Additionally, the amount of data doesn't need to be fixed and subsequent messages can send more, or less, data.
// Receivers must not make assumptions about the number of bytes they'll receive in each chunk.
bytes data = 1;

// Sequence number. This is a counter that starts from 0 and increments by 1 on each chunk sent.
uint32 seq = 2;
}

// StateItem represents state key, value, and additional options to save state.
message StateItem {
// Required. The state key
Expand Down
110 changes: 110 additions & 0 deletions dapr/proto/runtime/v1/appcallback.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package dapr.proto.runtime.v1;

import "google/protobuf/empty.proto";
import "dapr/proto/common/v1/common.proto";
import "google/protobuf/struct.proto";

option csharp_namespace = "Dapr.AppCallback.Autogen.Grpc.v1";
option java_outer_classname = "DaprAppCallbackProtos";
Expand Down Expand Up @@ -53,6 +54,13 @@ service AppCallbackHealthCheck {
rpc HealthCheck(google.protobuf.Empty) returns (HealthCheckResponse) {}
}

// AppCallbackAlpha V1 is an optional extension to AppCallback V1 to opt
// for Alpha RPCs.
service AppCallbackAlpha {
// Subscribes bulk events from Pubsub
rpc OnBulkTopicEventAlpha1(TopicEventBulkRequest) returns (TopicEventBulkResponse) {}
}

// TopicEventRequest message is compatible with CloudEvent spec v1.0
// https://github.com/cloudevents/spec/blob/v1.0/spec.md
message TopicEventRequest {
Expand Down Expand Up @@ -89,6 +97,9 @@ message TopicEventRequest {
// The matching path from TopicSubscription/routes (if specified) for this event.
// This value is used by OnTopicEvent to "switch" inside the handler.
string path = 9;

// The map of additional custom properties to be sent to the app. These are considered to be cloud event extensions.
google.protobuf.Struct extensions = 10;
}

// TopicEventResponse is response from app on published message
Expand All @@ -107,6 +118,90 @@ message TopicEventResponse {
TopicEventResponseStatus status = 1;
}

// TopicEventCERequest message is compatible with CloudEvent spec v1.0
message TopicEventCERequest {
// The unique identifier of this cloud event.
string id = 1;

// source identifies the context in which an event happened.
string source = 2;

// The type of event related to the originating occurrence.
string type = 3;

// The version of the CloudEvents specification.
string spec_version = 4;

// The content type of data value.
string data_content_type = 5;

// The content of the event.
bytes data = 6;

// Custom attributes which includes cloud event extensions.
google.protobuf.Struct extensions = 7;
}

// TopicEventBulkRequestEntry represents a single message inside a bulk request
message TopicEventBulkRequestEntry {
// Unique identifier for the message.
string entry_id = 1;

// The content of the event.
oneof event {
bytes bytes = 2;
TopicEventCERequest cloud_event = 3;
}

// content type of the event contained.
string content_type = 4;

// The metadata associated with the event.
map<string,string> metadata = 5;
}

// TopicEventBulkRequest represents request for bulk message
message TopicEventBulkRequest {
// Unique identifier for the bulk request.
string id = 1;

// The list of items inside this bulk request.
repeated TopicEventBulkRequestEntry entries = 2;

// The metadata associated with the this bulk request.
map<string,string> metadata = 3;

// The pubsub topic which publisher sent to.
string topic = 4;

// The name of the pubsub the publisher sent to.
string pubsub_name = 5;

// The type of event related to the originating occurrence.
string type = 6;

// The matching path from TopicSubscription/routes (if specified) for this event.
// This value is used by OnTopicEvent to "switch" inside the handler.
string path = 7;
}

// TopicEventBulkResponseEntry Represents single response, as part of TopicEventBulkResponse, to be
// sent by subscibed App for the corresponding single message during bulk subscribe
message TopicEventBulkResponseEntry {
// Unique identifier associated the message.
string entry_id = 1;

// The status of the response.
TopicEventResponse.TopicEventResponseStatus status = 2;
}

// AppBulkResponse is response from app on published message
message TopicEventBulkResponse {

// The list of all responses for the bulk request.
repeated TopicEventBulkResponseEntry statuses = 1;
}

// BindingEventRequest represents input bindings event.
message BindingEventRequest {
// Required. The name of the input binding component.
Expand Down Expand Up @@ -170,6 +265,9 @@ message TopicSubscription {

// The optional dead letter queue for this topic to send events to.
string dead_letter_topic = 6;

// The optional bulk subscribe settings for this topic.
BulkSubscribeConfig bulk_subscribe = 7;
}

message TopicRoutes {
Expand All @@ -192,6 +290,18 @@ message TopicRule {
string path = 2;
}

// BulkSubscribeConfig is the message to pass settings for bulk subscribe
message BulkSubscribeConfig {
// Required. Flag to enable/disable bulk subscribe
bool enabled = 1;

// Optional. Max number of messages to be sent in a single bulk request
int32 max_messages_count = 2;

// Optional. Max duration to wait for messages to be sent in a single bulk request
int32 max_await_duration_ms = 3;
}

// ListInputBindingsResponse is the message including the list of input bindings.
message ListInputBindingsResponse {
// The list of input bindings.
Expand Down
120 changes: 115 additions & 5 deletions dapr/proto/runtime/v1/dapr.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ option go_package = "github.com/dapr/dapr/pkg/proto/runtime/v1;runtime";
// Dapr service provides APIs to user application to access Dapr building blocks.
service Dapr {
// Invokes a method on a remote Dapr app.
// Deprecated: Use proxy mode service invocation instead.
rpc InvokeService(InvokeServiceRequest) returns (common.v1.InvokeResponse) {}

// Gets the state for a specific key.
Expand All @@ -53,6 +54,9 @@ service Dapr {
// Publishes events to the specific topic.
rpc PublishEvent(PublishEventRequest) returns (google.protobuf.Empty) {}

// Bulk Publishes multiple events to the specified topic.
rpc BulkPublishEventAlpha1(BulkPublishRequest) returns (BulkPublishResponse) {}

// Invokes binding data to specific output bindings
rpc InvokeBinding(InvokeBindingRequest) returns (InvokeBindingResponse) {}

Expand Down Expand Up @@ -107,6 +111,15 @@ service Dapr {
// Sets value in extended metadata of the sidecar
rpc SetMetadata (SetMetadataRequest) returns (google.protobuf.Empty) {}

// Start Workflow
rpc StartWorkflowAlpha1 (StartWorkflowRequest) returns (WorkflowReference) {}

// Get Workflow details
rpc GetWorkflowAlpha1 (GetWorkflowRequest) returns (GetWorkflowResponse) {}

// Terminate Workflow
rpc TerminateWorkflowAlpha1 (TerminateWorkflowRequest) returns (TerminateWorkflowResponse) {}

// Shutdown the sidecar
rpc Shutdown (google.protobuf.Empty) returns (google.protobuf.Empty) {}
}
Expand Down Expand Up @@ -287,6 +300,53 @@ message PublishEventRequest {
map<string, string> metadata = 5;
}

// BulkPublishRequest is the message to bulk publish events to pubsub topic
message BulkPublishRequest {
// The name of the pubsub component
string pubsub_name = 1;

// The pubsub topic
string topic = 2;

// The entries which contain the individual events and associated details to be published
repeated BulkPublishRequestEntry entries = 3;

// The request level metadata passing to to the pubsub components
map<string, string> metadata = 4;
}

// BulkPublishRequestEntry is the message containing the event to be bulk published
message BulkPublishRequestEntry {
// The request scoped unique ID referring to this message. Used to map status in response
string entry_id = 1;

// The event which will be pulished to the topic
bytes event = 2;

// The content type for the event
string content_type = 3;

// The event level metadata passing to the pubsub component
map<string, string> metadata = 4;
}

// BulkPublishResponse is the message returned from a BulkPublishEvent call
message BulkPublishResponse {
// The entries for different events that failed publish in the BulkPublishEvent call
repeated BulkPublishResponseFailedEntry failedEntries = 1;
}

// BulkPublishResponseFailedEntry is the message containing the entryID and error of a failed event in BulkPublishEvent call
message BulkPublishResponseFailedEntry {

// The response scoped unique ID referring to this message
string entry_id = 1;

// The error message if any on failure
string error = 2;
}


// InvokeBindingRequest is the message to send data to output bindings
message InvokeBindingRequest {
// The name of the output binding to invoke.
Expand All @@ -296,10 +356,10 @@ message InvokeBindingRequest {
bytes data = 2;

// The metadata passing to output binding components
//
//
// Common metadata property:
// - ttlInSeconds : the time to live in seconds for the message.
// If set in the binding definition will cause all messages to
// - ttlInSeconds : the time to live in seconds for the message.
// If set in the binding definition will cause all messages to
// have a default time to live. The message ttl overrides any value
// in the binding definition.
map<string, string> metadata = 3;
Expand Down Expand Up @@ -362,7 +422,7 @@ message TransactionalStateOperation {
// The type of operation to be executed
string operationType = 1;

// State values to be operated on
// State values to be operated on
common.v1.StateItem request = 2;
}

Expand Down Expand Up @@ -469,6 +529,7 @@ message GetMetadataResponse {
repeated ActiveActorsCount active_actors_count = 2;
repeated RegisteredComponents registered_components = 3;
map<string, string> extended_metadata = 4;
repeated PubsubSubscription subscriptions = 5;
}

message ActiveActorsCount {
Expand All @@ -483,6 +544,23 @@ message RegisteredComponents {
repeated string capabilities = 4;
}

message PubsubSubscription {
string pubsub_name = 1;
string topic = 2;
map<string,string> metadata = 3;
PubsubSubscriptionRules rules = 4;
string dead_letter_topic = 5;
}

message PubsubSubscriptionRules {
repeated PubsubSubscriptionRule rules = 1;
}

message PubsubSubscriptionRule {
string match = 1;
string path = 2;
}

message SetMetadataRequest {
string key = 1;
string value = 2;
Expand Down Expand Up @@ -596,4 +674,36 @@ message UnlockResponse {
}

Status status = 1;
}
}

message WorkflowReference {
string instance_id = 1;
}

message GetWorkflowRequest {
string instance_id = 1;
string workflow_type = 2;
string workflow_component = 3;
}

message GetWorkflowResponse {
string instance_id = 1;
int64 start_time = 2;
map<string, string> metadata = 3;
}

message StartWorkflowRequest {
string instance_id = 1;
string workflow_component = 2;
string workflow_name = 3;
map<string, string> options = 4;
bytes input = 5;
}

message TerminateWorkflowRequest {
string instance_id = 1;
string workflow_component = 2;
}

message TerminateWorkflowResponse {
}
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ impl From<TonicError> for Error {

impl From<TonicStatus> for Error {
fn from(error: TonicStatus) -> Self {
Error::GrpcError(GrpcError { status: error })
Error::GrpcError(GrpcError { _status: error })
}
}

#[derive(Debug)]
pub struct GrpcError {
status: TonicStatus,
_status: TonicStatus,
}

impl Display for GrpcError {
Expand Down

0 comments on commit ecc0e4e

Please sign in to comment.