- public DistributedDataStore(ActorSystem actorSystem, ClusterWrapper cluster,
- Configuration configuration, DatastoreContext datastoreContext) {
- Preconditions.checkNotNull(actorSystem, "actorSystem should not be null");
- Preconditions.checkNotNull(cluster, "cluster should not be null");
- Preconditions.checkNotNull(configuration, "configuration should not be null");
- Preconditions.checkNotNull(datastoreContext, "datastoreContext should not be null");
-
- this.type = datastoreContext.getDataStoreType();
-
- String shardManagerId = ShardManagerIdentifier.builder().type(type).build().toString();
-
- LOG.info("Creating ShardManager : {}", shardManagerId);
-
- String shardDispatcher =
- new Dispatchers(actorSystem.dispatchers()).getDispatcherPath(Dispatchers.DispatcherType.Shard);
-
- actorContext = new ActorContext(actorSystem, createShardManager(actorSystem, cluster, configuration,
- datastoreContext, shardDispatcher, shardManagerId ), cluster, configuration, datastoreContext);
-
- this.waitTillReadyTimeInMillis =
- actorContext.getDatastoreContext().getShardLeaderElectionTimeout().duration().toMillis() * READY_WAIT_FACTOR;
-
- this.txContextFactory = TransactionContextFactory.create(actorContext);
-
- datastoreConfigMXBean = new DatastoreConfigurationMXBeanImpl(datastoreContext.getDataStoreMXBeanType());
- datastoreConfigMXBean.setContext(datastoreContext);
- datastoreConfigMXBean.registerMBean();
-
- datastoreInfoMXBean = new DatastoreInfoMXBeanImpl(datastoreContext.getDataStoreMXBeanType(), actorContext);
- datastoreInfoMXBean.registerMBean();
- }
-
- public DistributedDataStore(ActorContext actorContext) {
- this.actorContext = Preconditions.checkNotNull(actorContext, "actorContext should not be null");
- this.txContextFactory = TransactionContextFactory.create(actorContext);
- this.type = UNKNOWN_TYPE;
- this.waitTillReadyTimeInMillis =
- actorContext.getDatastoreContext().getShardLeaderElectionTimeout().duration().toMillis() * READY_WAIT_FACTOR;
- }
-
- public void setCloseable(AutoCloseable closeable) {
- this.closeable = closeable;
+ public DistributedDataStore(final ActorSystem actorSystem, final ClusterWrapper cluster,
+ final Configuration configuration, final DatastoreContextFactory datastoreContextFactory,
+ final DatastoreSnapshot restoreFromSnapshot) {
+ super(actorSystem, cluster, configuration, datastoreContextFactory, restoreFromSnapshot);
+ this.txContextFactory = new TransactionContextFactory(getActorContext(), getIdentifier());