Add a broker-neutral service registry contract (Endpoint, EventKind, Event, ServiceRegistry, ErrNotInstalled) and a NATS JetStream KV implementation, plus the registration side a service uses to announce itself. The contract's governing semantic -- NotInstalled is not Down -- is modeled by two buckets: a durable installed marker (never expires) distinct from expiring heartbeat keys. Instances heartbeat their key on an interval; a stopped process leaves via TTL expiry. Register writes the marker once then heartbeats; Resolve returns ErrNotInstalled only when the marker is absent, and an empty roster for installed-but-down. Watch dedupes heartbeat refreshes so it emits membership changes, not liveness pings. Unwired: no daemon/bootstrap path consumes it yet. Deliberately uses a dot key separator instead of the research sketch's slash so per-service watch wildcards match.
12 lines
436 B
Go
12 lines
436 B
Go
package nats
|
|
|
|
import "errors"
|
|
|
|
// ErrInvalidConfig reports a Config that cannot produce a usable client.
|
|
//
|
|
// The delivery-outcome sentinel a caller matches on -- NotInstalled -- belongs
|
|
// to the broker-neutral contract in internal/servicediscovery, so a caller can
|
|
// handle it without knowing which registry is in use. This package returns
|
|
// that, not a copy of it.
|
|
var ErrInvalidConfig = errors.New("nats: invalid configuration")
|