Skip to content

Commit

Permalink
refactor: updated intermediate representation
Browse files Browse the repository at this point in the history
  • Loading branch information
jenspots committed Jun 25, 2024
1 parent 017da86 commit d675bc2
Show file tree
Hide file tree
Showing 22 changed files with 495 additions and 327 deletions.
3 changes: 1 addition & 2 deletions proto/index.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ message ChannelData {
}

service Runner {
rpc prepareProcessor(IRProcessor) returns (Empty);
rpc prepareStage(IRStage) returns (Empty);
rpc load(IRStage) returns (Empty);
rpc exec(Empty) returns (Empty);
rpc channel(stream ChannelData) returns (stream ChannelData);
}
8 changes: 4 additions & 4 deletions proto/intermediate.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ message IRParameter {

message IRProcessor {
string uri = 1;
repeated IRParameter parameters = 2;
map<string, IRParameter> parameters = 2;
map<string, string> metadata = 3;
}

message IRArgument {
string name = 1;
IRParameter parameter = 1;
repeated string value = 2;
}

message IRStage {
string uri = 1;
string processor_uri = 2;
repeated IRArgument arguments = 3;
IRProcessor processor = 2;
map<string, IRArgument> arguments = 3;
}
41 changes: 7 additions & 34 deletions runners/nodejs/src/proto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from "@grpc/grpc-js";
import * as _m0 from "protobufjs/minimal";
import { Empty } from "./empty";
import { IRProcessor, IRStage } from "./intermediate";
import { IRStage } from "./intermediate";

export const protobufPackage = "";

Expand Down Expand Up @@ -116,19 +116,8 @@ export const ChannelData = {

export type RunnerService = typeof RunnerService;
export const RunnerService = {
prepareProcessor: {
path: "/Runner/prepareProcessor",
requestStream: false,
responseStream: false,
requestSerialize: (value: IRProcessor) =>
Buffer.from(IRProcessor.encode(value).finish()),
requestDeserialize: (value: Buffer) => IRProcessor.decode(value),
responseSerialize: (value: Empty) =>
Buffer.from(Empty.encode(value).finish()),
responseDeserialize: (value: Buffer) => Empty.decode(value),
},
prepareStage: {
path: "/Runner/prepareStage",
load: {
path: "/Runner/load",
requestStream: false,
responseStream: false,
requestSerialize: (value: IRStage) =>
Expand Down Expand Up @@ -163,38 +152,22 @@ export const RunnerService = {
} as const;

export interface RunnerServer extends UntypedServiceImplementation {
prepareProcessor: handleUnaryCall<IRProcessor, Empty>;
prepareStage: handleUnaryCall<IRStage, Empty>;
load: handleUnaryCall<IRStage, Empty>;
exec: handleUnaryCall<Empty, Empty>;
channel: handleBidiStreamingCall<ChannelData, ChannelData>;
}

export interface RunnerClient extends Client {
prepareProcessor(
request: IRProcessor,
callback: (error: ServiceError | null, response: Empty) => void,
): ClientUnaryCall;
prepareProcessor(
request: IRProcessor,
metadata: Metadata,
callback: (error: ServiceError | null, response: Empty) => void,
): ClientUnaryCall;
prepareProcessor(
request: IRProcessor,
metadata: Metadata,
options: Partial<CallOptions>,
callback: (error: ServiceError | null, response: Empty) => void,
): ClientUnaryCall;
prepareStage(
load(
request: IRStage,
callback: (error: ServiceError | null, response: Empty) => void,
): ClientUnaryCall;
prepareStage(
load(
request: IRStage,
metadata: Metadata,
callback: (error: ServiceError | null, response: Empty) => void,
): ClientUnaryCall;
prepareStage(
load(
request: IRStage,
metadata: Metadata,
options: Partial<CallOptions>,
Expand Down
Loading

0 comments on commit d675bc2

Please sign in to comment.