sections

package
v0.6.38 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sections is discovery the product defines: a service offers a section — a proto message of the product's under a name — and any service follows that name across the installation, without a registry of its own.

sections.Offer(root, "komeet.module", &modulev1.Manifest{Name: "media", ...})

modules := sections.Follow[*modulev1.Manifest](root, "komeet.module")
for service, m := range modules.Get() { ... }

The section goes into the service's manifest. Backplane publishes, by name, the sections of every serving service (its highest serving version) to Consul KV backplane/sections/<name>; Follow watches that key while the service runs. Without Consul nothing is known.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Offer

func Offer(scope deps.Scope, name string, msg proto.Message)

Offer declares the service's section name with msg. A name is offered once per service; a msg that does not marshal is a declaration error (Run fails, Service.Validate reports it).

Types

type Ref

type Ref[T proto.Message] struct {
	// contains filtered or unexported fields
}

Ref follows one section name: the section of every serving service that offers it. Its methods are safe for concurrent use.

func Follow

func Follow[T proto.Message](scope deps.Scope, name string) Ref[T]

Follow follows section name, decoded as T (a pointer to a generated message). A service that offers name with another message is left out.

func (Ref[T]) Changes

func (r Ref[T]) Changes(ctx context.Context) <-chan struct{}

Changes signals after every change of the set until ctx ends; one pending signal at most.

func (Ref[T]) Get

func (r Ref[T]) Get() map[string]T

Get is the section of every serving service that offers it, by service; empty until known, or when none does.

func (Ref[T]) Known

func (r Ref[T]) Known() bool

Known reports whether the published set was read: false before the first read and without Consul.

Jump to

Keyboard shortcuts

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