Documentation
¶
Index ¶
- Variables
- func ConfirmedOutputRef(response PollResponse) (string, error)
- func EventsConfirmedOutputPayload(events any, cursors map[string]int64) (json.RawMessage, error)
- func EventsConfirmedOutputRef(events any, cursors map[string]int64) (string, error)
- func EventsPendingOutputRef(state EventsPendingState) (string, error)
- func ExpectedStateDigestFromOutputRef(ref string) (string, error)
- func PendingOutputRef(response PollResponse) (string, error)
- type Adapter
- type EventSubscriptionRef
- type EventsPendingState
- type Outcome
- type OutputRef
- type PollRequest
- type PollResponse
- type Poller
- type PollerFunc
- type TickRequest
- type TickResult
- type Transition
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPollerRequired reports a missing watch-source poll dependency. ErrPollerRequired = errors.New("loop watch poller is required") // ErrSpecRequired reports an empty watch-source spec. ErrSpecRequired = errors.New("loop watch spec is required") // ErrSpecInvalid reports a malformed watch-source spec. ErrSpecInvalid = errors.New("loop watch spec is invalid") )
Functions ¶
func ConfirmedOutputRef ¶
func ConfirmedOutputRef(response PollResponse) (string, error)
ConfirmedOutputRef stores the confirmed ready payload as the source node output.
func EventsConfirmedOutputPayload ¶
EventsConfirmedOutputPayload returns the complete confirmed watch-events JSON payload. Callers may persist it inline or by content-addressed output ref.
func EventsConfirmedOutputRef ¶
EventsConfirmedOutputRef stores the confirmed watch-events batch inline.
func EventsPendingOutputRef ¶
func EventsPendingOutputRef(state EventsPendingState) (string, error)
EventsPendingOutputRef stores rendered subscriptions and stream cursors while a watch-events loop is dormant.
func ExpectedStateDigestFromOutputRef ¶
ExpectedStateDigestFromOutputRef recovers the prior state digest for the next poll.
func PendingOutputRef ¶
func PendingOutputRef(response PollResponse) (string, error)
PendingOutputRef stores the last observed source digest while a loop is watching.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter runs one callback-free poll -> ready -> settle -> confirm claim cycle.
func NewAdapter ¶
NewAdapter constructs a watch-source adapter for coordinator claims.
func (*Adapter) Tick ¶
func (a *Adapter) Tick(ctx context.Context, req TickRequest) (TickResult, error)
Tick runs exactly one watch-source claim cycle. It never parks a goroutine.
type EventSubscriptionRef ¶
type EventSubscriptionRef struct {
Kind string `json:"kind"`
Filter string `json:"filter,omitempty"`
}
EventSubscriptionRef is the durable subscription shape stored while a watch-events node is parked.
type EventsPendingState ¶
type EventsPendingState struct {
Subscriptions []EventSubscriptionRef `json:"subscriptions"`
Cursors map[string]int64 `json:"cursors"`
}
EventsPendingState is the parked watch-events output_ref state.
func EventsPendingFromOutputRef ¶
func EventsPendingFromOutputRef(ref string) (EventsPendingState, bool, error)
EventsPendingFromOutputRef recovers parked watch-events state.
type OutputRef ¶
type OutputRef struct {
Kind string `json:"kind"`
StateDigest string `json:"state_digest,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
SettledAt *time.Time `json:"settled_at,omitempty"`
Subscriptions []EventSubscriptionRef `json:"subscriptions,omitempty"`
Cursors map[string]int64 `json:"cursors,omitempty"`
Events json.RawMessage `json:"events,omitempty"`
}
OutputRef is the JSON payload persisted in loop_generation_outputs.output_ref for coordinator-owned watch nodes.
type PollRequest ¶
type PollRequest struct {
Spec json.RawMessage `json:"spec"`
ExpectedStateDigest string `json:"expected_state_digest,omitempty"`
}
PollRequest is the daemon -> extension watch/poll service payload.
type PollResponse ¶
type PollResponse struct {
Ready bool `json:"ready"`
StateDigest string `json:"state_digest,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
SettledAt *time.Time `json:"settled_at,omitempty"`
}
PollResponse is the extension -> daemon watch/poll service result.
type Poller ¶
type Poller interface {
Poll(ctx context.Context, req PollRequest) (PollResponse, error)
}
Poller calls one watch-source provider for a coordinator-owned poll cycle.
type PollerFunc ¶
type PollerFunc func(context.Context, PollRequest) (PollResponse, error)
PollerFunc adapts a function to Poller.
func (PollerFunc) Poll ¶
func (f PollerFunc) Poll(ctx context.Context, req PollRequest) (PollResponse, error)
Poll implements Poller.
type TickRequest ¶
type TickRequest struct {
Spec json.RawMessage
ExpectedStateDigest string
LastProgressAt time.Time
SilenceWindow time.Duration
Now time.Time
}
TickRequest carries durable re-entry state plus the current poll input.
type TickResult ¶
type TickResult struct {
Outcome Outcome
Response PollResponse
Transitions []Transition
}
TickResult is the adapter result consumed by the loop coordinator.
type Transition ¶
Transition records one ephemeral FSM transition from a coordinator-owned tick.