X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fapi%2Fdata%2FDataCommitHandler.java;fp=opendaylight%2Fmd-sal%2Fsal-binding-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Fapi%2Fdata%2FDataCommitHandler.java;h=ea5a16e27b3159dad19469c13e329c5971ee517c;hb=fe024ad74b8656c3ee61b9ddff6009a779aa2189;hp=0000000000000000000000000000000000000000;hpb=437c1bdb967072319e81774bdcf570b2fb0f7b89;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataCommitHandler.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataCommitHandler.java new file mode 100644 index 0000000000..ea5a16e27b --- /dev/null +++ b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/data/DataCommitHandler.java @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.controller.sal.binding.api.data; + +import java.util.Set; + +import org.opendaylight.controller.sal.binding.api.BindingAwareProvider; +import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality; +import org.opendaylight.controller.sal.common.DataStoreIdentifier; +import org.opendaylight.yangtools.yang.common.RpcResult; + +/** + * Two phase commit handler (cohort) of the two-phase commit protocol of data. + * + *
+ * The provider should expose the implementation of DataCommitHandler if it's + * functionality depends on any subset of data stored in data repositories, in + * order to participate in {@link DataBrokerService#commit(DataStoreIdentifier) + * operation. + * + *
+ * Operations of two-phase commit handlers should not change data in data store, + * this is responsibility of the coordinator (broker or some component of the + * broker). + * + * The commit handlers are responsible for changing the internal state of the + * provider to reflect the commited changes in data. + * + *
Consumer
edits data by invocation of
+ * DataBrokerService.editCandidateData(DataStoreIdentifier, DataRoot)
+ * Consumer
starts a commit by invoking
+ * DataBrokerService.commit(DataStoreIdentifier)
+ * Broker
retrieves a list of all registered
+ * DataCommitHandlers
+ * DataCommitHandler
+ * Broker
invokes a
+ * DataCommitHandler.requestCommit(DataStoreIdentifier)
operation.
+ * DataCommitHandler
returns a RpcResult
with
+ * CommitTransaction
+ * CommitTransaction
+ * to the list of opened transactions. If not, brokers stops a commit request
+ * phase and starts a rollback phase.
+ * Broker
starts a commit finish phase
+ * CommitTransaction
from Commit Request phase
+ * Broker
broker invokes a
+ * CommitTransaction.finish()
+ * RpcResult
.
+ * CommitTransaction
from Commit Request phase
+ * Broker
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * broker invokes a {@link CommitTransaction#finish()}
+ * + * The commit handler (provider) prepares an commit scenario, rollback + * scenario and validates data. + * + *
+ * If the provider is aware that at this point the commit would not be
+ * successful, the transaction is not created, but list of errors which
+ * prevented the start of transaction are returned.
+ *
+ * @param store
+ * @return Transaction object representing this commit, errors otherwise.
+ */
+ RpcResult