Documentation
¶
Overview ¶
Package core holds the domain types shared across the gateway modules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackoffConfig ¶
type BackoffConfig struct {
BaseDelay time.Duration `json:"base_delay"`
Multiplier float64 `json:"multiplier"`
MaxDelay time.Duration `json:"max_delay"`
MaxAttempts int `json:"max_attempts"`
}
BackoffConfig controls retry timing.
type DeliveryAttempt ¶
type DeliveryAttempt struct {
ID string
EventID string
DestinationID string
AttemptNumber int
StatusCode int // 0 when no response was received
ResponseSnippet string
DurationMS int64
Outcome Outcome
IsReplay bool
AttemptedAt time.Time
}
DeliveryAttempt records the result of one delivery try.
type DeliveryState ¶
type DeliveryState string
DeliveryState is the pending-or-terminal state of an (event, destination) delivery in the queue.
const ( StatePending DeliveryState = "pending" StateDelivered DeliveryState = "delivered" StateDeadLetter DeliveryState = "dead_letter" )
type Destination ¶
type Destination struct {
ID string
Source string
URL string
Enabled bool
FilterSpec *FilterSpec // nil matches everything
Backoff *BackoffConfig // nil uses the gateway default
CreatedAt time.Time
}
Destination is a target the gateway forwards matching events to.
type Event ¶
type Event struct {
ID string
Source string
ReceivedAt time.Time
SourceIP string
Method string
Path string
Query string
Headers map[string][]string
Body []byte
DedupKey string // empty when the provider supplied none
Status EventStatus
}
Event is a captured inbound request.
type EventStatus ¶
type EventStatus string
EventStatus is the capture status of an inbound request.
const ( StatusReceived EventStatus = "received" StatusRejected EventStatus = "rejected" )
type FilterSpec ¶
type FilterSpec struct {
BodyEquals map[string]string `json:"body_equals,omitempty"`
HeaderEquals map[string]string `json:"header_equals,omitempty"`
BodyExists []string `json:"body_exists,omitempty"` // path must be present
BodyIn map[string][]string `json:"body_in,omitempty"` // value must be in the list
BodyPrefix map[string]string `json:"body_prefix,omitempty"` // value must start with the prefix
BodyNot map[string]string `json:"body_not,omitempty"` // value must not equal
}
FilterSpec is a destination's routing filter. All clauses must match (AND); an empty spec matches every event. Body clauses address a JSON field by a dot-separated path (e.g. "data.object.status").
type PendingDelivery ¶
type PendingDelivery struct {
ID string
EventID string
DestinationID string
AttemptNumber int
NextAttemptAt time.Time
State DeliveryState
IsReplay bool
}
PendingDelivery is a queued delivery for an (event, destination) pair.