import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListener;
import org.opendaylight.controller.cluster.datastore.messages.RegisterChangeListenerReply;
import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
+import org.opendaylight.controller.cluster.datastore.shardstrategy.ShardStrategyFactory;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
Executors.newFixedThreadPool(10);
public DistributedDataStore(ActorSystem actorSystem, String type, ClusterWrapper cluster, Configuration configuration) {
- this(new ActorContext(actorSystem, actorSystem.actorOf(ShardManager.props(type, cluster, configuration), "shardmanager-" + type), configuration), type);
+ this(new ActorContext(actorSystem, actorSystem
+ .actorOf(ShardManager.props(type, cluster, configuration),
+ "shardmanager-" + type), cluster, configuration), type);
}
public DistributedDataStore(ActorContext actorContext, String type) {
@Override
- public <L extends AsyncDataChangeListener<InstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
- InstanceIdentifier path, L listener,
+ public <L extends AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>>> ListenerRegistration<L> registerChangeListener(
+ YangInstanceIdentifier path, L listener,
AsyncDataBroker.DataChangeScope scope) {
ActorRef dataChangeListenerActor = actorContext.getActorSystem().actorOf(
- DataChangeListener.props(listener));
+ DataChangeListener.props(schemaContext,listener,path ));
- Object result = actorContext.executeShardOperation(Shard.DEFAULT_NAME,
+ String shardName = ShardStrategyFactory.getStrategy(path).findShard(path);
+
+ Object result = actorContext.executeShardOperation(shardName,
new RegisterChangeListener(path, dataChangeListenerActor.path(),
- AsyncDataBroker.DataChangeScope.BASE).toSerializable(),
+ scope).toSerializable(),
ActorContext.ASK_DURATION
);