OLD | NEW |
1 /* Copyright (c) 2012 Stanford University | 1 /* Copyright (c) 2012 Stanford University |
2 * | 2 * |
3 * Permission to use, copy, modify, and distribute this software for any | 3 * Permission to use, copy, modify, and distribute this software for any |
4 * purpose with or without fee is hereby granted, provided that the above | 4 * purpose with or without fee is hereby granted, provided that the above |
5 * copyright notice and this permission notice appear in all copies. | 5 * copyright notice and this permission notice appear in all copies. |
6 * | 6 * |
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES | 7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES |
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR | 9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR |
10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 * \return | 182 * \return |
183 * Current state of processing for this RPC. | 183 * Current state of processing for this RPC. |
184 */ | 184 */ |
185 RpcState getState() { | 185 RpcState getState() { |
186 RpcState result = state; | 186 RpcState result = state; |
187 Fence::lfence(); | 187 Fence::lfence(); |
188 return result; | 188 return result; |
189 } | 189 } |
190 | 190 |
191 virtual bool handleTransportError(); | 191 virtual bool handleTransportError(); |
192 void retry(uint64_t microseconds); | 192 void retry(uint32_t minDelayMicros, uint32_t maxDelayMicros); |
193 virtual void send(); | 193 virtual void send(); |
194 void simpleWait(Dispatch* dispatch); | 194 void simpleWait(Dispatch* dispatch); |
195 const char* stateString(); | 195 const char* stateString(); |
196 bool waitInternal(Dispatch* dispatch, uint64_t abortTime = ~0UL); | 196 bool waitInternal(Dispatch* dispatch, uint64_t abortTime = ~0UL); |
197 | 197 |
198 /// Request and response messages. In some cases the response buffer | 198 /// Request and response messages. In some cases the response buffer |
199 /// is provided by the wrapper (e.g., for reads); if not, response refers | 199 /// is provided by the wrapper (e.g., for reads); if not, response refers |
200 /// to defaultResponse. | 200 /// to defaultResponse. |
201 Buffer request; | 201 Buffer request; |
202 Buffer* response; | 202 Buffer* response; |
203 | 203 |
204 /// Storage to use for response if constructor was not given an explicit | 204 /// Storage to use for response if constructor was not given an explicit |
205 /// response buffer. | 205 /// response buffer. |
206 Tub<Buffer> defaultResponse; | 206 Tub<Buffer> defaultResponse; |
207 | 207 |
208 /// Current state of processing this RPC. This variable may be accessed | 208 /// Current state of processing this RPC. This variable may be accessed |
209 /// concurrently by wrapper methods running in one thread and transport | 209 /// concurrently by wrapper methods running in one thread and transport |
210 /// code running in the dispatch thread (transports can only invoke the | 210 /// code running in the dispatch thread (transports can only invoke the |
211 /// completed and failed methods). | 211 /// completed and failed methods). |
212 Atomic<RpcState> state; | 212 Atomic<RpcState> state; |
213 | 213 |
214 /// Session on which RPC has been sent, or NULL if none. | 214 /// Session on which RPC has been sent, or NULL if none. |
215 Transport::SessionRef session; | 215 Transport::SessionRef session; |
216 | 216 |
217 /// Retry the RPC when Cycles::rdtsc reaches this value. | 217 /// Retry the RPC when Cycles::rdtsc reaches this value. |
218 uint64_t retryTime; | 218 uint64_t retryTime; |
219 | 219 |
220 /// Microseconds to wait before retrying an RPC after it receives | |
221 /// STATUS_RETRY from a server. Defaults to 100 us, but RPCs | |
222 /// may override it. | |
223 uint64_t usBetweenRetry; | |
224 | |
225 /// Expected size of the response header, in bytes. | 220 /// Expected size of the response header, in bytes. |
226 uint32_t responseHeaderLength; | 221 uint32_t responseHeaderLength; |
227 | 222 |
228 /// Response header; filled in by isReady, so that wrapper functions | 223 /// Response header; filled in by isReady, so that wrapper functions |
229 /// don't have to recompute it. Guaranteed to actually refer to at | 224 /// don't have to recompute it. Guaranteed to actually refer to at |
230 /// least responseHeaderLength bytes. | 225 /// least responseHeaderLength bytes. |
231 const WireFormat::ResponseCommon* responseHeader; | 226 const WireFormat::ResponseCommon* responseHeader; |
232 | 227 |
233 DISALLOW_COPY_AND_ASSIGN(RpcWrapper); | 228 DISALLOW_COPY_AND_ASSIGN(RpcWrapper); |
234 }; | 229 }; |
235 | 230 |
236 } // end RAMCloud | 231 } // end RAMCloud |
237 | 232 |
238 #endif // RAMCLOUD_RPCWRAPPER_H | 233 #endif // RAMCLOUD_RPCWRAPPER_H |
OLD | NEW |