2 * Copyright (c) 2016 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
8 package org.opendaylight.controller.cluster.databroker;
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientLocalHistory;
12 import org.opendaylight.controller.cluster.databroker.actors.dds.ClientTransaction;
13 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
14 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
15 import org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain;
16 import org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction;
19 * Implementation of {@link DOMStoreTransactionChain} backed by a {@link ClientLocalHistory}. It wraps
20 * {@link ClientTransaction} into proxies like {@link ShardedDOMStoreReadTransaction} to provide isolation.
22 * @author Robert Varga
24 final class ShardedDOMStoreTransactionChain implements DOMStoreTransactionChain {
25 private final ClientLocalHistory history;
27 ShardedDOMStoreTransactionChain(final ClientLocalHistory history) {
28 this.history = Preconditions.checkNotNull(history);
32 public DOMStoreReadTransaction newReadOnlyTransaction() {
33 return new ShardedDOMStoreReadTransaction(history.createTransaction());
37 public DOMStoreReadWriteTransaction newReadWriteTransaction() {
38 return new ShardedDOMStoreReadWriteTransaction(history.createTransaction());
42 public DOMStoreWriteTransaction newWriteOnlyTransaction() {
43 return new ShardedDOMStoreWriteTransaction(history.createTransaction());