@@ -90,56 +90,30 @@ func (r *ringClient) Pool() *ring_client.Pool {
90
90
return r .pool
91
91
}
92
92
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.
95
93
func (r * ringClient ) StartAsync (ctx context.Context ) error {
96
- return r .StartAsync (ctx )
94
+ return r .ring . StartAsync (ctx )
97
95
}
98
96
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.
103
97
func (r * ringClient ) AwaitRunning (ctx context.Context ) error {
104
- return r .AwaitRunning (ctx )
98
+ return r .ring . AwaitRunning (ctx )
105
99
}
106
100
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.
111
101
func (r * ringClient ) StopAsync () {
112
- r .StopAsync ()
102
+ r .ring . StopAsync ()
113
103
}
114
104
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.
119
105
func (r * ringClient ) AwaitTerminated (ctx context.Context ) error {
120
- return r .AwaitTerminated (ctx )
106
+ return r .ring . AwaitTerminated (ctx )
121
107
}
122
108
123
- // FailureCase returns error if Service is in Failed state.
124
- // If Service is not in Failed state, this method returns nil.
125
109
func (r * ringClient ) FailureCase () error {
126
- return r .FailureCase ()
110
+ return r .ring . FailureCase ()
127
111
}
128
112
129
- // State returns current state of the service.
130
113
func (r * ringClient ) State () services.State {
131
- return r .State ()
114
+ return r .ring . State ()
132
115
}
133
116
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.
143
117
func (r * ringClient ) AddListener (listener services.Listener ) {
144
- r .AddListener (listener )
118
+ r .ring . AddListener (listener )
145
119
}
0 commit comments