@Beta
public interface DOMDataTreeCommitCohort
DOMDataTreeCommitCohort
s are hooked up into commit of data tree changes and MAY
negatively affect performance of data broker / store.
Implementations of this interface are discouraged, unless you really need ability to veto data
tree changes, or to provide external state change in sync with visibility of committed data.
DOMDataTreeCandidate
instances and
provided SchemaContext
for validation purposes.
Use of any other external mutable state is discouraged, implementation MUST NOT use any
transaction related APIs on same data broker / data store instance during invocation of
callbacks, except ones provided as argument. Note that this MAY BE enforced by some
implementations of DOMDataBroker
or DOMDataCommitCoordinator
Note that this may be enforced by some implementations of DOMDataTreeCommitCohortRegistry
and such calls may fail.
SchemaContext
obtained by other means, may not be valid for the
associated DOMDataTreeCandidates and it may lead to incorrect validation or processing of provided
data.
DOMDataTreeCandidate
being successfully committed until associated
PostCanCommitStep.preCommit()
and
PostPreCommitStep.commit()
callback was invoked.
DOMDataTreeCandidate
instances and does not
retain any state derived from edited data - does not care if a DOMDataTreeCandidate
was
rejected afterwards or transaction was cancelled.
Implementation may opt-out from receiving preCommit()
, commit()
, abort()
callbacks by returning PostCanCommitStep.NOOP
.
Modifier and Type | Interface and Description |
---|---|
static class |
DOMDataTreeCommitCohort.DataValidationFailedExceptionMapper
An ExceptionMapper that translates an Exception to a DataValidationFailedException.
|
Modifier and Type | Method and Description |
---|---|
default com.google.common.util.concurrent.CheckedFuture<PostCanCommitStep,DataValidationFailedException> |
canCommit(Object txId,
Collection<DOMDataTreeCandidate> candidates,
org.opendaylight.yangtools.yang.model.api.SchemaContext ctx)
Validates supplied data tree candidates and associates cohort-specific steps with data broker
transaction.
|
default com.google.common.util.concurrent.CheckedFuture<PostCanCommitStep,DataValidationFailedException> |
canCommit(Object txId,
DOMDataTreeCandidate candidate,
org.opendaylight.yangtools.yang.model.api.SchemaContext ctx)
Deprecated.
Implement and invoke
canCommit(Object, Collection, SchemaContext) instead. |
@Deprecated @Nonnull default com.google.common.util.concurrent.CheckedFuture<PostCanCommitStep,DataValidationFailedException> canCommit(@Nonnull Object txId, @Nonnull DOMDataTreeCandidate candidate, @Nonnull org.opendaylight.yangtools.yang.model.api.SchemaContext ctx)
canCommit(Object, Collection, SchemaContext)
instead.canCommit(Object, Collection, SchemaContext)
and only exists for backwards compatibility. The
default implementation returns PostCanCommitStep.NOOP_SUCCESS_FUTURE
and is invoked by the
default implementation of canCommit(Object, Collection, SchemaContext)
.@Nonnull default com.google.common.util.concurrent.CheckedFuture<PostCanCommitStep,DataValidationFailedException> canCommit(@Nonnull Object txId, @Nonnull Collection<DOMDataTreeCandidate> candidates, @Nonnull org.opendaylight.yangtools.yang.model.api.SchemaContext ctx)
DataValidationFailedException
is thrown by implementation, commit of supplied data
will be prevented, with the DataBroker transaction providing the thrown exception as the
cause of failure.
Note the implementations are expected to do validation and processing asynchronous.
Implementations SHOULD do processing fast, and are discouraged SHOULD NOT block on any
external resources.
Implementation MUST NOT access any data transaction related APIs during invocation of
callback. Note that this may be enforced by some implementations of
DOMDataTreeCommitCohortRegistry
and such calls may fail.
Implementation MAY opt-out from implementing other steps by returning
PostCanCommitStep.NOOP
. Otherwise implementation MUST return instance of
PostCanCommitStep
, which will be used to invoke
PostPreCommitStep.commit()
or
ThreePhaseCommitStep.abort()
based on accepting data by data broker and or other commit
cohorts.txId
- Transaction identifier. SHOULD be used only for reporting and correlation.
Implementation MUST NOT use txId
for validation.candidates
- Data Tree candidates to be validated and committed.ctx
- Schema Context to which Data Tree candidate should conform.PostCanCommitStep
if all candidates are valid, or a failed checked future with a
DataValidationFailedException
if and only if a provided
DOMDataTreeCandidate
instance did not pass validation. Users are encouraged to use
more specific subclasses of this exception to provide additional information about
validation failure reason.Copyright © 2019 OpenDaylight. All rights reserved.