All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.elassandra.discovery.CassandraDiscoveryPlugin Maven / Gradle / Ivy

There is a newer version: 6.2.3.31
Show newest version
/*
 * Licensed to Elasticsearch under one or more contributor
 * license agreements. See the NOTICE file distributed with
 * this work for additional information regarding copyright
 * ownership. Elasticsearch licenses this file to you under
 * the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.elassandra.discovery;

import org.apache.logging.log4j.Logger;
import org.elasticsearch.cluster.routing.allocation.AllocationService;
import org.elasticsearch.cluster.service.ClusterApplier;
import org.elasticsearch.cluster.service.MasterService;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.discovery.Discovery;
import org.elasticsearch.discovery.zen.UnicastHostsProvider;
import org.elasticsearch.plugins.DiscoveryPlugin;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;

import java.util.Collections;
import java.util.Map;
import java.util.function.Supplier;

public class CassandraDiscoveryPlugin implements DiscoveryPlugin {

    private static Logger logger = Loggers.getLogger(CassandraDiscoveryPlugin.class);
    private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger);

    public static final String CASSANDRA = "cassandra";
    
    private Settings settings;
    
    public CassandraDiscoveryPlugin(Settings settings) {
        this.settings = settings;
    }
    
    @Override
    public Map> getDiscoveryTypes(ThreadPool threadPool, TransportService transportService,
            NamedWriteableRegistry namedWriteableRegistry,
            MasterService masterService,
            ClusterApplier clusterApplier,
            ClusterSettings clusterSettings,
            UnicastHostsProvider hostsProvider,
            AllocationService allocationService) {
        return Collections.singletonMap(CASSANDRA, () ->
            new CassandraDiscovery(settings, transportService, masterService.getClusterService(), clusterApplier, namedWriteableRegistry));
        
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy