ScaleOut C++ Native Client API  5.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
lock_options.h
1 /*
2  Copyright (c) 2013 by ScaleOut Software, 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 #pragma once
18 
19 #include <stdint.h>
20 
21 namespace sosscli {
22 
25 {
26 public:
27 
28  /* Constants */
29 
33 
34  /* Constructors */
35 
38  : throw_on_error_(true), max_lock_retry_count_(20000), lock_retry_interval_ms_(5) {}
39 
46  : throw_on_error_(throw_on_error), max_lock_retry_count_(max_lock_retry_count), lock_retry_interval_ms_(lock_retry_interval_ms) {}
47 
49  virtual ~LockOptions() {};
50 
51  /* Accessors */
52 
55  bool throw_on_error() const { return throw_on_error_; }
61  LockOptions& set_throw_on_error(bool throw_on_error) { throw_on_error_ = throw_on_error; return *this; }
62 
64  int32_t max_lock_retry_count() const { return max_lock_retry_count_; }
68  LockOptions& set_max_lock_retry_count(int32_t max_lock_retry_count) { max_lock_retry_count_ = max_lock_retry_count; return *this; }
69 
71  int32_t lock_retry_interval_ms() const { return lock_retry_interval_ms_; }
75  LockOptions& set_lock_retry_interval_ms(int32_t lock_retry_interval_ms) { lock_retry_interval_ms_ = lock_retry_interval_ms; return *this; }
76 
77 protected:
78 
79 private:
80 
81  bool throw_on_error_;
82  int32_t max_lock_retry_count_;
83  int32_t lock_retry_interval_ms_;
84 };
85 
86 } // namespace