diff --git a/breaker.go b/breaker.go index f3dbc6b..454ce24 100644 --- a/breaker.go +++ b/breaker.go @@ -15,7 +15,7 @@ type untypedCircuit interface { // observer is used to observe the result of a single wrapped call through the circuit breaker. type observer interface { - // observe is called after the wrapped function returns. If [Circuit.Do] returns a non-nil [Observable], it will be + // observe is called after the wrapped function returns. If [Circuit.Do] returns a non-nil [observer], it will be // called exactly once. observe(failure bool) } diff --git a/hoglet.go b/hoglet.go index 411f33b..66e98b3 100644 --- a/hoglet.go +++ b/hoglet.go @@ -45,9 +45,9 @@ type Breaker interface { connect(untypedCircuit) // observerForCall returns an observer for the incoming call. - // It is called exactly once per call to [Breaker.Do], before calling the wrapped function. + // It is called exactly once per call to [Circuit.Call], before calling the wrapped function. // If the breaker is open, it returns nil. - // If the breaker is closed, it returns a non-nil [Observable] that will be used to observe the result of the call. + // If the breaker is closed, it returns a non-nil [observer] that will be used to observe the result of the call. observerForCall(context.Context) (observer, error) } @@ -183,7 +183,7 @@ func (c *Circuit[IN, OUT]) Call(ctx context.Context, in IN) (out OUT, err error) var internalCancellation = errors.New("internal cancellation") // observeCtx observes the given context for cancellation and records it as a failure. -// It assumes [Observable.Observe] is idempotent and deduplicates calls itself. +// It assumes [observer] is idempotent and deduplicates calls itself. func (c *Circuit[IN, OUT]) observeCtx(obs observer, ctx context.Context) { // We want to observe a context error as soon as possible to open the breaker, but at the same time we want to // keep the call to the wrapped function synchronous to avoid all pitfalls that come with asynchronicity. diff --git a/hoglet_test.go b/hoglet_test.go index d10ab70..4031328 100644 --- a/hoglet_test.go +++ b/hoglet_test.go @@ -99,7 +99,7 @@ type mockObservable struct { once sync.Once } -// observe implements [Observer] +// observe implements [observer] func (mo *mockObservable) observe(failure bool) { mo.once.Do(func() { if mo.breaker != nil {