Documentation
¶
Overview ¶
Package leglifecycle owns A-leg scoped cancellation and B-leg teardown policy.
Package leglifecycle B-leg attempt lifecycle coordinator.
Index ¶
- Constants
- Variables
- type ALeg
- func (a *ALeg) BeginBLegLaunch(parent context.Context, bLegID string) (context.Context, *LaunchPermit, error)
- func (a *ALeg) Cancel(ctx context.Context, cause CancelCause) error
- func (a *ALeg) End()
- func (a *ALeg) Err() error
- func (a *ALeg) RegisterBLeg(ctx context.Context, h BLegHandle) error
- func (a *ALeg) ReleaseBLeg(id string)
- type BLegAttempt
- type BLegHandle
- type CancelCause
- type CancelKind
- type CancelMode
- type CancelResult
- type CloseOnlyAttempt
- type Coordinator
- type CoordinatorConfig
- type LaunchCommitResult
- type LaunchPermit
Constants ¶
View Source
const ( CancelExplicit = lipapi.CancelExplicit CancelClientGone = lipapi.CancelClientGone CancelContextDone = lipapi.CancelContextDone CancelRaceLoser = lipapi.CancelRaceLoser )
View Source
const ( CancelModeNone = lipapi.CancelModeNone CancelModeProvider = lipapi.CancelModeProvider CancelModeTransport = lipapi.CancelModeTransport CancelModeCloseOnly = lipapi.CancelModeCloseOnly )
View Source
const DefaultCancelTimeout = 2 * time.Second
DefaultCancelTimeout bounds B-leg Cancel when CoordinatorConfig.CancelTimeout is unset.
Variables ¶
View Source
var ErrALegCanceled = errors.New("leglifecycle: a-leg canceled")
Functions ¶
This section is empty.
Types ¶
type ALeg ¶
type ALeg struct {
// contains filtered or unexported fields
}
func (*ALeg) BeginBLegLaunch ¶
func (*ALeg) RegisterBLeg ¶
func (a *ALeg) RegisterBLeg(ctx context.Context, h BLegHandle) error
func (*ALeg) ReleaseBLeg ¶
type BLegAttempt ¶
type BLegAttempt = lipapi.ManagedEventStream
type BLegHandle ¶
type BLegHandle struct {
ID string
Attempt BLegAttempt
}
type CancelCause ¶
type CancelCause = lipapi.CancelCause
type CancelKind ¶
type CancelKind = lipapi.CancelKind
type CancelMode ¶
type CancelMode = lipapi.CancelMode
type CancelResult ¶
type CancelResult = lipapi.CancelResult
func BoundedCancelAndClose ¶
func BoundedCancelAndClose( parent context.Context, timeout time.Duration, cancelFn func(context.Context) CancelResult, closeFn func() error, force <-chan struct{}, ) (CancelResult, error)
BoundedCancelAndClose requires Close to promptly return and unblock Cancel.
type CloseOnlyAttempt ¶
type CloseOnlyAttempt struct {
Closer interface{ Close() error }
}
func (CloseOnlyAttempt) Cancel ¶
func (a CloseOnlyAttempt) Cancel(context.Context, CancelCause) CancelResult
func (CloseOnlyAttempt) Close ¶
func (a CloseOnlyAttempt) Close() error
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
func NewCoordinator ¶
func NewCoordinator(cfg CoordinatorConfig) *Coordinator
func (*Coordinator) CancelALeg ¶
func (c *Coordinator) CancelALeg(ctx context.Context, id string, cause CancelCause) error
func (*Coordinator) EndALeg ¶
func (c *Coordinator) EndALeg(id string)
func (*Coordinator) StartALeg ¶
func (c *Coordinator) StartALeg(id string) *ALeg
type CoordinatorConfig ¶
type LaunchCommitResult ¶
type LaunchCommitResult struct {
Canceled bool
Cause CancelCause
}
type LaunchPermit ¶
type LaunchPermit struct {
// contains filtered or unexported fields
}
func (*LaunchPermit) Abort ¶
func (p *LaunchPermit) Abort()
func (*LaunchPermit) Commit ¶
func (p *LaunchPermit) Commit(handle BLegAttempt) (LaunchCommitResult, error)
Click to show internal directories.
Click to hide internal directories.