Search in sources :

Example 6 with Configuration

use of org.opendaylight.controller.cluster.datastore.config.Configuration in project controller by opendaylight.

the class DistributedShardedDOMDataTree method createPrefixConfigShard.

private static void createPrefixConfigShard(final AbstractDataStore dataStore) {
    Configuration configuration = dataStore.getActorContext().getConfiguration();
    Collection<MemberName> memberNames = configuration.getUniqueMemberNamesForAllShards();
    CreateShard createShardMessage = new CreateShard(new ModuleShardConfiguration(PrefixShards.QNAME.getNamespace(), "prefix-shard-configuration", ClusterUtils.PREFIX_CONFIG_SHARD_ID, ModuleShardStrategy.NAME, memberNames), Shard.builder(), dataStore.getActorContext().getDatastoreContext());
    dataStore.getActorContext().getShardManager().tell(createShardMessage, noSender());
}
Also used : Configuration(org.opendaylight.controller.cluster.datastore.config.Configuration) ModuleShardConfiguration(org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration) MemberName(org.opendaylight.controller.cluster.access.concepts.MemberName) CreateShard(org.opendaylight.controller.cluster.datastore.messages.CreateShard) ModuleShardConfiguration(org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration)

Example 7 with Configuration

use of org.opendaylight.controller.cluster.datastore.config.Configuration in project controller by opendaylight.

the class DistributedEntityOwnershipService method start.

public static DistributedEntityOwnershipService start(final ActorContext context, final EntityOwnerSelectionStrategyConfig strategyConfig) {
    ActorRef shardManagerActor = context.getShardManager();
    Configuration configuration = context.getConfiguration();
    Collection<MemberName> entityOwnersMemberNames = configuration.getUniqueMemberNamesForAllShards();
    CreateShard createShard = new CreateShard(new ModuleShardConfiguration(EntityOwners.QNAME.getNamespace(), "entity-owners", ENTITY_OWNERSHIP_SHARD_NAME, ModuleShardStrategy.NAME, entityOwnersMemberNames), newShardBuilder(context, strategyConfig), null);
    Future<Object> createFuture = context.executeOperationAsync(shardManagerActor, createShard, MESSAGE_TIMEOUT);
    createFuture.onComplete(new OnComplete<Object>() {

        @Override
        public void onComplete(final Throwable failure, final Object response) {
            if (failure != null) {
                LOG.error("Failed to create {} shard", ENTITY_OWNERSHIP_SHARD_NAME, failure);
            } else {
                LOG.info("Successfully created {} shard", ENTITY_OWNERSHIP_SHARD_NAME);
            }
        }
    }, context.getClientDispatcher());
    return new DistributedEntityOwnershipService(context);
}
Also used : Configuration(org.opendaylight.controller.cluster.datastore.config.Configuration) ModuleShardConfiguration(org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration) ActorRef(akka.actor.ActorRef) MemberName(org.opendaylight.controller.cluster.access.concepts.MemberName) CreateShard(org.opendaylight.controller.cluster.datastore.messages.CreateShard) ModuleShardConfiguration(org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration)

Aggregations

Configuration (org.opendaylight.controller.cluster.datastore.config.Configuration)7 MemberName (org.opendaylight.controller.cluster.access.concepts.MemberName)3 ConfigurationImpl (org.opendaylight.controller.cluster.datastore.config.ConfigurationImpl)3 ActorRef (akka.actor.ActorRef)2 Test (org.junit.Test)2 ModuleShardConfiguration (org.opendaylight.controller.cluster.datastore.config.ModuleShardConfiguration)2 CreateShard (org.opendaylight.controller.cluster.datastore.messages.CreateShard)2 ActorSystem (akka.actor.ActorSystem)1 TestActorRef (akka.testkit.TestActorRef)1 TestKit (akka.testkit.javadsl.TestKit)1 Collection (java.util.Collection)1 Before (org.junit.Before)1 ClientBackedDataStore (org.opendaylight.controller.cluster.databroker.ClientBackedDataStore)1 AbstractActorTest (org.opendaylight.controller.cluster.datastore.AbstractActorTest)1 ClusterWrapper (org.opendaylight.controller.cluster.datastore.ClusterWrapper)1 DatastoreContext (org.opendaylight.controller.cluster.datastore.DatastoreContext)1 DatastoreContextFactory (org.opendaylight.controller.cluster.datastore.DatastoreContextFactory)1 DistributedDataStore (org.opendaylight.controller.cluster.datastore.DistributedDataStore)1 EmptyModuleShardConfigProvider (org.opendaylight.controller.cluster.datastore.config.EmptyModuleShardConfigProvider)1 NoShardLeaderException (org.opendaylight.controller.cluster.datastore.exceptions.NoShardLeaderException)1