stack

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package stack opens what the example's two programs share, from the environment: the Temporal connection, the Postgres pool and the session stores on it, the model client, and the key of the workers' live endpoints. The host and the worker must agree on all of it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stack

type Stack struct {
	Temporal  client.Client
	Pool      *pgxpool.Pool
	Store     session.Store
	Secrets   session.SecretStorage
	Events    *sessionpg.EventLog
	Model     tacklr.Model
	TaskQueue string
	LiveKey   []byte
	// contains filtered or unexported fields
}

Stack is the shared part of both programs. The session events go to the Postgres EventLog (DisableStreams on both halves), so they need no Temporal feature beyond workflows and activities.

func Open

func Open(ctx context.Context, service string) (*Stack, error)

Open reads the environment:

DATABASE_URL      Postgres (required)
SEAL_KEY          32 bytes in base64: seals users' tokens (required)
LIVE_KEY          base64: signs live delta streams (required)
MODEL             the model id (required)
ANTHROPIC_API_KEY the key of a Claude model, or
OPENAI_API_KEY    the key of an OpenAI-compatible model (one is required)
ANTHROPIC_BASE_URL, OPENAI_BASE_URL
                  the model's endpoint (optional)
TEMPORAL_ADDRESS  default localhost:7233
TASK_QUEUE        default tacklr
OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL
                  where traces, metrics and logs go (optional)

service names the program in its telemetry. The program's slog records go to stderr and, with the trace and span of their context, to the OpenTelemetry logs.

func (*Stack) Close

func (s *Stack) Close()

Close releases the connections, and sends what telemetry holds.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL