Class DistributedShardedDOMDataTree
- java.lang.Object
-
- org.opendaylight.controller.cluster.sharding.DistributedShardedDOMDataTree
-
- All Implemented Interfaces:
DistributedShardFactory
,DOMDataTreeProducerFactory
,DOMDataTreeService
,DOMDataTreeShardingService
,DOMExtensibleService<DOMDataTreeService,DOMDataTreeServiceExtension>
,DOMService
public class DistributedShardedDOMDataTree extends Object implements DOMDataTreeService, DOMDataTreeShardingService, DistributedShardFactory
A layer on top of DOMDataTreeService that distributes producer/shard registrations to remote nodes viaShardedDataTreeActor
. Also provides QoL method for addition of prefix based clustered shard into the system.
-
-
Constructor Summary
Constructors Constructor Description DistributedShardedDOMDataTree(ActorSystemProvider actorSystemProvider, AbstractDataStore distributedOperDatastore, AbstractDataStore distributedConfigDatastore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<DistributedShardRegistration>
createDistributedShard(DOMDataTreeIdentifier prefix, Collection<MemberName> replicaMembers)
Register a new shard that is rooted at the desired prefix with replicas on the provided members.DOMDataTreeProducer
createProducer(Collection<DOMDataTreeIdentifier> subtrees)
ClassToInstanceMap<DOMDataTreeServiceExtension>
getExtensions()
void
init()
This will try to initialize prefix configuration shards upon their successful start.<T extends DOMDataTreeShard>
ListenerRegistration<T>registerDataTreeShard(DOMDataTreeIdentifier prefix, T shard, DOMDataTreeProducer producer)
<T extends DOMDataTreeListener>
ListenerRegistration<T>registerListener(T listener, Collection<DOMDataTreeIdentifier> subtrees, boolean allowRxMerges, Collection<DOMDataTreeProducer> producers)
-
-
-
Constructor Detail
-
DistributedShardedDOMDataTree
public DistributedShardedDOMDataTree(ActorSystemProvider actorSystemProvider, AbstractDataStore distributedOperDatastore, AbstractDataStore distributedConfigDatastore)
-
-
Method Detail
-
init
public void init()
This will try to initialize prefix configuration shards upon their successful start. We need to create writers to these shards, so we can satisfy futurecreateDistributedShard(org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier, java.util.Collection<org.opendaylight.controller.cluster.access.concepts.MemberName>)
andresolveShardAdditions(java.util.Set<org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier>)
requests and update prefix configuration shards accordingly.We also need to initialize listeners on these shards, so we can react on changes made on them by other cluster members or even by ourselves.
Finally, we need to be sure that default shards for both operational and configuration data stores are up and running and we have distributed shards frontend created for them.
This is intended to be invoked by blueprint as initialization method.
-
registerListener
public <T extends DOMDataTreeListener> ListenerRegistration<T> registerListener(T listener, Collection<DOMDataTreeIdentifier> subtrees, boolean allowRxMerges, Collection<DOMDataTreeProducer> producers) throws DOMDataTreeLoopException
- Specified by:
registerListener
in interfaceDOMDataTreeService
- Throws:
DOMDataTreeLoopException
-
getExtensions
public ClassToInstanceMap<DOMDataTreeServiceExtension> getExtensions()
- Specified by:
getExtensions
in interfaceDOMExtensibleService<DOMDataTreeService,DOMDataTreeServiceExtension>
-
createProducer
public DOMDataTreeProducer createProducer(Collection<DOMDataTreeIdentifier> subtrees)
- Specified by:
createProducer
in interfaceDOMDataTreeProducerFactory
-
createDistributedShard
public CompletionStage<DistributedShardRegistration> createDistributedShard(DOMDataTreeIdentifier prefix, Collection<MemberName> replicaMembers) throws DOMDataTreeShardingConflictException
Description copied from interface:DistributedShardFactory
Register a new shard that is rooted at the desired prefix with replicas on the provided members. Note to register a shard without replicas you still need to provide at least one Member for the shard.- Specified by:
createDistributedShard
in interfaceDistributedShardFactory
- Parameters:
prefix
- Shard rootreplicaMembers
- Members that this shard is replicated on, has to have at least one Member even if the shard should not be replicated.- Returns:
- A future that will be completed with a DistributedShardRegistration once the backend and frontend shards are spawned.
- Throws:
DOMDataTreeShardingConflictException
- If the initial check for a conflict on the local node fails, the sharding configuration won't be updated if this exception is thrown.
-
registerDataTreeShard
public <T extends DOMDataTreeShard> ListenerRegistration<T> registerDataTreeShard(DOMDataTreeIdentifier prefix, T shard, DOMDataTreeProducer producer) throws DOMDataTreeShardingConflictException
- Specified by:
registerDataTreeShard
in interfaceDOMDataTreeShardingService
- Throws:
DOMDataTreeShardingConflictException
-
-