delivery

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package delivery performs a single HTTP delivery to a destination and classifies the result. The HTTP transport is injected so the classification core can be tested without real network calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Classify

func Classify(status int) core.Outcome

Classify maps an HTTP status code to a delivery outcome. 2xx succeeds; 429 and 5xx are retryable; every other non-2xx is permanent.

Types

type Doer

type Doer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer is the subset of *http.Client the engine needs.

type Engine

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

Engine delivers events over an injected HTTP client.

func New

func New(client Doer) *Engine

New returns an Engine using the given HTTP client.

func (*Engine) Deliver

func (e *Engine) Deliver(ctx context.Context, event core.Event, dest core.Destination) Result

Deliver POSTs the event body to the destination, forwarding the captured headers, and classifies the response. A transport error is retryable.

type Result

type Result struct {
	Outcome    core.Outcome
	StatusCode int           // 0 when no response was received
	Snippet    string        // truncated response body
	Duration   time.Duration // wall-clock time of the attempt
	RetryAfter time.Duration // from a 429 Retry-After header, if present
}

Result is the outcome of one delivery attempt.

Jump to

Keyboard shortcuts

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