Skip to content

Commit b897fc5

Browse files
committed
fix: ring proxy methods on pattern ring_client
1 parent 0bfd0ad commit b897fc5

File tree

1 file changed

+7
-33
lines changed

1 file changed

+7
-33
lines changed

pkg/pattern/ring_client.go

+7-33
Original file line numberDiff line numberDiff line change
@@ -90,56 +90,30 @@ func (r *ringClient) Pool() *ring_client.Pool {
9090
return r.pool
9191
}
9292

93-
// StartAsync starts Service asynchronously. Service must be in New State, otherwise error is returned.
94-
// Context is used as a parent context for service own context.
9593
func (r *ringClient) StartAsync(ctx context.Context) error {
96-
return r.StartAsync(ctx)
94+
return r.ring.StartAsync(ctx)
9795
}
9896

99-
// AwaitRunning waits until service gets into Running state.
100-
// If service is in New or Starting state, this method is blocking.
101-
// If service is already in Running state, returns immediately with no error.
102-
// If service is in a state, from which it cannot get into Running state, error is returned immediately.
10397
func (r *ringClient) AwaitRunning(ctx context.Context) error {
104-
return r.AwaitRunning(ctx)
98+
return r.ring.AwaitRunning(ctx)
10599
}
106100

107-
// StopAsync tell the service to stop. This method doesn't block and can be called multiple times.
108-
// If Service is New, it is Terminated without having been started nor stopped.
109-
// If Service is in Starting or Running state, this initiates shutdown and returns immediately.
110-
// If Service has already been stopped, this method returns immediately, without taking action.
111101
func (r *ringClient) StopAsync() {
112-
r.StopAsync()
102+
r.ring.StopAsync()
113103
}
114104

115-
// AwaitTerminated waits for the service to reach Terminated or Failed state. If service is already in one of these states,
116-
// when method is called, method returns immediately.
117-
// If service enters Terminated state, this method returns nil.
118-
// If service enters Failed state, or context is finished before reaching Terminated or Failed, error is returned.
119105
func (r *ringClient) AwaitTerminated(ctx context.Context) error {
120-
return r.AwaitTerminated(ctx)
106+
return r.ring.AwaitTerminated(ctx)
121107
}
122108

123-
// FailureCase returns error if Service is in Failed state.
124-
// If Service is not in Failed state, this method returns nil.
125109
func (r *ringClient) FailureCase() error {
126-
return r.FailureCase()
110+
return r.ring.FailureCase()
127111
}
128112

129-
// State returns current state of the service.
130113
func (r *ringClient) State() services.State {
131-
return r.State()
114+
return r.ring.State()
132115
}
133116

134-
// AddListener adds listener to this service. Listener will be notified on subsequent state transitions
135-
// of the service. Previous state transitions are not replayed, so it is suggested to add listeners before
136-
// service is started.
137-
//
138-
// AddListener guarantees execution ordering across calls to a given listener but not across calls to
139-
// multiple listeners. Specifically, a given listener will have its callbacks invoked in the same order
140-
// as the service enters those states. Additionally, at most one of the listener's callbacks will execute
141-
// at once. However, multiple listeners' callbacks may execute concurrently, and listeners may execute
142-
// in an order different from the one in which they were registered.
143117
func (r *ringClient) AddListener(listener services.Listener) {
144-
r.AddListener(listener)
118+
r.ring.AddListener(listener)
145119
}

0 commit comments

Comments
 (0)