2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.datastore;
11 import akka.actor.ActorSystem;
12 import com.google.common.annotations.VisibleForTesting;
13 import org.opendaylight.controller.cluster.access.concepts.ClientIdentifier;
14 import org.opendaylight.controller.cluster.datastore.config.Configuration;
15 import org.opendaylight.controller.cluster.datastore.persisted.DatastoreSnapshot;
16 import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
17 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction;
18 import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadWriteTransaction;
19 import org.opendaylight.mdsal.dom.spi.store.DOMStoreTransactionChain;
20 import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction;
23 * Implements a distributed DOMStore using Akka {@code Patterns.ask()}.
25 * @deprecated This implementation is destined for removal,
27 @Deprecated(since = "7.0.0", forRemoval = true)
28 public class DistributedDataStore extends AbstractDataStore {
29 private final TransactionContextFactory txContextFactory;
31 public DistributedDataStore(final ActorSystem actorSystem, final ClusterWrapper cluster,
32 final Configuration configuration, final DatastoreContextFactory datastoreContextFactory,
33 final DatastoreSnapshot restoreFromSnapshot) {
34 super(actorSystem, cluster, configuration, datastoreContextFactory, restoreFromSnapshot);
35 txContextFactory = new TransactionContextFactory(getActorUtils(), getIdentifier());
39 DistributedDataStore(final ActorUtils actorUtils, final ClientIdentifier identifier) {
40 super(actorUtils, identifier);
41 txContextFactory = new TransactionContextFactory(getActorUtils(), getIdentifier());
46 public DOMStoreTransactionChain createTransactionChain() {
47 return txContextFactory.createTransactionChain();
51 public DOMStoreReadTransaction newReadOnlyTransaction() {
52 return new TransactionProxy(txContextFactory, TransactionType.READ_ONLY);
56 public DOMStoreWriteTransaction newWriteOnlyTransaction() {
57 getActorUtils().acquireTxCreationPermit();
58 return new TransactionProxy(txContextFactory, TransactionType.WRITE_ONLY);
62 public DOMStoreReadWriteTransaction newReadWriteTransaction() {
63 getActorUtils().acquireTxCreationPermit();
64 return new TransactionProxy(txContextFactory, TransactionType.READ_WRITE);
69 txContextFactory.close();