Documentation
¶
Overview ¶
Package lifetime ties the operations an Environment runs to the Environment's own life, so Close can stop them and wait for them.
A process is tracked by the provider and ended by name. A transfer has no handle the caller holds, and it watched only the caller's context: Close returned while one ran on, finishing after it on some providers and failing as a retryable transport fault on another. An operation entered through a Lifetime runs on a context Close cancels, and Close does not return until every one of them has.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Lifetime ¶
type Lifetime struct {
// contains filtered or unexported fields
}
Lifetime is the life of one Environment. The zero value is not usable; call New.
func (*Lifetime) Close ¶
func (l *Lifetime) Close()
Close cancels every operation in flight, with invoke.ErrClosed as the cause, and waits for them to return. It is idempotent.
func (*Lifetime) Enter ¶
Enter begins an operation, returning the context it runs on and the function that ends it, which the caller must call. The context ends with the caller's or when the Environment closes, whichever comes first. A closed Lifetime refuses with an error wrapping invoke.ErrClosed.