Documentation
¶
Overview ¶
Package takt provides the abstract proactor execution model via algebraic effects on code.hybscloud.com/kont.
takt dispatches effect operations through an F-bounded Dispatcher with full iox outcome classification.
Execution Strategies ¶
- Blocking: Exec/ExecExpr wait on ErrWouldBlock
- Stepping: Step and Advance evaluate one effect at a time for proactor integration
- Event loop: Loop drives computations through a Backend (submit/poll)
iox Classification ¶
- nil: completed
- code.hybscloud.com/iox.ErrMore: progress, more completions expected
- code.hybscloud.com/iox.ErrWouldBlock: no progress, retry later
- failure: infrastructure error
Error Handling ¶
ExecError/ExecErrorExpr/StepError/AdvanceError compose Dispatcher and kont Error effects. Dispatch order: Error → Dispatcher. Results are code.hybscloud.com/kont.Either — Right on success, Left on Throw.
Bridge ¶
Index ¶
- func Advance[D Dispatcher[D], R any](d D, susp *kont.Suspension[R]) (R, *kont.Suspension[R], error)
- func AdvanceError[E any, D Dispatcher[D], R any](d D, susp *kont.Suspension[kont.Either[E, R]]) (kont.Either[E, R], *kont.Suspension[kont.Either[E, R]], error)
- func Exec[D Dispatcher[D], R any](d D, m kont.Eff[R]) R
- func ExecError[E any, D Dispatcher[D], R any](d D, m kont.Eff[R]) kont.Either[E, R]
- func ExecErrorExpr[E any, D Dispatcher[D], R any](d D, m kont.Expr[R]) kont.Either[E, R]
- func ExecExpr[D Dispatcher[D], R any](d D, m kont.Expr[R]) R
- func Reflect[A any](m kont.Expr[A]) kont.Eff[A]
- func Reify[A any](m kont.Eff[A]) kont.Expr[A]
- func Step[R any](m kont.Expr[R]) (R, *kont.Suspension[R])
- func StepError[E, R any](m kont.Expr[R]) (kont.Either[E, R], *kont.Suspension[kont.Either[E, R]])
- type Backend
- type Completion
- type Dispatcher
- type Loop
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Advance ¶
func Advance[D Dispatcher[D], R any](d D, susp *kont.Suspension[R]) (R, *kont.Suspension[R], error)
Advance dispatches one suspended operation via a Dispatcher. IsProgress: suspension consumed. WouldBlock/failure: unconsumed.
func AdvanceError ¶
func AdvanceError[E any, D Dispatcher[D], R any](d D, susp *kont.Suspension[kont.Either[E, R]]) (kont.Either[E, R], *kont.Suspension[kont.Either[E, R]], error)
AdvanceError dispatches the suspended operation. Error ops: eager (Throw → Discard + Left). Dispatcher ops: full iox classification.
func Exec ¶
func Exec[D Dispatcher[D], R any](d D, m kont.Eff[R]) R
Exec runs a Cont-world computation to completion via a Dispatcher.
func ExecError ¶
ExecError runs a Cont-world computation with error handling. Returns Right on success, Left on Throw.
func ExecErrorExpr ¶
ExecErrorExpr is the Expr-world ExecError. Blocks on iox.ErrWouldBlock via adaptive backoff (iox.Backoff).
func ExecExpr ¶
func ExecExpr[D Dispatcher[D], R any](d D, m kont.Expr[R]) R
ExecExpr runs an Expr-world computation to completion via a Dispatcher.
Types ¶
type Backend ¶
type Backend[B Backend[B]] interface { // Submit sends an operation. Returns a correlation token. Submit(op kont.Operation) (Token, error) // Poll writes ready completions into completions. Returns count. Poll(completions []Completion) int }
Backend is the F-bounded interface for async submit/poll.
type Completion ¶
Completion carries a backend result with iox outcome.
type Dispatcher ¶
Dispatcher is the F-bounded interface for non-blocking operation dispatch. Returns (value, nil) on success, or (nil, error) at the iox boundary.
type Loop ¶
Loop drives Expr computations through a Backend.
func NewLoop ¶
NewLoop creates an event loop with the given backend and maximum completions polled per tick.