MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
process_param.h
1/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2miniob is licensed under Mulan PSL v2.
3You can use this software according to the terms and conditions of the Mulan PSL v2.
4You may obtain a copy of Mulan PSL v2 at:
5 http://license.coscl.org.cn/MulanPSL2
6THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9See the Mulan PSL v2 for more details. */
10
11//
12// Created by Longda on 2010
13//
14
15#pragma once
16
17#include "common/lang/string.h"
18#include "common/lang/vector.h"
19
20namespace common {
21
23{
24
25public:
26 ProcessParam() {}
27
28 virtual ~ProcessParam() {}
29
30 void init_default(string &process_name);
31
32 const string &get_std_out() const { return std_out_; }
33
34 void set_std_out(const string &std_out) { ProcessParam::std_out_ = std_out; }
35
36 const string &get_std_err() const { return std_err_; }
37
38 void set_std_err(const string &std_err) { ProcessParam::std_err_ = std_err; }
39
40 const string &get_conf() const { return conf; }
41
42 void set_conf(const string &conf) { ProcessParam::conf = conf; }
43
44 const string &get_process_name() const { return process_name_; }
45
46 void set_process_name(const string &processName) { ProcessParam::process_name_ = processName; }
47
48 bool is_demon() const { return demon; }
49
50 void set_demon(bool demon) { ProcessParam::demon = demon; }
51
52 const vector<string> &get_args() const { return args; }
53
54 void set_args(const vector<string> &args) { ProcessParam::args = args; }
55
56 void set_server_port(int port) { server_port_ = port; }
57
58 int get_server_port() const { return server_port_; }
59
60 void set_unix_socket_path(const char *unix_socket_path) { unix_socket_path_ = unix_socket_path; }
61
62 const string &get_unix_socket_path() const { return unix_socket_path_; }
63
64 void set_protocol(const char *protocol) { protocol_ = protocol; }
65
66 const string &get_protocol() const { return protocol_; }
67
68 void set_trx_kit_name(const char *kit_name)
69 {
70 if (kit_name) {
71 trx_kit_name_ = kit_name;
72 }
73 }
74
75 const string &trx_kit_name() const { return trx_kit_name_; }
76
77 void set_storage_engine(const char *storage_engine)
78 {
79 if (storage_engine) {
80 storage_engine_ = storage_engine;
81 }
82 }
83
84 const string &storage_engine() const { return storage_engine_; }
85
86 void set_thread_handling_name(const char *thread_handling_name)
87 {
88 if (thread_handling_name) {
89 thread_handling_name_ = thread_handling_name;
90 }
91 }
92
93 const string &thread_handling_name() const { return thread_handling_name_; }
94
95 void set_buffer_pool_memory_size(int bytes) { buffer_pool_memory_size_ = bytes; }
96
97 int buffer_pool_memory_size() const { return buffer_pool_memory_size_; }
98
99 void set_durability_mode(const char *mode) { durability_mode_ = mode; }
100 const string &durability_mode() const { return durability_mode_; }
101
102private:
103 string std_out_; // The output file
104 string std_err_; // The err output file
105 string conf; // The configuration file
106 string process_name_; // The process name
107 bool demon = false; // whether demon or not
108 vector<string> args; // arguments
109 int server_port_ = -1; // server port(if valid, will overwrite the port in the config file)
110 string unix_socket_path_;
111 string protocol_;
112 string trx_kit_name_;
113 string storage_engine_;
114 string thread_handling_name_;
115 int buffer_pool_memory_size_ = -1;
116 string durability_mode_;
117};
118
119ProcessParam *&the_process_param();
120
121} // namespace common
Definition: process_param.h:23