Replace IndexSettings annotation with a full-fledged class

The @IndexSettings annoationat has been used to differentiate between node-level
and index level settings. It was also decoupled from realtime-updates such that
the settings object that a class got injected when it was created was static and
not subject to change when an update was applied. This change removes the annoation
and replaces it with a full-fledged class that adds type-safety and encapsulates additional
functionality as well as checks on the settings.
This commit is contained in:
Simon Willnauer 2015-10-21 14:02:10 +02:00
parent 14aaeea25a
commit 66d5d0c4f2
264 changed files with 1290 additions and 1778 deletions

View file

@ -24,8 +24,7 @@ import org.apache.lucene.store.LockFactory;
import org.apache.lucene.store.MMapDirectory;
import org.apache.lucene.store.SmbDirectoryWrapper;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.settings.IndexSettings;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.shard.ShardPath;
import org.elasticsearch.index.store.FsDirectoryService;
import org.elasticsearch.index.store.IndexStore;
@ -36,7 +35,7 @@ import java.nio.file.Path;
public class SmbMmapFsDirectoryService extends FsDirectoryService {
@Inject
public SmbMmapFsDirectoryService(@IndexSettings Settings indexSettings, IndexStore indexStore, ShardPath path) {
public SmbMmapFsDirectoryService(IndexSettings indexSettings, IndexStore indexStore, ShardPath path) {
super(indexSettings, indexStore, path);
}

View file

@ -20,10 +20,7 @@
package org.elasticsearch.index.store.smbmmapfs;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.settings.IndexSettings;
import org.elasticsearch.index.settings.IndexSettingsService;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.shard.ShardPath;
import org.elasticsearch.index.store.DirectoryService;
import org.elasticsearch.index.store.IndexStore;
@ -32,13 +29,12 @@ import org.elasticsearch.indices.store.IndicesStore;
public class SmbMmapFsIndexStore extends IndexStore {
@Inject
public SmbMmapFsIndexStore(Index index, @IndexSettings Settings indexSettings,
IndexSettingsService indexSettingsService, IndicesStore indicesStore) {
super(index, indexSettings, indexSettingsService, indicesStore);
public SmbMmapFsIndexStore(IndexSettings indexSettings, IndicesStore indicesStore) {
super(indexSettings, indicesStore);
}
@Override
public DirectoryService newDirectoryService(ShardPath path) {
return new SmbMmapFsDirectoryService(indexSettings(), this, path);
return new SmbMmapFsDirectoryService(indexSettings, this, path);
}
}

View file

@ -24,8 +24,7 @@ import org.apache.lucene.store.LockFactory;
import org.apache.lucene.store.SimpleFSDirectory;
import org.apache.lucene.store.SmbDirectoryWrapper;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.settings.IndexSettings;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.shard.ShardPath;
import org.elasticsearch.index.store.FsDirectoryService;
import org.elasticsearch.index.store.IndexStore;
@ -36,7 +35,7 @@ import java.nio.file.Path;
public class SmbSimpleFsDirectoryService extends FsDirectoryService {
@Inject
public SmbSimpleFsDirectoryService(@IndexSettings Settings indexSettings, IndexStore indexStore, ShardPath path) {
public SmbSimpleFsDirectoryService(IndexSettings indexSettings, IndexStore indexStore, ShardPath path) {
super(indexSettings, indexStore, path);
}

View file

@ -20,10 +20,7 @@
package org.elasticsearch.index.store.smbsimplefs;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.settings.IndexSettings;
import org.elasticsearch.index.settings.IndexSettingsService;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.shard.ShardPath;
import org.elasticsearch.index.store.DirectoryService;
import org.elasticsearch.index.store.IndexStore;
@ -32,18 +29,13 @@ import org.elasticsearch.indices.store.IndicesStore;
public class SmbSimpleFsIndexStore extends IndexStore {
@Inject
public SmbSimpleFsIndexStore(Index index, @IndexSettings Settings indexSettings,
IndexSettingsService indexSettingsService, IndicesStore indicesStore) {
super(index, indexSettings, indexSettingsService, indicesStore);
}
public Class<? extends DirectoryService> shardDirectory() {
return SmbSimpleFsDirectoryService.class;
public SmbSimpleFsIndexStore(IndexSettings indexSettings, IndicesStore indicesStore) {
super(indexSettings, indicesStore);
}
@Override
public DirectoryService newDirectoryService(ShardPath path) {
return new SmbSimpleFsDirectoryService(indexSettings(), this, path);
return new SmbSimpleFsDirectoryService(indexSettings, this, path);
}
}