Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
igalshilman committed Mar 6, 2024
1 parent 339f622 commit 2768d19
Show file tree
Hide file tree
Showing 31 changed files with 664 additions and 1,229 deletions.
6 changes: 0 additions & 6 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: restatedev
repository: proto
commit: 6ea2d15aed8f408590a1465844df5a8e
digest: shake256:e6599809ff13490a631f87d1a4b13ef1886d1bd1c0aa001ccb92806c0acc373d047a6ead761f8a21dfbd57a4fd9acd5915a52e47bd5b4e4a02dd1766f78511b3
4 changes: 2 additions & 2 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: v1
deps:
- buf.build/restatedev/proto
#deps:
# - buf.build/restatedev/proto
build:
excludes:
- node_modules
Expand Down
6 changes: 3 additions & 3 deletions examples/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ const greeter = restate.router({
greet: async (ctx: restate.Context, name: string) => {
// blocking RPC call to a keyed service (here supplying type and path separately)
const countSoFar = await ctx
.rpc<counterApiType>({ path: "counter" })
.object<counterApiType>({ path: "counter" }, name)
.count(name);

const message = `Hello ${name}, for the ${countSoFar + 1}th time!`;

// sending messages to ourselves, immediately and delayed
ctx.send(greeterApi).logger(message);
ctx.sendDelayed(greeterApi, 100).logger("delayed " + message);
ctx.serviceSend(greeterApi).logger(message);
ctx.serviceSendDelayed(greeterApi, 100).logger("delayed " + message);

return message;
},
Expand Down
52 changes: 0 additions & 52 deletions examples/handler_example.ts

This file was deleted.

48 changes: 0 additions & 48 deletions proto/discovery.proto

This file was deleted.

49 changes: 0 additions & 49 deletions proto/dynrpc.proto

This file was deleted.

18 changes: 14 additions & 4 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ export interface Context {
* const result2 = await ctx.rpc(myApi).anotherAction(1337);
* ```
*/
rpc<M>(opts: ServiceApi<M>): Client<M>;
service<M>(opts: ServiceApi<M>): Client<M>;

object<M>(opts: ServiceApi<M>, key: string): Client<M>;

/**
* Makes a type-safe one-way RPC to the specified target service. This method effectively behaves
Expand Down Expand Up @@ -290,7 +292,8 @@ export interface Context {
* ctx.send(myApi).anotherAction(1337);
* ```
*/
send<M>(opts: ServiceApi<M>): SendClient<M>;
objectSend<M>(opts: ServiceApi<M>, key: string): SendClient<M>;
serviceSend<M>(opts: ServiceApi<M>): SendClient<M>;

/**
* Makes a type-safe one-way RPC to the specified target service, after a delay specified by the
Expand Down Expand Up @@ -337,7 +340,12 @@ export interface Context {
* ctx.sendDelayed(myApi, 60_000).anotherAction(1337);
* ```
*/
sendDelayed<M>(opts: ServiceApi<M>, delay: number): SendClient<M>;
objectSendDelayed<M>(
opts: ServiceApi<M>,
delay: number,
key: string
): SendClient<M>;
serviceSendDelayed<M>(opts: ServiceApi<M>, delay: number): SendClient<M>;
}

/**
Expand All @@ -352,7 +360,9 @@ export interface Context {
* This context can be used only within keyed services/routers.
*
*/
export interface KeyedContext extends Context, KeyValueStore {}
export interface KeyedContext extends Context, KeyValueStore {
key(): string;
}

export interface Rand {
/**
Expand Down
Loading

0 comments on commit 2768d19

Please sign in to comment.