Documentation
¶
Overview ¶
Package lifecycle tracks whether a [synapse.Client] has been closed so that services derived from it can refuse new work with a clear error rather than making RPC calls on a closed ethclient.
Lifecycle is shared between the root Client and all of its services: Client.Close marks the Lifecycle closed; each service's public methods fail fast with ErrClosed while still being safe for concurrent use.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("synapse: client closed")
ErrClosed is returned from any service method called after the owning Client's Close has executed.
Functions ¶
This section is empty.
Types ¶
type Lifecycle ¶
type Lifecycle struct {
// contains filtered or unexported fields
}
Lifecycle is safe for concurrent use. The zero value is a usable, unclosed lifecycle. A nil receiver is treated as a permanently-open lifecycle so services used without a root Client (e.g. in tests) skip the closed check entirely.
func (*Lifecycle) CheckClosed ¶
CheckClosed returns ErrClosed if the lifecycle has been closed. Nil-safe.