BUG-8402: correctly propagate read-only bit
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / IncrementTransactionSequenceRequest.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.cluster.access.commands;
9
10 import akka.actor.ActorRef;
11 import com.google.common.base.Preconditions;
12 import org.opendaylight.controller.cluster.access.ABIVersion;
13 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
14
15 /**
16  * A blank transaction request. This is used to provide backfill requests in converted retransmit scenarios, such as
17  * when a initial request to a transaction (such as a {@link ReadTransactionRequest}) is satisfied by the backend
18  * before the need to replay the transaction to a different remote backend.
19  *
20  * @author Robert Varga
21  */
22 public final class IncrementTransactionSequenceRequest extends
23         AbstractReadTransactionRequest<IncrementTransactionSequenceRequest> {
24     private static final long serialVersionUID = 1L;
25
26     private final long increment;
27
28     public IncrementTransactionSequenceRequest(final TransactionIdentifier identifier, final long sequence,
29             final ActorRef replyTo, final boolean snapshotOnly, final long increment) {
30         super(identifier, sequence, replyTo, snapshotOnly);
31         Preconditions.checkArgument(increment >= 0);
32         this.increment = increment;
33     }
34
35     /**
36      * Return the sequence increment beyond this request's sequence.
37      *
38      * @return Sequence increment, guaranteed to be non-negative.
39      */
40     public long getIncrement() {
41         return increment;
42     }
43
44     @Override
45     protected IncrementTransactionSequenceRequestProxyV1 externalizableProxy(final ABIVersion version) {
46         return new IncrementTransactionSequenceRequestProxyV1(this);
47     }
48
49     @Override
50     protected IncrementTransactionSequenceRequest cloneAsVersion(final ABIVersion targetVersion) {
51         return this;
52     }
53 }