added g-counter support

This commit is contained in:
2023-04-13 00:43:44 +03:00
parent f644078a3a
commit 8bb6797e24
3 changed files with 138 additions and 39 deletions

View File

@ -13,28 +13,28 @@ import (
)
func main() {
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()
err := app(ctx)
if err != nil {
log.Fatalf("running app: %v", err)
}
os.Exit(0)
}
func app(ctx context.Context,) error {
node := maelstrom.NewNode()
srv, err := api.NewServer(node)
if err != nil {
return fmt.Errorf("making new server: %w", err)
}
err = srv.Run()
err := app(ctx)
if err != nil {
return fmt.Errorf("running server: %w", err)
log.Fatalf("running app: %v", err)
}
return nil
os.Exit(0)
}
func app(ctx context.Context) error {
node := maelstrom.NewNode()
srv, err := api.NewServer(ctx, node)
if err != nil {
return fmt.Errorf("making new server: %w", err)
}
err = srv.Run()
if err != nil {
return fmt.Errorf("running server: %w", err)
}
return nil
}