Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 10 additions & 1 deletion scripts/fetch-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,15 @@ generateGrpc() {
# npm install grpc_tools_node_protoc_ts --save-dev
PROTOC_GEN_TS_PATH="${PATH_ROOT}/node_modules/.bin/protoc-gen-ts"
PROTOC_GEN_GRPC_PATH="${PATH_ROOT}/node_modules/.bin/grpc_tools_node_protoc_plugin"
# Prefer the grpc-tools bundled protoc for JS generation support on newer protoc versions
PROTOC_BIN="${PATH_ROOT}/node_modules/.bin/grpc_tools_node_protoc"
if [ ! -x "$PROTOC_BIN" ]; then
PROTOC_BIN="protoc"
fi

# Note: we specify --proto_path to show where we should start searching from. If we use import it will start from this path
# this is why PATH_PROTO != PATH_PROTO_DAPR; PATH_PROTO_DAPR is where we save our proto files while the other is the namespace
protoc \
"$PROTOC_BIN" \
--proto_path="${PATH_PROTO}" \
--plugin="protoc-gen-ts=${PROTOC_GEN_TS_PATH}" \
--plugin=protoc-gen-grpc=${PROTOC_GEN_GRPC_PATH} \
Expand Down Expand Up @@ -131,6 +136,8 @@ downloadFile "https://raw.githubusercontent.com/$ORG_NAME/$REPO_NAME/$BRANCH_NAM
downloadFile "https://raw.githubusercontent.com/$ORG_NAME/$REPO_NAME/$BRANCH_NAME/dapr/proto/internals/v1/apiversion.proto" "$PATH_ROOT/src/proto/dapr/proto/internals/v1/apiversion.proto"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove all of these except those actually used by the SDK:
dapr.proto
common.proto
appcallback.proto

downloadFile "https://raw.githubusercontent.com/$ORG_NAME/$REPO_NAME/$BRANCH_NAME/dapr/proto/internals/v1/service_invocation.proto" "$PATH_ROOT/src/proto/dapr/proto/internals/v1/service_invocation.proto"
downloadFile "https://raw.githubusercontent.com/$ORG_NAME/$REPO_NAME/$BRANCH_NAME/dapr/proto/internals/v1/status.proto" "$PATH_ROOT/src/proto/dapr/proto/internals/v1/status.proto"
# Missing import used by service_invocation.proto
downloadFile "https://raw.githubusercontent.com/$ORG_NAME/$REPO_NAME/$BRANCH_NAME/dapr/proto/internals/v1/reminders.proto" "$PATH_ROOT/src/proto/dapr/proto/internals/v1/reminders.proto"
downloadFile "https://raw.githubusercontent.com/$ORG_NAME/$REPO_NAME/$BRANCH_NAME/dapr/proto/operator/v1/operator.proto" "$PATH_ROOT/src/proto/dapr/proto/operator/v1/operator.proto"
downloadFile "https://raw.githubusercontent.com/$ORG_NAME/$REPO_NAME/$BRANCH_NAME/dapr/proto/placement/v1/placement.proto" "$PATH_ROOT/src/proto/dapr/proto/placement/v1/placement.proto"
downloadFile "https://raw.githubusercontent.com/$ORG_NAME/$REPO_NAME/$BRANCH_NAME/dapr/proto/runtime/v1/appcallback.proto" "$PATH_ROOT/src/proto/dapr/proto/runtime/v1/appcallback.proto"
Expand All @@ -147,6 +154,8 @@ echo ""
echo "Compiling gRPC files"
generateGrpc "$PATH_ROOT/src/proto" "dapr/proto/common/v1/common.proto"
generateGrpc "$PATH_ROOT/src/proto" "dapr/proto/internals/v1/apiversion.proto"
# Also generate code for reminders to satisfy imports
generateGrpc "$PATH_ROOT/src/proto" "dapr/proto/internals/v1/reminders.proto"
generateGrpc "$PATH_ROOT/src/proto" "dapr/proto/internals/v1/service_invocation.proto"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - we shouldn't actually be using any of these except appcallback.proto, dapr.proto and common.proto as they're internal to the runtime and subject to change at any point.

generateGrpc "$PATH_ROOT/src/proto" "dapr/proto/internals/v1/status.proto"
generateGrpc "$PATH_ROOT/src/proto" "dapr/proto/operator/v1/operator.proto"
Expand Down
30 changes: 27 additions & 3 deletions src/proto/dapr/proto/common/v1/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ syntax = "proto3";
package dapr.proto.common.v1;

import "google/protobuf/any.proto";
import "google/protobuf/duration.proto";

option csharp_namespace = "Dapr.Client.Autogen.Grpc.v1";
option java_outer_classname = "CommonProtos";
Expand All @@ -24,10 +25,10 @@ option go_package = "github.com/dapr/dapr/pkg/proto/common/v1;common";

// HTTPExtension includes HTTP verb and querystring
// when Dapr runtime delivers HTTP content.
//
//
// For example, when callers calls http invoke api
// POST http://localhost:3500/v1.0/invoke/<app_id>/method/<method>?query1=value1&query2=value2
//
// `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.
message HTTPExtension {
// Type of HTTP 1.1 Methods
Expand Down Expand Up @@ -158,3 +159,26 @@ message ConfigurationItem {
// the metadata which will be passed to/from configuration store component.
map<string,string> metadata = 3;
}

// JobFailurePolicy defines the policy to apply when a job fails to trigger.
message JobFailurePolicy {
// policy is the policy to apply when a job fails to trigger.
oneof policy {
JobFailurePolicyDrop drop = 1;
JobFailurePolicyConstant constant = 2;
}
}

// JobFailurePolicyDrop is a policy which drops the job tick when the job fails to trigger.
message JobFailurePolicyDrop {}

// JobFailurePolicyConstant is a policy which retries the job at a consistent interval when the job fails to trigger.
message JobFailurePolicyConstant {
// interval is the constant delay to wait before retrying the job.
google.protobuf.Duration interval = 1;

// max_retries is the optional maximum number of retries to attempt before giving up.
// If unset, the Job will be retried indefinitely.
optional uint32 max_retries = 2;
}

85 changes: 85 additions & 0 deletions src/proto/dapr/proto/common/v1/common_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import * as jspb from "google-protobuf";
import * as google_protobuf_any_pb from "google-protobuf/google/protobuf/any_pb";
import * as google_protobuf_duration_pb from "google-protobuf/google/protobuf/duration_pb";

export class HTTPExtension extends jspb.Message {
getVerb(): HTTPExtension.Verb;
Expand Down Expand Up @@ -255,3 +256,87 @@ export namespace ConfigurationItem {
metadataMap: Array<[string, string]>,
}
}

export class JobFailurePolicy extends jspb.Message {

hasDrop(): boolean;
clearDrop(): void;
getDrop(): JobFailurePolicyDrop | undefined;
setDrop(value?: JobFailurePolicyDrop): JobFailurePolicy;

hasConstant(): boolean;
clearConstant(): void;
getConstant(): JobFailurePolicyConstant | undefined;
setConstant(value?: JobFailurePolicyConstant): JobFailurePolicy;

getPolicyCase(): JobFailurePolicy.PolicyCase;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): JobFailurePolicy.AsObject;
static toObject(includeInstance: boolean, msg: JobFailurePolicy): JobFailurePolicy.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: JobFailurePolicy, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): JobFailurePolicy;
static deserializeBinaryFromReader(message: JobFailurePolicy, reader: jspb.BinaryReader): JobFailurePolicy;
}

export namespace JobFailurePolicy {
export type AsObject = {
drop?: JobFailurePolicyDrop.AsObject,
constant?: JobFailurePolicyConstant.AsObject,
}

export enum PolicyCase {
POLICY_NOT_SET = 0,
DROP = 1,
CONSTANT = 2,
}

}

export class JobFailurePolicyDrop extends jspb.Message {

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): JobFailurePolicyDrop.AsObject;
static toObject(includeInstance: boolean, msg: JobFailurePolicyDrop): JobFailurePolicyDrop.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: JobFailurePolicyDrop, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): JobFailurePolicyDrop;
static deserializeBinaryFromReader(message: JobFailurePolicyDrop, reader: jspb.BinaryReader): JobFailurePolicyDrop;
}

export namespace JobFailurePolicyDrop {
export type AsObject = {
}
}

export class JobFailurePolicyConstant extends jspb.Message {

hasInterval(): boolean;
clearInterval(): void;
getInterval(): google_protobuf_duration_pb.Duration | undefined;
setInterval(value?: google_protobuf_duration_pb.Duration): JobFailurePolicyConstant;

hasMaxRetries(): boolean;
clearMaxRetries(): void;
getMaxRetries(): number | undefined;
setMaxRetries(value: number): JobFailurePolicyConstant;

serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): JobFailurePolicyConstant.AsObject;
static toObject(includeInstance: boolean, msg: JobFailurePolicyConstant): JobFailurePolicyConstant.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: JobFailurePolicyConstant, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): JobFailurePolicyConstant;
static deserializeBinaryFromReader(message: JobFailurePolicyConstant, reader: jspb.BinaryReader): JobFailurePolicyConstant;
}

export namespace JobFailurePolicyConstant {
export type AsObject = {
interval?: google_protobuf_duration_pb.Duration.AsObject,
maxRetries?: number,
}
}
Loading
Loading