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
8 package org.opendaylight.controller.md.sal.dom.store.impl;
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.controller.sal.core.spi.data.AbstractSnapshotBackedTransactionChain;
12 import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort;
13 import org.opendaylight.controller.sal.core.spi.data.SnapshotBackedWriteTransaction;
14 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
15 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
17 final class DOMStoreTransactionChainImpl extends AbstractSnapshotBackedTransactionChain<String> {
18 private final InMemoryDOMDataStore store;
20 DOMStoreTransactionChainImpl(final InMemoryDOMDataStore store) {
21 this.store = Preconditions.checkNotNull(store);
25 protected DOMStoreThreePhaseCommitCohort createCohort(final SnapshotBackedWriteTransaction<String> tx, final DataTreeModification tree) {
26 return new ChainedTransactionCommitImpl(tx, store.transactionReady(tx, tree), this);
30 protected DataTreeSnapshot takeSnapshot() {
31 return store.takeSnapshot();
35 protected String nextTransactionIdentifier() {
36 return store.nextIdentifier();
40 protected boolean getDebugTransactions() {
41 return store.getDebugTransactions();
44 void transactionFailed(final SnapshotBackedWriteTransaction<String> transaction, final Throwable cause) {
45 super.onTransactionFailed(transaction, cause);
48 void transactionCommited(final SnapshotBackedWriteTransaction<String> transaction) {
49 super.onTransactionCommited(transaction);