Bug 4105: Add dynamic module/shard config for entity-owners shard 01/26801/1
authorTom Pantelis <tpanteli@brocade.com>
Tue, 11 Aug 2015 00:08:03 +0000 (20:08 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Thu, 10 Sep 2015 19:17:44 +0000 (15:17 -0400)
commit5273c33b6f2051a7e3b1afcc4eeae4e457b6f26c
tree9e4015c488306de7257e7f3e6349504e4fff7fd7
parenta785966182ba80592f99be5a27a9af1d4c2ac37f
Bug 4105: Add dynamic module/shard config for entity-owners shard

Added a new method addModuleShardConfiguration to Configuration.

I simplified the internals of ConfigurationImpl to make it easier to
add a new module/shard config. I combined serveral of the maps into one
moduleConfigMap and reduced the total # of fields to 3. For
synchronization, I kept the maps/sets immutable and used copy-on-write
semantics to update them as they will seldom change. I also made the
fields volatile.

I also removed the singleton nature of ShardStrategyFactory since each
datastore's Configuration will now be different, ie only the operational
datastore's Configuration will have the entity-owners module. The
datastore's ShardStrategyFactory instance is not instantiated and owned
by the ActorContext.

To make things easier for unit tests, I abstracted the file-reading code
in ConfigurationImpl to a new ModuleShardConfigProvider interface and
FileModuleShardConfigProvider implementation in the config package.
I also moved the inner classes to the config package.

While I was at it I also moved Configuration and ConfigurationImpl to the
config package for consistency.

Change-Id: I1d6858d3ae68869ca6f61d4f5a5f0d319d93c485
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
21 files changed:
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStore.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/Configuration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ConfigurationImpl.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/FileModuleShardConfigProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ModuleConfig.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ModuleShardConfigProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ModuleShardConfiguration.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ShardConfig.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ModuleShardStrategy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/ActorContext.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractTransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/IntegrationTestKit.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/config/ConfigurationImplTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipServiceTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardstrategy/ShardStrategyFactoryTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/MockConfiguration.java