peers

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package peers lets one doze-aws service reach its siblings — SNS delivering to SQS queues, EventBridge dispatching to targets, Lambda destinations — without caring how the deployment is wired. A Directory answers "how do I speak HTTP to service X?" identically across the three real topologies:

  • one process serving everything (the doze-aws binary, or an embedded Stack): InProcess dispatches straight into the sibling handler, no sockets involved;
  • one child process per service on unix sockets (how doze runs the services): UnixSockets / FromEnv;
  • services on plain TCP endpoints: FromEnv via AWS_ENDPOINT_URL_*.

Cross-service delivery is always best-effort and late-bound: a service with no directory entry for a peer logs and drops, it never fails to start.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directory

type Directory interface {
	Endpoint(service string) (Endpoint, bool)
}

Directory resolves sibling services. ok is false when the deployment has no wiring for that service (callers degrade gracefully).

func FromEnv

func FromEnv() Directory

FromEnv resolves peers from the environment at call time (late-bound, so a child process started before its peers still finds them):

DOZE_<SERVICE>_SOCKET      unix socket path (doze child-process wiring)
AWS_ENDPOINT_URL_<SERVICE> per-service TCP endpoint (SDK-standard variable)
AWS_ENDPOINT_URL           shared endpoint, e.g. a doze-aws gateway

func InProcess

func InProcess(resolve func(service string) http.Handler) Directory

InProcess wires peers within a single process: requests round-trip straight into the sibling's http.Handler with no network. resolve returns nil for services that aren't running.

func None

func None() Directory

None is an empty directory: every lookup misses. It is what a service sees when cross-service delivery is deliberately disabled.

func UnixSockets

func UnixSockets(sockets map[string]string) Directory

UnixSockets wires peers as HTTP-over-unix-socket endpoints, one socket per service — the shape doze's per-instance child processes use.

type Endpoint

type Endpoint struct {
	Client  *http.Client
	BaseURL string
}

Endpoint is how to reach one service: an HTTP client and the base URL to address it with. The service behind it speaks its normal AWS wire protocol.

func (Endpoint) URL

func (e Endpoint) URL(path string) string

URL joins an endpoint's base URL with a request path.

type Static

type Static map[string]Endpoint

Static wires an explicit service→Endpoint map (tests, custom embeddings).

func (Static) Endpoint

func (s Static) Endpoint(service string) (Endpoint, bool)

Jump to

Keyboard shortcuts

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