Help us shape the future of Go! Take the 2026 Go Developer Survey

gateway

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Overview

Package gateway is the capability gateway and operation ledger for work-tracker connections (§10.1, §10.3, contracts.md "Gateway and operation ledger"). An operation id is recorded before any side effect, duplicate idempotency keys return the recorded operation instead of re-executing, and a lost response is resolved by read-back or recorded as unknown, never blindly replayed (A10).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrForbidden = errors.New("operation not granted")
	ErrInvalid   = errors.New("invalid request")
)

Functions

This section is empty.

Types

type Gateway

type Gateway struct {
	Ledger   Ledger
	Trackers Trackers
	Metrics  *metrics.Metrics
	Log      *slog.Logger
	// Attempts bounds tries of a retryable failure; Backoff is the first delay.
	Attempts int
	Backoff  time.Duration
}

Gateway invokes tracker operations on behalf of seats.

func (*Gateway) Invoke

func (g *Gateway) Invoke(ctx context.Context, req Request) (*runtimeapi.Operation, error)

Invoke runs the gateway algorithm and returns the recorded operation.

type Ledger

type Ledger interface {
	BeginOperation(ctx context.Context, f store.Fence, in store.NewOperation) (*runtimeapi.Operation, bool, error)
	FinishOperation(ctx context.Context, id, status, receipt string, result json.RawMessage, errText string, attempts int) error
}

Ledger is the durable operation record.

type Request

type Request struct {
	Seat           *store.Seat
	Generation     int64
	ExecutionID    string
	Connection     string
	Operation      string
	Params         json.RawMessage
	IdempotencyKey string
}

Request is one connections.invoke call.

type Trackers

type Trackers interface {
	Tracker(orgID, key string) (connectors.Tracker, error)
}

Trackers resolves a connection's tracker adapter.

Jump to

Keyboard shortcuts

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