runtime

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalValueKey

func CanonicalValueKey(value any) string

func RouteProgressTokenKey

func RouteProgressTokenKey(routeID string, token any) string

func RouteRequestKey

func RouteRequestKey(routeID string, requestID any) string

Types

type CompletedRequest

type CompletedRequest struct {
	RouteID      string    `json:"route_id"`
	RequestID    any       `json:"request_id"`
	RequestKey   string    `json:"request_key"`
	Method       string    `json:"method"`
	StartedAt    time.Time `json:"started_at"`
	CompletedAt  time.Time `json:"completed_at"`
	Cancelled    bool      `json:"cancelled,omitempty"`
	CancelReason string    `json:"cancel_reason,omitempty"`
	Error        string    `json:"error,omitempty"`
}

CompletedRequest is a durable record of a finished in-flight request.

type InFlightRequest

type InFlightRequest struct {
	RouteID          string    `json:"route_id"`
	RequestID        any       `json:"request_id"`
	RequestKey       string    `json:"request_key"`
	Method           string    `json:"method"`
	ProgressToken    any       `json:"progress_token,omitempty"`
	ProgressTokenKey string    `json:"progress_token_key,omitempty"`
	StartedAt        time.Time `json:"started_at"`
	CancelledAt      time.Time `json:"cancelled_at,omitempty"`
	CancelReason     string    `json:"cancel_reason,omitempty"`
	// contains filtered or unexported fields
}

type ProgressNotification

type ProgressNotification struct {
	RouteID          string    `json:"route_id"`
	ProgressToken    any       `json:"progress_token"`
	ProgressTokenKey string    `json:"progress_token_key"`
	RequestID        any       `json:"request_id,omitempty"`
	RequestKey       string    `json:"request_key,omitempty"`
	Progress         float64   `json:"progress"`
	Total            *float64  `json:"total,omitempty"`
	Message          string    `json:"message,omitempty"`
	LastMethod       string    `json:"last_method,omitempty"`
	UpdatedAt        time.Time `json:"updated_at"`
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() *Registry

func (*Registry) BeginRequest

func (r *Registry) BeginRequest(parent context.Context, routeID string, requestID any, method string, progressToken any) (context.Context, func(error))

BeginRequest registers a new in-flight request. The returned context is cancelled when the cleanup func is called or when Cancel is invoked. The cleanup func accepts an optional upstream error; pass nil on success. It appends a CompletedRequest to the durable history ring buffer.

func (*Registry) Cancel

func (r *Registry) Cancel(routeID string, requestID any, reason string) (bool, error)

func (*Registry) CancelReason

func (r *Registry) CancelReason(routeID string, requestID any) string

func (*Registry) ListHistory

func (r *Registry) ListHistory(routeID string) []CompletedRequest

ListHistory returns completed requests in chronological order (oldest first). An optional routeID filter limits results to a single route.

func (*Registry) ListInFlight

func (r *Registry) ListInFlight() []InFlightRequest

func (*Registry) ListProgress

func (r *Registry) ListProgress() []ProgressNotification

func (*Registry) StoreProgress

func (r *Registry) StoreProgress(routeID string, progressToken any, progress float64, total *float64, message string)

Jump to

Keyboard shortcuts

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