Skip to content

Instantly share code, notes, and snippets.

View igalshilman's full-sized avatar

Igal Shilman igalshilman

View GitHub Profile
import {
ObjectContext,
Rand,
service,
TerminalError,
type Context,
} from "@restatedev/restate-sdk";
class CircuitBreakerState {
constructor(
from fastapi import FastAPI
import restate
app = FastAPI()
@app.get("/")
async def foo():
return { "foo" : "bar" }
import { service, type Context } from "@restatedev/restate-sdk";
interface ServiceB {
greet: (ctx: Context, name: string) => Promise<string>;
}
const realServiceB = service({
name: "realServiceB",
handlers: {
export type Subscriber = {
service: string;
handler: string;
key?: string;
};
export const pubsub = restate.object({
name: "pubsub",
handlers: {
/**
import * as restate from "@restatedev/restate-sdk";
export type WorkItem = {
item: number; // compute item factorial
};
export type WorkRequest = {
awekable: string;
};
@igalshilman
igalshilman / compose.yml
Created November 28, 2024 12:08
A simple docker-compose for the distributed restate
services:
n1:
image: ghcr.io/restatedev/restate:main
ports:
- 8080:8080
- 9070:9070
- 5123:5123
restart: "no"
environment:
RESTATE_LOG_FILTER: restate=info
/*
* Copyright (c) 2023-2024 - Restate Software, Inc., Restate GmbH
*
* This file is part of the Restate SDK for Node.js/TypeScript,
* which is released under the MIT license.
*
* You can find a copy of the license in file LICENSE in the root
* directory of this repository or package, or at
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
*/
type TodoItem = {
title: string,
completed: boolean,
}
export default restate.object({
name : "todo",
handlers: {
add: async (ctx: ObjectContext, item: TodoItem) => {
const items = await ctx.get("items") ?? [];
Smoke Python Test
=================
from datetime import timedelta
from statefun import *
################################################################################
FROM ubuntu:latest
RUN apt-get update && apt-get install -y \
build-essential \
autoconf \
libtool \
pkg-config \
libprotobuf-dev \
protobuf-compiler \
protobuf-compiler-grpc \