Introduce CCR container class

This commit introduces the container class for CCR functionality. Future
work will expose more specific CCR functionality to the X-Pack plugin
through this class.

Relates #2704
This commit is contained in:
Jason Tedor 2017-10-06 14:46:39 -04:00 committed by GitHub
commit 063a76c3db
2 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,41 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ccr;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import java.util.List;
import static org.elasticsearch.xpack.ccr.CcrSettings.CCR_ENABLED_SETTING;
/**
* Container class for CCR functionality.
*/
public final class Ccr {
@SuppressWarnings("unused,FieldCanBeLocal")
private final boolean enabled;
/**
* Construct an instance of the CCR container with the specified settings.
*
* @param settings the settings
*/
public Ccr(final Settings settings) {
this.enabled = CCR_ENABLED_SETTING.get(settings);
}
/**
* The settings defined by CCR.
*
* @return the settings
*/
public List<Setting<?>> getSettings() {
return CcrSettings.getSettings();
}
}

View File

@ -0,0 +1,33 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ccr;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Setting.Property;
import java.util.Collections;
import java.util.List;
/**
* Container class for CCR settings.
*/
final class CcrSettings {
// prevent construction
private CcrSettings() {
}
/**
* Setting for controlling whether or not CCR is enabled.
*/
static final Setting<Boolean> CCR_ENABLED_SETTING = Setting.boolSetting("xpack.ccr.enabled", true, Property.NodeScope);
static List<Setting<?>> getSettings() {
return Collections.singletonList(CCR_ENABLED_SETTING);
}
}