Documentation
¶
Overview ¶
Package executionregistry tracks Home-dispatched executions for one subscriber lifetime.
Index ¶
- Variables
- type Freeze
- type Observation
- type PendingDispatch
- type Registry
- func (r *Registry) BeginDispatch() (*PendingDispatch, error)
- func (r *Registry) Close() error
- func (r *Registry) Drain(ctx context.Context) error
- func (r *Registry) FreezeInFlight(_ time.Time) Freeze
- func (r *Registry) Install(pending *PendingDispatch, spec ScopeSpec) (*Scope, error)
- func (r *Registry) ObserveBarrier(revision int64)
- func (r *Registry) SetReleaseSink(rawSink any)
- type ReleaseGroup
- type ReleaseSink
- type ReleaseTicket
- type Scope
- type ScopeSpec
- type State
Constants ¶
This section is empty.
Variables ¶
var ( ErrRegistryNotAccepting = errors.New("execution registry is not accepting dispatches") ErrRegistryClosed = errors.New("execution registry is closed") ErrInvalidPendingDispatch = errors.New("invalid pending dispatch") ErrInvalidExecutionResource = errors.New("invalid execution resource") ErrExecutionResourceAlreadyBound = errors.New("execution resource is already bound") )
Functions ¶
This section is empty.
Types ¶
type Freeze ¶
type Freeze struct {
Revision int64
BarrierRevision int64
Executions []Observation
}
Freeze is an immutable in-flight execution snapshot.
type Observation ¶
type Observation struct {
RequestID string
CredentialID string
Model string
RequestKind string
StartedAt time.Time
Accounted bool
}
Observation is an immutable in-flight execution snapshot entry.
type PendingDispatch ¶
type PendingDispatch struct {
// contains filtered or unexported fields
}
PendingDispatch reserves an execution slot until it is installed or ended.
func (*PendingDispatch) End ¶
func (p *PendingDispatch) End()
End releases a dispatch token that was not installed.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry owns all dispatches accepted during one Home subscriber lifetime.
func (*Registry) BeginDispatch ¶
func (r *Registry) BeginDispatch() (*PendingDispatch, error)
BeginDispatch reserves a dispatch token while the registry accepts traffic.
func (*Registry) Close ¶
Close permanently rejects new work and closes every currently bound resource.
func (*Registry) Drain ¶
Drain rejects new work, cancels active resources, and waits for all owners to end.
func (*Registry) FreezeInFlight ¶
FreezeInFlight copies all active executions into an immutable snapshot.
func (*Registry) Install ¶
func (r *Registry) Install(pending *PendingDispatch, spec ScopeSpec) (*Scope, error)
Install atomically turns a pending dispatch token into an active execution scope.
func (*Registry) ObserveBarrier ¶
ObserveBarrier records the latest Home observation barrier.
func (*Registry) SetReleaseSink ¶
SetReleaseSink replaces the cumulative release sink and replays every known group. Legacy callbacks remain supported but cannot provide acknowledgement tickets.
type ReleaseGroup ¶
ReleaseGroup identifies the cumulative release sequence for one accounted credential and model.
type ReleaseSink ¶
type ReleaseSink func(ReleaseGroup, int64) *ReleaseTicket
ReleaseSink receives the latest cumulative sequence for a release group and optionally returns an acknowledgement ticket.
type ReleaseTicket ¶
type ReleaseTicket struct {
Group ReleaseGroup
Sequence int64
// contains filtered or unexported fields
}
ReleaseTicket completes after Home acknowledges a cumulative release sequence.
func NewReleaseTicket ¶
func NewReleaseTicket(group ReleaseGroup, sequence int64, done <-chan struct{}) *ReleaseTicket
NewReleaseTicket creates a ticket backed by done. A nil done channel represents a release sink that does not support acknowledgements.
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope owns the resource for one installed execution.
func (*Scope) EndWithRelease ¶
func (s *Scope) EndWithRelease(_ string) *ReleaseTicket
EndWithRelease closes the scope and returns the release acknowledgement ticket. The release sink is invoked without the registry mutex held.