未验证 提交 21f71985 编写于 作者: H He Wang 提交者: GitHub

add workingMode to common configs (#46)

* add workingMode to common configs

* modify doc
上级 973b5180
...@@ -61,18 +61,14 @@ To connect to LogProxy, there are some parameters to set in `ObReaderConfig`: ...@@ -61,18 +61,14 @@ To connect to LogProxy, there are some parameters to set in `ObReaderConfig`:
- *tb_white_list*: Table whitelist in format `tenant_name.database_name.table_name`, `*` indicates any value, and multiple values can be separated by `|`. Default is `*.*.*`. - *tb_white_list*: Table whitelist in format `tenant_name.database_name.table_name`, `*` indicates any value, and multiple values can be separated by `|`. Default is `*.*.*`.
- *tb_black_list*: Table blacklist in the same format with whitelist. Default is `|`. - *tb_black_list*: Table blacklist in the same format with whitelist. Default is `|`.
- *timezone*: Timezone offset from UTC. Default value is `+8:00`. - *timezone*: Timezone offset from UTC. Default value is `+8:00`.
- *working_mode*: Working mode. Can be `storage` (default value, supported from `obcdc` 3.1.3) or `memory`.
These parameters are used in `obcdc` (former `liboblog`), and the items not listed above can be passed to `obcdc` through the `ObReaderConfig` constructor with parameters. These parameters are used in `obcdc` (former `liboblog`), and the items not listed above can be passed to `obcdc` through the `ObReaderConfig` constructor with parameters.
Here is an example to set `ObReaderConfig` with OceanBase Community Edition: Here is an example to set `ObReaderConfig` with OceanBase Community Edition:
```java ```java
// obcdc params that are not listed above can be passed through the constructor ObReaderConfig config = new ObReaderConfig();
Map<String, String> extraConfigs = new HashMap<>();
extraConfigs.put("working_mode", "storage");
// set 'rootserver_list' and other params
ObReaderConfig config = new ObReaderConfig(extraConfigs);
config.setRsList("127.0.0.1:2882:2881"); config.setRsList("127.0.0.1:2882:2881");
config.setUsername("username"); config.setUsername("username");
config.setPassword("password"); config.setPassword("password");
......
...@@ -54,6 +54,10 @@ public class ObReaderConfig extends AbstractConnectionConfig { ...@@ -54,6 +54,10 @@ public class ObReaderConfig extends AbstractConnectionConfig {
/** Timezone offset. */ /** Timezone offset. */
private static final ConfigItem<String> TIME_ZONE = new ConfigItem<>("timezone", "+8:00"); private static final ConfigItem<String> TIME_ZONE = new ConfigItem<>("timezone", "+8:00");
/** Working mode. */
private static final ConfigItem<String> WORKING_MODE =
new ConfigItem<>("working_mode", "storage");
/** Constructor with empty arguments. */ /** Constructor with empty arguments. */
public ObReaderConfig() { public ObReaderConfig() {
super(new HashMap<>()); super(new HashMap<>());
...@@ -212,4 +216,13 @@ public class ObReaderConfig extends AbstractConnectionConfig { ...@@ -212,4 +216,13 @@ public class ObReaderConfig extends AbstractConnectionConfig {
public void setTimezone(String timezone) { public void setTimezone(String timezone) {
TIME_ZONE.set(timezone); TIME_ZONE.set(timezone);
} }
/**
* Set working mode.
*
* @param workingMode Working mode, can be 'memory' or 'storage'.
*/
public void setWorkingMode(String workingMode) {
WORKING_MODE.set(workingMode);
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册