1 /*
2   Copyright (c) DataStax, Inc.
3 
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7 
8   http://www.apache.org/licenses/LICENSE-2.0
9 
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15 */
16 
17 #ifndef __ALWAYS_IGNORE_RETRY_POLICY_HPP__
18 #define __ALWAYS_IGNORE_RETRY_POLICY_HPP__
19 
20 #include "objects/retry_policy.hpp"
21 
22 #include "retry_policy.hpp"
23 
24 namespace test { namespace driver {
25 
26 /**
27  * Retry policy that will create an ignore decision for retry
28  */
29 class IgnoreRetryPolicy : public datastax::internal::core::DefaultRetryPolicy {
30 public:
IgnoreRetryPolicy()31   IgnoreRetryPolicy()
32       : datastax::internal::core::DefaultRetryPolicy() {}
33 
34   /**
35    * Create an instance of the retry policy for use with the driver
36    *
37    * @return Driver ready retry policy
38    */
policy()39   static ::test::driver::RetryPolicy policy() {
40     datastax::internal::core::RetryPolicy* policy = new IgnoreRetryPolicy();
41     policy->inc_ref();
42     return CassRetryPolicy::to(policy);
43   }
44 
on_read_timeout(const datastax::internal::core::Request * request,CassConsistency cl,int received,int required,bool data_recevied,int num_retries) const45   RetryDecision on_read_timeout(const datastax::internal::core::Request* request,
46                                 CassConsistency cl, int received, int required, bool data_recevied,
47                                 int num_retries) const {
48     return RetryDecision::ignore();
49   }
on_write_timeout(const datastax::internal::core::Request * request,CassConsistency cl,int received,int required,CassWriteType write_type,int num_retries) const50   RetryDecision on_write_timeout(const datastax::internal::core::Request* request,
51                                  CassConsistency cl, int received, int required,
52                                  CassWriteType write_type, int num_retries) const {
53     return RetryDecision::ignore();
54   }
on_unavailable(const datastax::internal::core::Request * request,CassConsistency cl,int required,int alive,int num_retries) const55   virtual RetryDecision on_unavailable(const datastax::internal::core::Request* request,
56                                        CassConsistency cl, int required, int alive,
57                                        int num_retries) const {
58     return RetryDecision::ignore();
59   }
on_request_error(const datastax::internal::core::Request * request,CassConsistency cl,const datastax::internal::core::ErrorResponse * error,int num_retries) const60   virtual RetryDecision on_request_error(const datastax::internal::core::Request* request,
61                                          CassConsistency cl,
62                                          const datastax::internal::core::ErrorResponse* error,
63                                          int num_retries) const {
64     return RetryDecision::ignore();
65   }
66 };
67 
68 }} // namespace test::driver
69 
70 #endif // __ALWAYS_IGNORE_RETRY_POLICY_HPP__
71