-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
33,555 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# yapf: disable | ||
# isort: skip_file | ||
|
||
# Standard imports. | ||
import grpc | ||
import traceback | ||
import uuid | ||
import resemble.aio.state_managers | ||
from abc import abstractmethod | ||
from datetime import datetime, timedelta | ||
from google.protobuf import any_pb2 | ||
from google.protobuf.descriptor import FileDescriptor | ||
from google.protobuf.message import Message | ||
from google.rpc import code_pb2, status_pb2 | ||
from grpc_status import rpc_status | ||
from resemble.aio.contexts import ( | ||
Context, | ||
ReaderContext, | ||
TransactionContext, | ||
WriterContext, | ||
) | ||
from resemble.aio.errors import Aborted | ||
from resemble.aio.headers import Headers | ||
from resemble.aio.idempotency import IdempotencyManager, Idempotency | ||
from resemble.aio.internals.channel_manager import _ChannelManager | ||
from resemble.aio.internals.middleware import Middleware | ||
from resemble.aio.internals.tasks_cache import TasksCache | ||
from resemble.aio.internals.tasks_dispatcher import TasksDispatcher | ||
from resemble.aio.headers import Headers | ||
from resemble.aio.servicers import Servicer, Serviceable | ||
from resemble.aio.state_managers import Effects, StateManager | ||
from resemble.aio.stubs import Stub | ||
from resemble.aio.tasks import TaskEffect | ||
from resemble.aio.types import ActorId, assert_type, GrpcMetadata, ServiceName | ||
from resemble.aio.workflows import Workflow | ||
from typing import ( | ||
AsyncIterable, | ||
AsyncIterator, | ||
Awaitable, | ||
Callable, | ||
Optional, | ||
TypeAlias, | ||
Union, | ||
) | ||
|
||
# User defined or referenced imports. | ||
import google.protobuf.descriptor_pb2 | ||
import google.protobuf.descriptor_pb2_grpc | ||
# Additionally re-export all messages from the pb2 module. | ||
from google.protobuf.descriptor_pb2 import ( | ||
DescriptorProto, | ||
EnumDescriptorProto, | ||
EnumOptions, | ||
EnumValueDescriptorProto, | ||
EnumValueOptions, | ||
ExtensionRangeOptions, | ||
FieldDescriptorProto, | ||
FieldOptions, | ||
FileDescriptorProto, | ||
FileDescriptorSet, | ||
FileOptions, | ||
GeneratedCodeInfo, | ||
MessageOptions, | ||
MethodDescriptorProto, | ||
MethodOptions, | ||
OneofDescriptorProto, | ||
OneofOptions, | ||
ServiceDescriptorProto, | ||
ServiceOptions, | ||
SourceCodeInfo, | ||
UninterpretedOption, | ||
) | ||
|
||
|
||
def MakeLegacyGrpcServiceable( | ||
# A legacy gRPC servicer type can't be more specific than `type`, | ||
# because legacy gRPC servicers (as generated by the gRPC `protoc` | ||
# plugin) do not share any common base class other than `object`. | ||
servicer_type: type | ||
) -> Serviceable: | ||
raise ValueError(f"Unknown legacy gRPC servicer type '{servicer_type}'") | ||
|
||
|
||
# yapf: enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { | ||
PartialMessage | ||
} from "@bufbuild/protobuf"; | ||
import { | ||
Deferred, | ||
Event, | ||
IQueryRequest, | ||
IQueryResponse, | ||
Mutation, | ||
QueryRequest, | ||
QueryResponse, | ||
ResponseOrError, | ||
filterSet, | ||
parseStreamedValue, | ||
popMutationMaybeFromLocalStorage, | ||
pushMutationMaybeToLocalStorage, | ||
retryForever, | ||
useResembleContext | ||
} from "@reboot-dev/resemble-react"; | ||
import { | ||
Dispatch, | ||
MutableRefObject, | ||
SetStateAction, | ||
useEffect, | ||
useRef, | ||
useState, | ||
} from "react"; | ||
import { v4 as uuidv4 } from "uuid"; | ||
// There are known bugs with the following input / output message imports: | ||
// 1. It doesn't correctly handle input / output messages that don't have a | ||
// corresponding const definition in the generated _pb, | ||
// e.g. google.protobuf.Empty. | ||
// 2. It will try to import the same message twice if any input message is the | ||
// same as any output message. | ||
// TODO: correctly handle messages like google.protobuf.Empty. | ||
// TODO: create a set of input messages AND output messages and |map ..|unique | ||
// over those to ensure there are no duplicates. | ||
import { | ||
, | ||
} from "./descriptor_pb"; | ||
|
||
|
||
// Start of service specific code. | ||
/////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
// @generated by protoc-gen-es v1.3.1 | ||
// @generated from file hello_world/v1/greeter.proto (package hello_world.v1, syntax proto3) | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; | ||
import { Message, proto3 } from "@bufbuild/protobuf"; | ||
|
||
/** | ||
* @generated from message hello_world.v1.GreeterState | ||
*/ | ||
export declare class GreeterState extends Message<GreeterState> { | ||
/** | ||
* @generated from field: repeated string greetings = 2; | ||
*/ | ||
greetings: string[]; | ||
|
||
constructor(data?: PartialMessage<GreeterState>); | ||
|
||
static readonly runtime: typeof proto3; | ||
static readonly typeName = "hello_world.v1.GreeterState"; | ||
static readonly fields: FieldList; | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GreeterState; | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GreeterState; | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GreeterState; | ||
|
||
static equals(a: GreeterState | PlainMessage<GreeterState> | undefined, b: GreeterState | PlainMessage<GreeterState> | undefined): boolean; | ||
} | ||
|
||
/** | ||
* @generated from message hello_world.v1.GreetingsRequest | ||
*/ | ||
export declare class GreetingsRequest extends Message<GreetingsRequest> { | ||
constructor(data?: PartialMessage<GreetingsRequest>); | ||
|
||
static readonly runtime: typeof proto3; | ||
static readonly typeName = "hello_world.v1.GreetingsRequest"; | ||
static readonly fields: FieldList; | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GreetingsRequest; | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GreetingsRequest; | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GreetingsRequest; | ||
|
||
static equals(a: GreetingsRequest | PlainMessage<GreetingsRequest> | undefined, b: GreetingsRequest | PlainMessage<GreetingsRequest> | undefined): boolean; | ||
} | ||
|
||
/** | ||
* @generated from message hello_world.v1.GreetingsResponse | ||
*/ | ||
export declare class GreetingsResponse extends Message<GreetingsResponse> { | ||
/** | ||
* @generated from field: repeated string greetings = 1; | ||
*/ | ||
greetings: string[]; | ||
|
||
constructor(data?: PartialMessage<GreetingsResponse>); | ||
|
||
static readonly runtime: typeof proto3; | ||
static readonly typeName = "hello_world.v1.GreetingsResponse"; | ||
static readonly fields: FieldList; | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GreetingsResponse; | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GreetingsResponse; | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GreetingsResponse; | ||
|
||
static equals(a: GreetingsResponse | PlainMessage<GreetingsResponse> | undefined, b: GreetingsResponse | PlainMessage<GreetingsResponse> | undefined): boolean; | ||
} | ||
|
||
/** | ||
* @generated from message hello_world.v1.GreetRequest | ||
*/ | ||
export declare class GreetRequest extends Message<GreetRequest> { | ||
/** | ||
* E.g. "Hello, World". | ||
* | ||
* @generated from field: string greeting = 1; | ||
*/ | ||
greeting: string; | ||
|
||
constructor(data?: PartialMessage<GreetRequest>); | ||
|
||
static readonly runtime: typeof proto3; | ||
static readonly typeName = "hello_world.v1.GreetRequest"; | ||
static readonly fields: FieldList; | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GreetRequest; | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GreetRequest; | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GreetRequest; | ||
|
||
static equals(a: GreetRequest | PlainMessage<GreetRequest> | undefined, b: GreetRequest | PlainMessage<GreetRequest> | undefined): boolean; | ||
} | ||
|
||
/** | ||
* @generated from message hello_world.v1.GreetResponse | ||
*/ | ||
export declare class GreetResponse extends Message<GreetResponse> { | ||
/** | ||
* @generated from field: string greeting = 1; | ||
*/ | ||
greeting: string; | ||
|
||
constructor(data?: PartialMessage<GreetResponse>); | ||
|
||
static readonly runtime: typeof proto3; | ||
static readonly typeName = "hello_world.v1.GreetResponse"; | ||
static readonly fields: FieldList; | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GreetResponse; | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GreetResponse; | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GreetResponse; | ||
|
||
static equals(a: GreetResponse | PlainMessage<GreetResponse> | undefined, b: GreetResponse | PlainMessage<GreetResponse> | undefined): boolean; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// @generated by protoc-gen-es v1.3.1 | ||
// @generated from file hello_world/v1/greeter.proto (package hello_world.v1, syntax proto3) | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import { proto3 } from "@bufbuild/protobuf"; | ||
|
||
/** | ||
* @generated from message hello_world.v1.GreeterState | ||
*/ | ||
export const GreeterState = proto3.makeMessageType( | ||
"hello_world.v1.GreeterState", | ||
() => [ | ||
{ no: 2, name: "greetings", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, | ||
], | ||
); | ||
|
||
/** | ||
* @generated from message hello_world.v1.GreetingsRequest | ||
*/ | ||
export const GreetingsRequest = proto3.makeMessageType( | ||
"hello_world.v1.GreetingsRequest", | ||
[], | ||
); | ||
|
||
/** | ||
* @generated from message hello_world.v1.GreetingsResponse | ||
*/ | ||
export const GreetingsResponse = proto3.makeMessageType( | ||
"hello_world.v1.GreetingsResponse", | ||
() => [ | ||
{ no: 1, name: "greetings", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true }, | ||
], | ||
); | ||
|
||
/** | ||
* @generated from message hello_world.v1.GreetRequest | ||
*/ | ||
export const GreetRequest = proto3.makeMessageType( | ||
"hello_world.v1.GreetRequest", | ||
() => [ | ||
{ no: 1, name: "greeting", kind: "scalar", T: 9 /* ScalarType.STRING */ }, | ||
], | ||
); | ||
|
||
/** | ||
* @generated from message hello_world.v1.GreetResponse | ||
*/ | ||
export const GreetResponse = proto3.makeMessageType( | ||
"hello_world.v1.GreetResponse", | ||
() => [ | ||
{ no: 1, name: "greeting", kind: "scalar", T: 9 /* ScalarType.STRING */ }, | ||
], | ||
); | ||
|
Oops, something went wrong.