transport

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package transport is the small integration boundary between Flow and concrete transport libraries.

A transport library contributes an action.Library through Register and may expose three kinds of behavior:

  • runtime actions and streams, returned by its factory;
  • DSL binding resolvers, represented by actions routed with OnDSL;
  • listener entry points, represented by actions routed with OnTrigger.

The compiler resolves DSL bindings through ResolveModifier. A runner can locate a listener through FindTrigger. Transport-specific connections, subscriptions, shutdown, and retries remain inside the concrete transport action; this package does not own goroutines or network clients.

The cold path is intentionally dynamic: @require options are decoded from string values and action bindings are type-erased. The execution path after resolution is the typed Kernel action or stream selected by the transport.

The contract is deliberately limited to:

  • Register, Load, and KnownPrefixes for libraries;
  • Decode for typed @require configuration;
  • OnDSL and OnTrigger for binding discovery;
  • ResolveModifier, FindTrigger, RequireTrigger, and AsLibrary for assembly.

No concrete protocol belongs in this package. HTTP, NATS, CLI, cron, and other transports are separate modules that depend on this boundary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsLibrary added in v0.9.0

func AsLibrary(v any) action.Library

AsLibrary normalizuje dowolny workload (Action, StreamAction, Library, slice) do action.Library.

func Decode

func Decode[T any](ctx context.Context, raw map[string]string) (T, error)

Decode maps a raw string map into a typed options struct.

flow:"key"        key name in the @require block
default:"..."     value used when the key is absent
validate:"..."    ecosystem validator tag (required, url, min, …)

Unknown keys are rejected. Values that fail `validate` are returned as xerr.Validation with structured details.

func FindTrigger added in v0.9.0

func FindTrigger(target any, protocol string) (action.AnyAction, bool)

FindTrigger wyszukuje akcję z bindingiem OnTrigger(protocol) w dowolnym rejestrze lub liście akcji.

func KnownPrefixes

func KnownPrefixes() []string

KnownPrefixes returns sorted list of all registered transport prefixes

func Load added in v0.9.0

func Load(ctx context.Context, prefix string, raw map[string]string) (action.Library, error)

func OnDSL added in v0.9.0

func OnDSL(kind string) action.Binding

func OnTrigger added in v0.9.0

func OnTrigger(protocol string) action.Binding

func Register added in v0.9.0

func Register[T any](prefix string, factory Factory[T])

func RequireTrigger added in v0.9.0

func RequireTrigger(target any, protocol string) (action.AnyAction, error)

RequireTrigger zwraca akcję triggera lub błąd.

func ResolveModifier added in v0.9.0

func ResolveModifier(ctx context.Context, reg *action.Registry, binding *dslparse.TransportBinding) (action.Binding, bool, error)

ResolveModifier finds the registered resolver for a parsed transport binding (for example :route= or :nats=) and passes the complete binding through so adapters retain protocol-specific fields.

Types

type DSLBinding added in v0.9.0

type DSLBinding struct{ Kind string }

DSLBinding oznacza akcję odpowiedzialną za rezolucję konkretnego modyfikatora DSL.

type Factory added in v0.9.0

type Factory[T any] func(context.Context, T) (action.Library, error)

type Modifier added in v0.9.0

type Modifier = dslparse.Modifier

Modifier alias to dslparse.Modifier

type RuntimeAction added in v0.9.0

type RuntimeAction func(context.Context, Workload) (any, error)

RuntimeAction to sygnatura akcji nasłuchującej w transporcie.

type TriggerBinding added in v0.9.0

type TriggerBinding struct{ Protocol string }

TriggerBinding oznacza akcję będącą punktem wejścia dla danego protokołu.

type Workload added in v0.9.0

type Workload = any

Workload to uniwersalne wejście dla akcji triggera. Może to być:

  • action.Library (zbiór akcji i streamów)
  • action.AnyAction (pojedyncza akcja)
  • action.AnyStreamAction (pojedynczy strumień!)
  • []action.AnyAction

Jump to

Keyboard shortcuts

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