greeter

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package greeter is the service's domain component: it serves HelloService over every public protocol with one implementation.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSalute = errors.New("salute must not be empty")
	ErrSuffix = errors.New("suffix must be at most 8 characters on one line")
	// ErrStalled: the report loop has not ticked for three periods.
	ErrStalled = errors.New("greeter: report loop stalled")
)

Errors of Validate.

Functions

This section is empty.

Types

type Config

type Config struct {
	Salute string `json:"salute" schemapb:"default=Hello;description=Word before the name"`
	// Live: editable from the console, applied without restart.
	Suffix  config.Live[string] `json:"suffix"  schemapb:"default=!;description=Appended to every greeting"`
	Excited config.Live[bool]   `json:"excited" schemapb:"default=false"`
}

Config of the greeter.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks what the schema cannot: Open fails on it, and a live update it rejects (a suffix of nine characters) is not applied.

type Greeter

type Greeter struct {
	hellov1.UnimplementedHelloServiceServer
	deps.Component
	// contains filtered or unexported fields
}

Greeter is a component: a named node with its own logger, tracer and meter.

func New

func New(parent deps.Scope, cfg *Config, db deps.Dependency[*store.DB]) (*Greeter, error)

New creates the greeter under parent; everything it needs is passed in, the events it raises it declares itself.

func (*Greeter) Alive

func (g *Greeter) Alive(context.Context) error

Alive is the greeter's liveness check: the report loop, once started, keeps ticking.

func (*Greeter) Countdown

Countdown implements HelloService.

func (*Greeter) Greet

Greet implements HelloService.

func (*Greeter) Ready

func (g *Greeter) Ready(ctx context.Context) error

Ready is the greeter's readiness check: its templates build.

func (*Greeter) Register

func (g *Greeter) Register(r grpc.ServiceRegistrar)

Register is the one registration for native gRPC and ws-proto.

func (*Greeter) Text

func (g *Greeter) Text(ctx context.Context, name string) (string, error)

Text renders and audits a greeting.

Jump to

Keyboard shortcuts

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