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

pool

package
v0.49.0 Latest Latest
Warning

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

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

Documentation

Overview

Package pool provides the `@pool NAME [member1, member2] { strategy: "round_robin" }` directive. Each declaration is materialized as a callable `pool.<name>` action.

Typical use:

@pool workers [const, noop] { strategy: "failover" }
pool.workers @{ value: "x" }

Index

Constants

View Source
const ID = "pool"

Variables

View Source
var Directive = compiler.Directive{
	Name:        "pool",
	Example:     `@pool fast [cheap, mid] { strategy: "round_robin" }`,
	Handler:     handleDirective,
	OpaqueBlock: true,
}

Directive parses `@pool NAME [members] { options }` and appends a Declaration to meta["pools"].

Functions

func Bundle

func Bundle(_ map[string]string) compiler.Bundle

func PoolsFromMeta

func PoolsFromMeta(meta map[string]any) map[string][]string

PoolsFromMeta reduces the declarations to a canonical name → members map used by the dispatch action.

Types

type Declaration

type Declaration struct {
	Name     string
	Members  []compiler.CapabilityRef
	Strategy string
	Options  map[string]string
	Position compiler.Position
}

Declaration is the parsed form of a single `@pool NAME [...] { ... }` directive. Members are statically resolved capability references; canonical names are checked when the pool is materialized.

func DeclarationsFromMeta

func DeclarationsFromMeta(meta map[string]any) []Declaration

DeclarationsFromMeta returns the list of @pool declarations in the order they appeared. Nil-safe.

Jump to

Keyboard shortcuts

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